Re: CFR: add widely accepted _ISOC99_SOURCE

2003-03-11 Thread Andrey A. Chernov
On Mon, Mar 10, 2003 at 10:44:34 -0500, Mike Barcroft wrote:
 Andrey A. Chernov [EMAIL PROTECTED] writes:
  Many programs (from ports too) defines _ISOC99_SOURCE to get C99 
  functions, but we don't sense this define currently. Here is the fix for 
  review:
 
 Cool.  I didn't realize there was an existing precedence, or I would
 have used it.

Just search Google about _ISOC99_SOURCE and see :-)

 This part isn't needed...
 
   #else
   /*-
* Deal with _ANSI_SOURCE:
  @@ -378,7 +381,7 @@
   #define__XSI_VISIBLE   0
   #define__BSD_VISIBLE   0
   #define__ISO_C_VISIBLE 1990
  -#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
  +#elif defined(_ISOC99_SOURCE)  /* Strict C99 env. */
   #define__POSIX_VISIBLE 0
   #define__XSI_VISIBLE   0
   #define__BSD_VISIBLE   0
 
 ...since the next line here is:
 
 #define   __ISO_C_VISIBLE 1999

Hm, I don't quite understand, which one part you mean? My patch handles
2 following cases:

1) Any _POSIX_C_SOURCE with _ISOC99_SOURCE. It is from real life example
(ImageMagick). It wants lower POSIX level, *but* wants _ISOC99_SOURCE in 
the same time.

2) _ISOC99_SOURCE without any _POSIX_C_SOURCE. In that case it overrides 
_ANSI_SOURCE like old _C99_SOURCE does.

-- 
Andrey A. Chernov
http://ache.pp.ru/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: CFR: add widely accepted _ISOC99_SOURCE

2003-03-11 Thread Mike Barcroft
Andrey A. Chernov [EMAIL PROTECTED] writes:
 Hm, I don't quite understand, which one part you mean? My patch handles
 2 following cases:
 
 1) Any _POSIX_C_SOURCE with _ISOC99_SOURCE. It is from real life example
 (ImageMagick). It wants lower POSIX level, *but* wants _ISOC99_SOURCE in 
 the same time.

I don't like this at all.  The meaning of _ANSI_SOURCE is that the
source is exclusively written in C89 with no BSD, POSIX, or XSI
extentions.  Similarly, I was intending _C99_SOURCE to be used without
any POSIX.  Programs looking for C99+POSIX functions should specify
POSIX.1-2001, which incorporates both of these.

 2) _ISOC99_SOURCE without any _POSIX_C_SOURCE. In that case it overrides 
 _ANSI_SOURCE like old _C99_SOURCE does.

Yes, _ANSI_SOURCE and any other standard constant are mutually
exclusive.  Defining _C99_SOURCE or _ANSI_SOURCE with some other
standard constant results in unspecified behaviour.  I'd like to keep
things this way if you're going to rename _C99_SOURCE.

Best regards,
Mike BArcroft

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: CFR: add widely accepted _ISOC99_SOURCE

2003-03-11 Thread Andrey A. Chernov
On Tue, Mar 11, 2003 at 10:49:43 -0500, Mike Barcroft wrote:
  1) Any _POSIX_C_SOURCE with _ISOC99_SOURCE. It is from real life example
  (ImageMagick). It wants lower POSIX level, *but* wants _ISOC99_SOURCE in 
  the same time.
 
 I don't like this at all.  The meaning of _ANSI_SOURCE is that the
 source is exclusively written in C89 with no BSD, POSIX, or XSI
 extentions.  Similarly, I was intending _C99_SOURCE to be used without
 any POSIX.  Programs looking for C99+POSIX functions should specify
 POSIX.1-2001, which incorporates both of these.

What to do, if, say, C99 program want to use some POSIX functions from 
lower (and not from higher) POSIX standard?

Currently we have problem with ImageMagick - undefined prototypes for 
vsnprintf() and other like, because it wants right that:

magick/studio.h:
...
#define _GNU_SOURCE  1
#define _ISOC99_SOURCE  1
#define _POSIX_C_SOURCE  199506L
#define _XOPEN_SOURCE  500
#define _LARGEFILE64_SOURCE  1

-- 
Andrey A. Chernov
http://ache.pp.ru/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: CFR: add widely accepted _ISOC99_SOURCE

2003-03-11 Thread Mike Barcroft
Andrey A. Chernov [EMAIL PROTECTED] writes:
 On Tue, Mar 11, 2003 at 10:49:43 -0500, Mike Barcroft wrote:
   1) Any _POSIX_C_SOURCE with _ISOC99_SOURCE. It is from real life example
   (ImageMagick). It wants lower POSIX level, *but* wants _ISOC99_SOURCE in 
   the same time.
  
  I don't like this at all.  The meaning of _ANSI_SOURCE is that the
  source is exclusively written in C89 with no BSD, POSIX, or XSI
  extentions.  Similarly, I was intending _C99_SOURCE to be used without
  any POSIX.  Programs looking for C99+POSIX functions should specify
  POSIX.1-2001, which incorporates both of these.
 
 What to do, if, say, C99 program want to use some POSIX functions from 
 lower (and not from higher) POSIX standard?

I think this is pretty rare.  POSIX provides application writers with
lots of time to transition away from deprecated interfaces.  What
functions are missing if you change _POSIX_C_SOURCE to 200112L and
remove _ISOC99_SOURCE from the code you posted?

Best regards,
Mike Barcroft

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: CFR: add widely accepted _ISOC99_SOURCE

2003-03-11 Thread Garrett Wollman
On Tue, 11 Mar 2003 19:42:41 +0300, Andrey A. Chernov [EMAIL PROTECTED] said:

 What to do, if, say, C99 program want to use some POSIX functions from 
 lower (and not from higher) POSIX standard?

Programmer error.  Either it's a C99 program or it's an old-POSIX
program; it cannot be both.

 #define _GNU_SOURCE  1
 #define _ISOC99_SOURCE  1
 #define _POSIX_C_SOURCE  199506L
 #define _XOPEN_SOURCE  500
 #define _LARGEFILE64_SOURCE  1

It is requesting contradictory namespaces, and getting what it
deserves.  It should not define any of these.

-GAWollman


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: CFR: add widely accepted _ISOC99_SOURCE

2003-03-10 Thread Mike Barcroft
Andrey A. Chernov [EMAIL PROTECTED] writes:
 Many programs (from ports too) defines _ISOC99_SOURCE to get C99 
 functions, but we don't sense this define currently. Here is the fix for 
 review:

Cool.  I didn't realize there was an existing precedence, or I would
have used it.

 --- cdefs.h.bak   Wed Oct 23 05:04:06 2002
 +++ cdefs.h   Mon Mar 10 09:11:01 2003
 @@ -360,6 +360,9 @@
  #define  __POSIX_VISIBLE 198808
  #define  __ISO_C_VISIBLE 0
  #endif /* _POSIX_C_SOURCE */
 +#ifdef _ISOC99_SOURCE
 +#define  __ISO_C_VISIBLE 1999
 +#endif

This part isn't needed...

  #else
  /*-
   * Deal with _ANSI_SOURCE:
 @@ -378,7 +381,7 @@
  #define  __XSI_VISIBLE   0
  #define  __BSD_VISIBLE   0
  #define  __ISO_C_VISIBLE 1990
 -#elif defined(_C99_SOURCE)   /* Localism to specify strict C99 env. */
 +#elif defined(_ISOC99_SOURCE)/* Strict C99 env. */
  #define  __POSIX_VISIBLE 0
  #define  __XSI_VISIBLE   0
  #define  __BSD_VISIBLE   0

...since the next line here is:

#define __ISO_C_VISIBLE 1999

Best regards,
Mike Barcroft

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message