Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ANSI C standard of zsh



On 3/28/2024 04:16, Jun T wrote:
2024/03/27 8:16、Clinton Bunch <cdb_zsh@xxxxxxxxxxx>のメール:

If we're going to say Zsh expects C99 we should probably update
autoconf to check for C99 (and set any options needed)

I've attached a patch for the trivial change needed.
in the attached patch:
-AC_PROG_CC
+AC_PROG_CC_C99
We can use AC_PROG_CC_C99 with autoconf-2.69, but in 2.7x
it became obsolete and we need to use AC_PROG_CC, which
tries C11, C99 and C89 (in this order) to find the latest
edition the compiler supports.

So we first need to decide which version of autoconf we
use. Maybe we will continue using 2.69 for the moment?

EL 8 and 9 still ship 2.69, as does Solaris 11

FreeBSD 13.2-RELEASE-p10 has 2.71

The development guide currently says 2.50 or later.

2.71 is copyright 2021. 2.69 is 2012.

I believe in updating versions when they become too limiting, but 3 years isn't what I'd consider limiting.  I don't think we should change to assume 2.71 yet.


Do we need to know that the compiler supports C11 unless we're using C11 features?




The following is info for someone who wants to know
what AC_PROG_CC_C99 will check.
In the comment to the AC_PROG_CC_C99 macro in c.m4
(may be in /usr/share/autoconf/autoconf/ if you have 2.69
installed, or lib/autoconf/ in the autoconf source tree):

# It (AC_PROG_CC_C99) considers the compiler to be in ISO C99
# mode if it handles
# _Bool,
# // comments,
# flexible array members,          # aka incomplete array
# inline,
# long long int,
# mixed code and declarations,
# named initialization of structs, # aka designated initializer
# restrict,
# va_copy,                  # with <stdarg.h> and va_start etc.
# varargs macros,        # macros with variable number of args
# variable declarations in for loops      # for(int i=0; ...)
# variable length arrays

Note that "variable length array" (optional in C11) is
required.
The current development guide specifically mentions support for variable length arrays.

AC_PROG_CC_C99 does not check, for example (not comprehensive):
headers other than <stdarg.h>, i.e., <complex.h>, <stdbool.h>,
    <tgmath.h>, <intypes.h>, etc.
snprintf() (and any other new library functions)
universal character name: \uNNNN, \UNNNNNNNN
compound literal






Messages sorted by: Reverse Date, Date, Thread, Author