Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130606203837.GD15710@port70.net>
Date: Thu, 6 Jun 2013 22:38:37 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: apr and time.h

* Jens <jensl@...s.mine.nu> [2013-06-06 19:42:39 +0200]:
> apr wont build (for me) with the following part of time.h (musl-0.9.10):
> 
> #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
> #define tm_gmtoff __tm_gmtoff
> #define tm_zone __tm_zone
> #endif
> 
> apr implements a struct with a member named tm_gmtoff.
> 

you gotta love "portability runtime" libraries..

tm_ is in the reserved namespace of posix,
but time.h is specified by iso c as well
which does not have such restriction
so in this case they are not strictly wrong

the correct behaviour of musl would be
to only expose iso c interfaces by default
but then all the codes in the world break..
(including apr most likely)

an ugly workaround that does less namespace
pollution (no tm_* macro):

#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define __tm_gmtoff tm_gmtoff
#define __tm_zone tm_zone
#define _FIX(x) x
#else
#define _FIX(x) __##x
#endif

struct tm {
	/*...*/
	long _FIX(tm_gmtoff);
	const char *_FIX(tm_zone);
};

either this or fix apr so it does not collide
with the posix namespace..

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.