Skip to content

fails to build with GCC 15 (-std=gnu23) #199

@anbe42

Description

@anbe42

GCC 15 switched the default from -std=gnu17 to -std=gnu23 which causes a build failure (flags from the Debian package build):

cc -Wdate-time -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -flto=auto -ffat-lto-objects -fstack-protector-strong -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/rapiddisk-9.2.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wall -pedantic -c main.c -o main_ndebug.o
In file included from utils.h:35,
                 from main.c:34:
common.h:61:14: error: 'bool' cannot be defined via 'typedef'
   61 | typedef char bool;
      |              ^~~~
common.h:61:14: note: 'bool' is a keyword with '-std=c23' onwards
common.h:61:1: warning: useless type name in empty declaration
   61 | typedef char bool;
      | ^~~~~~~
common.h:223:37: warning: extra semicolon in struct or union specified [-Wpedantic]
  223 | typedef struct NVMET_ALLOWED_HOST { ;
      |                                     ^
      |                                     -
make[1]: *** [Makefile:142: main_ndebug.o] Error 1

You should be able to wrap the typedef etc. in

#if __STDC_VERSION__ < 202311L
...
#endif

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions