#define __need_XXX patch suggestion

John Tytgat John.Tytgat at aaug.net
Wed Feb 13 13:43:22 PST 2002


In message <07ae27084b.Tony at mk-net.demon.co.uk>
          Tony van der Hoff <tony at mk-net.demon.co.uk> wrote:

> On 13 Feb 2002, in message <m3wuxhacur.fsf at nick.ws.noc.dsvr.net>,
> Nick Burrett <nick at dsvr.net> wrote:
> 
> > I'm all for getting warnings fixed, but when it drastically reduces
> > the readability of the header files, then I'm not so happy.

Unfortunately we can't make macro's for that, can we ? ;-(

> >  Anyway, doesn't Norcroft still complain about non-ANSI #includes ?
> 
> The latter can be suppressed with -Wp in the command line. 

...and is already done in its Makefile : "-wda -wp".  BTW, '-w' is used
and not '-W' (seems to have the same effect), how odd ?!

> I assume that John is referring to the "repeated definition of macro xx".
> According to the manual this can be suppressed by omitting -Fh on the command
> line, however, that also bypasses other potentially desirable pedantry. 

True :-( And you might want to live with this -Fh rule for the UnixLib
compilation but that isn't a solution for the UnixLib *users* unless
you want them also to use -Fh... :-(

Another annoying thing is the output of:

] Errors in file:  UnixHdr:unixlib.h.features
] 
]     Line  Type           Description
]      169  Warning        Undefined macro '__STDC_VERSION__' in #if - treated as 0
]      179  Warning        Undefined macro '_XOPEN_SOURCE' in #if - treated as 0
]      229  Warning        Undefined macro '_FILE_OFFSET_BITS' in #if - treated as 0
]      297  Warning        Undefined macro '__GNUC__' in #if - treated as 0
]      387  Warning        Undefined macro '__STDC_VERSION__' in #if - treated as 0

even if it shouldn't really matter as:

] # if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500

:-(

Also UnixLib *users* have this problem too.

For this last problem, would people agree to add the following at the top of
features.h for those poor Norcroft users ;-) ?

#ifdef __CC_NORCROFT
#ifndef __STDC_VERSION__
# define __STDC_VERSION__	199409L
#endif
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE		500
#endif
#ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS	32
#endif
#ifndef __GNUC__
# define __GNUC__		0
#endif
#endif

John.
-- 
John Tytgat, in his comfy chair at home                                 BASS
John.Tytgat at aaug.net                             ARM powered, RISC OS driven



More information about the gcc mailing list