On Mon, Jun 23, 2008 at 01:45:28PM +0200, Michael Kerrisk wrote:
> On Mon, Jun 23, 2008 at 1:43 PM, Stephane Chazelas
> <[EMAIL PROTECTED]> wrote:
> > On Mon, Jun 23, 2008 at 01:34:04PM +0200, Michael Kerrisk wrote:
> >> On Mon, Jun 23, 2008 at 1:31 PM, Stephane Chazelas
> >> <[EMAIL PROTECTED]> wrote:
> >> > On Mon, Jun 23, 2008 at 12:37:50PM +0200, Michael Kerrisk wrote:
> >> > [...]
> >> >> This feature is not available if the program is compiled with
> >> >> cc -std=cc99 or cc -D_ISOC99_SOURCE (unless _GNU_SOURCE is also
> >> > [...]
> >> >
> >> > typo: -std=c99, not cc99.
> >>
> >> Thanks. Fixed. It sort of balanced out. Elsewhere in the page I
> >> wrote another typo: -std=99.
> > [...]
> >
> > With tcc, you need the -D_GNU_SOURCE:
>
> Thanks. I don't think I'll worry about documenting that though.
Hmmm, in stdio.h, we have:
#if defined __USE_ISOC99 && !defined __USE_GNU \
&& (!defined __LDBL_COMPAT || !defined __REDIRECT) \
&& (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
# ifdef __REDIRECT
/* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
GNU extension which conflicts with valid %a followed by letter
s, S or [. */
extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
__const char *__restrict __format, ...),
__isoc99_fscanf) __wur;
extern int __REDIRECT (scanf, (__const char *__restrict __format, ...),
__isoc99_scanf) __wur;
extern int __REDIRECT (sscanf, (__const char *__restrict __s,
__const char *__restrict __format, ...),
__isoc99_sscanf) __THROW;
Which looks a bit bogus to me (see the handling of __REDIRECT
for instance).
__STRICT_ANSI__ is selected by -std=c99 and -ansi.
__USE_XOPEN2K (XPG6) is selected when __POSIX_C_SOURCE >= 200112L
which is selected by:
/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
(and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */
#if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \
!defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)
# define _POSIX_SOURCE 1
# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
# define _POSIX_C_SOURCE 2
# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600
# define _POSIX_C_SOURCE 199506L
# else
# define _POSIX_C_SOURCE 200112L
# endif
#endif
So, %as is not available for instance with:
cc -D__STDC_VERSION__=199901L
(tcc does set that as a builtin macro
http://hg.sharesource.org/mercurialtcc/rev/1e81d5b65878)
And it is availabe for instance with
cc -D_ISOC99_SOURCE -D_XOPEN_SOURCE=500
Without any implicit define, %as will be enabled I think.
--
Stéphane
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]