Re: How can Autoconf help with the transition to stricter compilation defaults?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022-11-12 06:09, Zack Weinberg wrote:

-  and ‘false’ work anyway.  This is for compatibility with C 2023 and
+  and ‘false’ work anyway.  This is for compatibility with C23 and

Why are you changing four-digit years to two-digit years?
Formerly the Autoconf documentation was inconsistent. In the rest of the world people typically write "C89", "C99", "C11", "C17" and "C23" so I went with that even though (as you suggest) it will be problematic after the year 2088, assuming C is still being standardized after that. I'd be happy to change them to "C1989" etc. if preferred. I don't want to use the official names; for example, the official name for C17 is "ISO/IEC 9899:2018" which is far too long, and it doesn't say "C", and it uses the "wrong" year number.


  All other headers, including all headers
  from later revisions of the C standard, need to be tested for
+if your program is intended to be portable to C89
  (@pxref{Header Files}).

I don’t understand what this addition is supposed to mean.  Not all
“modern” systems supply all of the C99 headers, even now.

The intent was that if you don't care about C89 any more (which many people don't), you needn't worry about checking for headers like <stdbool.h> that C99 requires even for freestanding compilers.

Perhaps something like the attached patch?



-The C standard says a call @code{malloc (0)} is implementation
+The C standard says a successful call @code{malloc (0)} is implementation
  dependent.  It can return either @code{NULL} or a new non-null pointer.

Style nit: how can a _call_ be implementation dependent?  Suggest
something like “The C standard says that _the result of_ a successful
call _to_ @code{malloc (0)} is implementation dependent.” (underscores
just to mark additions, not part of suggested text)

That's wordy, and similar wording is repeated elsewhere. How about changing it from "a call malloc (0)" to simply "malloc (0)", and similarly elsewhere? The shorter string is pretty clear in context.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 7ae8ca64..2d184450 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -4050,9 +4050,11 @@ provide all of the headers specified in C89 (as amended in 1995):
 @file{setjmp.h}, @file{signal.h}, @file{stdarg.h}, @file{stddef.h},
 @file{stdio.h}, @file{stdlib.h}, @file{string.h}, @file{time.h},
 @file{wchar.h}, and @file{wctype.h}.  Most programs can safely include
-these headers unconditionally.  All other headers, including all headers
-from later revisions of the C standard, need to be tested for
-if your program is intended to be portable to C89
+these headers unconditionally.  A program not intended to be portable to
+C89 can also safely include the C99-specified headers @file{complex.h},
+@file{fenv.h}, @file{inttypes.h}, @file{stdbool.h}, @file{stdint.h}, and
+@file{tgmath.h}.  All other headers, including all headers
+from later revisions of the C standard, likely need to be tested for
 (@pxref{Header Files}).
 
 If your program needs to be portable to a @emph{freestanding}

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux