Quantcast

[PATCH] AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C

Paul Eggert
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
Also define __STDC_WANT_IEC_60559_BFP_EXT__,
__STDC_WANT_IEC_60559_FUNCS_EXT__, and __STDC_WANT_LIB_EXT2__.
* NEWS, doc/autoconf.texi (Posix Variants):
Document this.  Also, document other changes in this area
that were not properly documented before.
---
 NEWS                     |  5 +++--
 doc/autoconf.texi        | 49 ++++++++++++++++++++++++++++++++++++------------
 lib/autoconf/specific.m4 | 17 ++++++++++++++++-
 3 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/NEWS b/NEWS
index 5f05ad6..43918bb 100644
--- a/NEWS
+++ b/NEWS
@@ -58,8 +58,9 @@ GNU Autoconf NEWS - User visible changes.
   by default it no longer warns about Bison extensions.  Add -Wyacc to
   YFLAGS to enable these warnings.
 
-- AC_USE_SYSTEM_EXTENSIONS now enables more system extensions on HP-UX,
-  MINIX 3, and OS X.
+- AC_USE_SYSTEM_EXTENSIONS now enables more extensions on HP-UX,
+  macOS, and MINIX, as well as on systems conforming to ISO/IEC TR
+  24731-2:2010, ISO/IEC TS 18661-1:2014, and ISO/IEC TS 18661-4:2015.
 
 - AC_CHECK_DECL and AC_CHECK_DECLS can now report missing declarations for
   functions that are also Clang compiler builtins.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index ddbeddf..d3ccf19 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -8588,15 +8588,21 @@ extensions to C, as well as platform extensions not defined by Posix.
 @anchor{AC_USE_SYSTEM_EXTENSIONS}
 @defmac AC_USE_SYSTEM_EXTENSIONS
 @acindex{USE_SYSTEM_EXTENSIONS}
-@cvindex _ALL_SOURCE
 @cvindex _GNU_SOURCE
+@cvindex _ALL_SOURCE
+@cvindex _DARWIN_C_SOURCE
 @cvindex _MINIX
+@cvindex _NETBSD_SOURCE
 @cvindex _POSIX_1_SOURCE
 @cvindex _POSIX_PTHREAD_SEMANTICS
 @cvindex _POSIX_SOURCE
 @cvindex _TANDEM_SOURCE
+@cvindex _XOPEN_SOURCE
 @cvindex __EXTENSIONS__
-This macro was introduced in Autoconf 2.60.  If possible, enable
+@cvindex __STDC_WANT_IEC_60559_BFP_EXT__
+@cvindex __STDC_WANT_IEC_60559_FUNCS_EXT__
+@cvindex __STDC_WANT_LIB_EXT2__
+If possible, enable
 extensions to C or Posix on hosts that normally disable the extensions,
 typically due to standards-conformance namespace issues.  This should be
 called before any macros that run the C compiler.  The following
@@ -8605,22 +8611,41 @@ preprocessor macros are defined where appropriate:
 @table @code
 @item _GNU_SOURCE
 Enable extensions on GNU/Linux.
-@item __EXTENSIONS__
-Enable general extensions on Solaris.
-@item _POSIX_PTHREAD_SEMANTICS
-Enable threading extensions on Solaris.
-@item _TANDEM_SOURCE
-Enable extensions for the HP NonStop platform.
 @item _ALL_SOURCE
 Enable extensions for AIX 3, and for Interix.
-@item _POSIX_SOURCE
-Enable Posix functions for Minix.
-@item _POSIX_1_SOURCE
-Enable additional Posix functions for Minix.
+@item _DARWIN_C_SOURCE
+Enable extensions for macOS.
 @item _MINIX
 Identify Minix platform.  This particular preprocessor macro is
 obsolescent, and may be removed in a future release of Autoconf.
+@item _NETBSD_SOURCE
+Enable NetBSD-related extensions for Minix.
+@item _POSIX_1_SOURCE
+Enable additional Posix functions for Minix.
+@item _POSIX_PTHREAD_SEMANTICS
+Enable threading extensions on Solaris.
+@item _POSIX_SOURCE
+Enable Posix functions for Minix.
+@item _TANDEM_SOURCE
+Enable extensions for the HP NonStop platform.
+@item _XOPEN_SOURCE
+Enable X/Open extensions for HP-UX.
+@item __EXTENSIONS__
+Enable general extensions on Solaris.
+@item __STDC_WANT_IEC_60559_BFP_EXT__
+Enable extensions specified by ISO/IEC TS 18661-1:2014.
+@item __STDC_WANT_IEC_60559_FUNCS_EXT__
+Enable extensions specified by ISO/IEC TS 18661-4:2015.
+@item __STDC_WANT_LIB_EXT2__
+Enable extensions specified by ISO/IEC TR 24731-2:2010.
 @end table
+
+The macro @code{__STDC_WANT_LIB_EXT1__} is not defined, as C11 Annex K
+is problematic.  See: O'Donell C, Sebor M.
+@uref{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm, Field
+Experience With Annex K---Bounds Checking Interfaces}.
+
+This macro was introduced in Autoconf 2.60.
 @end defmac
 
 
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index e665b90..ad77be8 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -387,7 +387,7 @@ dnl configure.ac when using autoheader 2.62.
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
-/* Enable general extensions on OS X.  */
+/* Enable general extensions on macOS.  */
 #ifndef _DARWIN_C_SOURCE
 # undef _DARWIN_C_SOURCE
 #endif
@@ -399,6 +399,18 @@ dnl configure.ac when using autoheader 2.62.
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
+/* Enable extensions specified by ISO/IEC TS 18661-1:2014.  */
+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+# undef __STDC_WANT_IEC_60559_BFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-4:2015.  */
+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TR 24731-2:2010.  */
+#ifndef __STDC_WANT_LIB_EXT2__
+# undef __STDC_WANT_LIB_EXT2__
+#endif
 /* Enable extensions on HP NonStop.  */
 #ifndef _TANDEM_SOURCE
 # undef _TANDEM_SOURCE
@@ -428,6 +440,9 @@ dnl configure.ac when using autoheader 2.62.
   AC_DEFINE([_DARWIN_C_SOURCE])
   AC_DEFINE([_GNU_SOURCE])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+  AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__])
+  AC_DEFINE([__STDC_WANT_LIB_EXT2__])
   AC_DEFINE([_TANDEM_SOURCE])
   AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
     [ac_cv_should_define__xopen_source],
--
2.7.4


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C

Joseph S. Myers
On Tue, 13 Sep 2016, Paul Eggert wrote:

> * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
> Also define __STDC_WANT_IEC_60559_BFP_EXT__,
> __STDC_WANT_IEC_60559_FUNCS_EXT__, and __STDC_WANT_LIB_EXT2__.

Why not __STDC_WANT_IEC_60559_TYPES_EXT__ (which makes GCC 7's <float.h>
declare limits for _FloatN and _FloatNx types; not yet anything in glibc,
until the float128 work is in)?  (There are other feature test macros for
ISO C extensions as well.)

--
Joseph S. Myers
[hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C

Paul Eggert
On 09/14/2016 05:55 AM, Joseph Myers wrote:
> Why not __STDC_WANT_IEC_60559_TYPES_EXT__ (which makes GCC 7's <float.h>
> declare limits for _FloatN and _FloatNx types; not yet anything in glibc,
> until the float128 work is in)?

Sorry, I didn't know about __STDC_WANT_IEC_60559_TYPES_EXT__. I don't
have access to the recent ISO C standards documents, which are not free.

> (There are other feature test macros for
> ISO C extensions as well.)

Thanks, is there a list of these new macros somewhere? I might as well
add them all now.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C

Joseph S. Myers
On Wed, 14 Sep 2016, Paul Eggert wrote:

> > (There are other feature test macros for
> > ISO C extensions as well.)
>
> Thanks, is there a list of these new macros somewhere? I might as well add
> them all now.

ISO 24747 defines __STDC_WANT_MATH_SPEC_FUNCS__ (must be defined to expand
to the integer constant 1).

TR 24732 defines __STDC_WANT_DEC_FP__ (only needs to be defined, expansion
doesn't matter).  This has since been superseded by TS 18661-2, which
defines __STDC_WANT_IEC_60559_DFP_EXT__ instead (again, expansion doesn't
matter).

TS 18661-5 defines __STDC_WANT_IEC_60559_ATTRIBS_EXT__ (expansion doesn't
matter).

TR 18037 does not define any feature test macros.

--
Joseph S. Myers
[hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C

Paul Eggert
Thanks, I installed the attached additional patch to Autoconf master and
plan to propagate this to Gnulib shortly.

0001-AC_USE_SYSTEM_EXTENSIONS-port-to-more-ISO-C-TSes.patch (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C

Joseph S. Myers
On Thu, 15 Sep 2016, Paul Eggert wrote:

> +Enable extensions specified by ISO/IEC TR 24747:2009.

24747 is an International Standard, not a TR.

--
Joseph S. Myers
[hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C

Paul Eggert
On 09/15/2016 11:08 AM, Joseph Myers wrote:
> 24747 is an International Standard, not a TR.

Thanks, fixed with the attached.


0001-AC_USE_SYSTEM_EXTENSIONS-Remove-stray-TR-in-doc.patch (1K) Download Attachment
Loading...