Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ast fails to compile with gcc 15 #27

Open
opoplawski opened this issue Feb 1, 2025 · 2 comments
Open

ast fails to compile with gcc 15 #27

opoplawski opened this issue Feb 1, 2025 · 2 comments

Comments

@opoplawski
Copy link

In Fedora rawhide I'm getting the following build error:

/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  -I/stardev/git/starlink/star/include  -I/usr/include/star  -prefer-pic -DTHREAD_SAFE -DYAML -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -c -o src/libast_la-xmlchan.lo `test -f 'src/xmlchan.c' || echo './'`src/xmlchan.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/stardev/git/starlink/star/include -I/usr/include/star -DTHREAD_SAFE -DYAML -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -c src/xmlchan.c  -fPIC -DPIC -o src/.libs/libast_la-xmlchan.o
src/xmlchan.c: In function 'AttrValueB':
src/xmlchan.c:2428:16: error: expected identifier or '(' before 'true'
 2428 |    const char *true[ 5 ] = { "true", "TRUE", "yes", "YES", "1" };
      |                ^~~~
src/xmlchan.c:2429:16: error: expected identifier or '(' before 'false'
 2429 |    const char *false[ 5 ] = { "false", "FALSE", "no", "NO", "0" };
      |                ^~~~~
src/xmlchan.c:2450:26: error: subscripted value is neither array nor pointer nor vector
 2450 |          if( strstr( true[ i ], value ) == true[ i ] ) {
      |                          ^
src/xmlchan.c:2450:48: error: subscripted value is neither array nor pointer nor vector
 2450 |          if( strstr( true[ i ], value ) == true[ i ] ) {
      |                                                ^
src/xmlchan.c:2460:30: error: subscripted value is neither array nor pointer nor vector
 2460 |             if( strstr( false[ i ], value ) == false[ i ] ) {
      |                              ^
src/xmlchan.c:2460:53: error: subscripted value is neither array nor pointer nor vector
 2460 |             if( strstr( false[ i ], value ) == false[ i ] ) {
      |                                                     ^
make[1]: *** [Makefile:2986: src/libast_la-xmlchan.lo] Error 1

It does seem like naming variables true and false is not a very safe thing to do.

@dsberry
Copy link
Member

dsberry commented Feb 1, 2025

Maybe adding "-std=gnu17" in there is the best solution, to avoid any future backward-imcompatible changes in the default C standard.

@opoplawski
Copy link
Author

That seems to work for now. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants