[ATTN] GCC and make Maintainers: SUS V5 POSIX 2024 make CC default c17
Brian Inglis
Brian.Inglis@SystematicSW.ab.ca
Mon Nov 2 00:21:48 GMT 2026
On 2026-11-01 11:08, ASSI via Cygwin-apps wrote:
> ASSI via Cygwin-apps writes:
>> I'll add the c17 wrapper with the same semantics as the existing ones
>> (i.e. strict compliance, which is useless for just about all sources)
>> for the next update.
>
> That'll be the new .ccwrapper going forward for Cygwin:
>
> --8<---------------cut here---------------start------------->8---
> #!/bin/dash
> error () {
> echo "$std called with non ISO ${STD} option '$1'" >&2
> exit 1
> }
> std="$(basename $0)"
> STD=$(printf "%s" "$std" | tr [:lower:] [:upper:])
> flg="-std=$std"
> iso="_unknown_"
> case "$std" in
> c89) iso="iso9899:1990";;
> c94) iso="iso9899:199409";;
> c95) iso="iso9899:199409";;
> c99) iso="iso9899:1999";;
> c11) iso="iso9899:2011";;
> c17) iso="iso9899:2017";;
> c23) iso="iso9899:2024";;
> esac
> [ "_unknown_" = "$iso" ] && error "$iso"
> for opt; do
> case "$opt" in
> -ansi) [ "c89" = "$std" ] && unset flg || error "$opt";;
> -std="$std"|-std="$iso") unset flg;;
> -std=*) error "$opt"
> esac
> done
> exec /usr/bin/gcc ${flg+"$flg" }${1+"$@"}
> --8<---------------cut here---------------end--------------->8---
>
> Put it in /bin and link c17 to it (the existing c89 and c99 scripts will
> become links as well, I'm not going to provide the other wrappers that
> are possible based on GCC documentation, but not required by any
> standard I know of.
Thanks Achim,
I installed that script as gcc-stdcwrap and symlinked it to the names of options
not already supported by existing scripts c{8,9}9.
In the latter two scripts, I noticed an issue in the error messages, where
'cygport' is used instead of the script name, ${0##*/}, or ${fl#-std=}:
$ grep cygport /bin/c[89]9
/bin/c89: -std=*) echo "cygport called with non ANSI/ISO C option $opt" >&2
/bin/c99: -std=*) echo "cygport called with non ISO C99 option $opt" >&2
which you could perhaps also fix in future gcc releases?
Cheers!
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut
-- Antoine de Saint-Exupéry
More information about the Cygwin-apps
mailing list