From owner-freebsd-standards Wed Sep 11 11: 9: 8 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 42C9537B400; Wed, 11 Sep 2002 11:08:26 -0700 (PDT) Received: from lennier.cc.vt.edu (lennier.cc.vt.edu [198.82.162.213]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F84D43E75; Wed, 11 Sep 2002 11:08:25 -0700 (PDT) (envelope-from mheffner@vt.edu) Received: from dagger.cc.vt.edu (IDENT:mirapoint@dagger-lb.cc.vt.edu [10.1.1.11]) by lennier.cc.vt.edu (8.11.4/8.11.4) with ESMTP id g8BI8OM139151; Wed, 11 Sep 2002 14:08:24 -0400 (EDT) Received: from enterprise.muriel.penguinpowered.com ([199.3.139.42]) by dagger.cc.vt.edu (Mirapoint Messaging Server MOS 3.2.1.6-EA) with ESMTP id AQX00376 (AUTH mheffner); Wed, 11 Sep 2002 14:08:21 -0400 (EDT) Message-ID: X-Mailer: XFMail 1.5.3 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="_=XFMail.1.5.3.FreeBSD:20020911140757:307=_" In-Reply-To: <20020906202133.E47192@espresso.q9media.com> Date: Wed, 11 Sep 2002 14:07:57 -0400 (EDT) From: Mike Heffner To: Mike Barcroft Subject: Re: glob(3) in -STABLE: PR bin/42275 Cc: standards@FreeBSD.org, Garrett Wollman Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.3.FreeBSD:20020911140757:307=_ Content-Type: text/plain; charset=us-ascii On 07-Sep-2002 Mike Barcroft wrote: | Mike Heffner writes: |> I would like to go with this option, as I'm sure the problem will come |> up |> again with different programs. However, the lack of the POSIX |> preprocessor |> conditionals in STABLE was currently preventing me. I would like to |> know |> the opinion of those more involved with POSIX conformance. Will the |> preprocessor conditionals be MFC'd anytime soon? Or should I MFC the |> changes but strip out the conditionals from glob.h? | | All the C99 and POSIX changes to as safe to MFC. Please | feel free to MFC them. | Ok, I've put together the following patch for MFC, can someone confirm whether this is complete and doesn't contain anything that shouldn't be in there? Revisions MFC'd: 1.44-1.47, 1.50, 1.58-1.59 Thanks, Mike P.S. I'm currently putting it through a buildworld to test. -- Mike Heffner --_=XFMail.1.5.3.FreeBSD:20020911140757:307=_ Content-Disposition: attachment; filename="cdefs.diff" Content-Transfer-Encoding: 7bit Content-Description: cdefs.diff Content-Type: text/plain; charset=us-ascii; name=cdefs.diff; SizeOnDisk=5486 Index: cdefs.h =================================================================== RCS file: /home/ncvs/src/sys/sys/cdefs.h,v retrieving revision 1.28.2.7 diff -u -r1.28.2.7 cdefs.h --- cdefs.h 5 Dec 2001 20:49:17 -0000 1.28.2.7 +++ cdefs.h 11 Sep 2002 18:01:49 -0000 @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/sys/cdefs.h,v 1.28.2.7 2001/12/05 20:49:17 obrien Exp $ + * $FreeBSD: src/sys/sys/cdefs.h,v 1.59 2002/07/15 16:44:07 wollman Exp $ */ #ifndef _SYS_CDEFS_H_ @@ -128,6 +128,30 @@ #define __unused __attribute__((__unused__)) #endif +/* XXX: should use `#if __STDC_VERSION__ < 199901'. */ +#if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3) +#define __func__ NULL +#endif + +/* XXX: should use `#if __STDC_VERSION__ >= 199901'. */ +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#define __LONG_LONG_SUPPORTED +#endif + +/* + * GCC 2.95 provides `__restrict' as an extention to C90 to support the + * C99-specific `restrict' type qualifier. We happen to use `__restrict' as a + * way to define the `restrict' type qualifier without disturbing older softwar e + * that is unaware of C99 keywords. + */ +#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) +#if __STDC_VERSION__ < 199901 +#define __restrict +#else +#define __restrict restrict +#endif +#endif + /* * Compiler-dependent macros to declare that functions take printf-like * or scanf-like arguments. They are null except for versions of gcc @@ -206,7 +230,7 @@ * Embed the rcs id of a source file in the resulting library. Note that in * more recent ELF binutils, we use .ident allowing the ID to be stripped. * Usage: - * __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.28.2.7 2001/12/05 20:49:17 obrie n Exp $"); + * __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.59 2002/07/15 16:44:07 wollman E xp $"); */ #ifndef __FBSDID #if !defined(lint) && !defined(STRIP_FBSDID) @@ -222,6 +246,106 @@ #ifndef __COPYRIGHT #define __COPYRIGHT(s) __IDSTRING(copyright,s) +#endif + +/*- + * The following definitions are an extension of the behavior originally + * implemented in , but with a different level of granularity. + * POSIX.1 requires that the macros we test be defined before any standard + * header file is included. + * + * Here's a quick run-down of the versions: + * defined(_POSIX_SOURCE) 1003.1-1988 + * _POSIX_C_SOURCE == 1 1003.1-1990 + * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option + * _POSIX_C_SOURCE == 199309 1003.1b-1993 + * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, + * and the omnibus ISO/IEC 9945-1: 1996 + * _POSIX_C_SOURCE == 200112 1003.1-2001 + * + * In addition, the X/Open Portability Guide, which is now the Single UNIX + * Specification, defines a feature-test macro which indicates the version of + * that specification, and which subsumes _POSIX_C_SOURCE. + * + * Our macros begin with two underscores to avoid namespace screwage. + */ + +/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ +#if _POSIX_C_SOURCE == 1 +#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ +#define _POSIX_C_SOURCE 199009 +#endif + +/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ +#if _POSIX_C_SOURCE == 2 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 199209 +#endif + +/* Deal with various X/Open Portability Guides and Single UNIX Spec. */ +#ifdef _XOPEN_SOURCE +#if _XOPEN_SOURCE >= 600 +#define __XSI_VISIBLE 600 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200112 +#elif _XOPEN_SOURCE >= 500 +#define __XSI_VISIBLE 500 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 199506 +#endif +#endif + +/* + * Deal with all versions of POSIX. The ordering relative to the tests above i s + * important. + */ +#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) +#define _POSIX_C_SOURCE 198808 +#endif +#ifdef _POSIX_C_SOURCE +#if _POSIX_C_SOURCE >= 200112 +#define __POSIX_VISIBLE 200112 +#define __ISO_C_VISIBLE 1999 +#elif _POSIX_C_SOURCE >= 199506 +#define __POSIX_VISIBLE 199506 +#define __ISO_C_VISIBLE 1990 +#elif _POSIX_C_SOURCE >= 199309 +#define __POSIX_VISIBLE 199309 +#define __ISO_C_VISIBLE 1990 +#elif _POSIX_C_SOURCE >= 199209 +#define __POSIX_VISIBLE 199209 +#define __ISO_C_VISIBLE 1990 +#elif _POSIX_C_SOURCE >= 199009 +#define __POSIX_VISIBLE 199009 +#define __ISO_C_VISIBLE 1990 +#else +#define __POSIX_VISIBLE 198808 +#define __ISO_C_VISIBLE 0 +#endif /* _POSIX_C_SOURCE */ +#else +/*- + * Deal with _ANSI_SOURCE: + * If it is defined, and no other compilation environment is explicitly + * requested, then define our internal feature-test macros to zero. This + * makes no difference to the preprocessor (undefined symbols in preprocessing + * expressions are defined to have value zero), but makes it more convenient fo r + * a test program to print out the values. + * + * If a program mistakenly defines _ANSI_SOURCE and some other macro such as + * _POSIX_C_SOURCE, we will assume that it wants the broader compilation + * environment (and in fact we will never get here). + */ +#ifdef _ANSI_SOURCE /* Hide almost everything. */ +#define __POSIX_VISIBLE 0 +#define __XSI_VISIBLE 0 +#define __BSD_VISIBLE 0 +#define __ISO_C_VISIBLE 1990 +#else /* Default environment: show everything. */ +#define __POSIX_VISIBLE 200112 +#define __XSI_VISIBLE 600 +#define __BSD_VISIBLE 1 +#define __ISO_C_VISIBLE 1999 +#endif #endif #endif /* !_SYS_CDEFS_H_ */ --_=XFMail.1.5.3.FreeBSD:20020911140757:307=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message