Bug 2336047 - aubit4gl fails to compile with GCC 15 / C23 ("json.c:435:6: error: conflicting types for 'json_validate'; have 'int(const char *)'")
Summary: aubit4gl fails to compile with GCC 15 / C23 ("json.c:435:6: error: conflictin...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: aubit4gl
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Stansoft
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: gcc-15-mass-prebuild
TreeView+ depends on / blocked
 
Reported: 2025-01-06 23:07 UTC by Dave Malcolm
Modified: 2025-01-17 13:13 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-01-17 13:13:47 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Dave Malcolm 2025-01-06 23:07:39 UTC
I'm experimentally rebuilding rawhide with the not-yet-released GCC 15 to see if anything breaks, and to help write the porting guide.  See https://fedoraproject.org/wiki/User:Dmalcolm/gcc-15

My test build with GCC 15 failed:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed/build/8476105/

whereas my test build with GCC 14 succeeded:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed.checker/build/8477675/

Looking at the failure logs e.g.
https://download.copr.fedorainfracloud.org/results/dmalcolm/gcc-15-smoketest-3.failed/fedora-rawhide-x86_64/08476105-aubit4gl/builder-live.log.gz
I see:

json.c:435:6: error: conflicting types for ‘json_validate’; have ‘int(const char *)’
  435 | bool json_validate(const char *json)
      |      ^~~~~~~~~~~~~
In file included from json.c:24:
/builddir/build/BUILD/aubit4gl-1.6.1.p4-build/aubit4glsrc/incl/json.h:77:13: note: previous declaration of ‘json_validate’ with type ‘_Bool(const char *)’
   77 | bool        json_validate       (const char *json);
      |             ^~~~~~~~~~~~~


This is probably due to GCC 15 now defaulting to -std=gnu23, whereas GCC 14 defaulted to -std=gnu17, and C23 is both (a) stricter about function prototypes than C17 and (b) "bool" is a keyword; I'm not quite sure which is the issue here; sorry; looks like "bool" is "_Bool" in one place and "int" in another, if I'm reading the error correctly.


Reproducible: Always

Comment 1 Stansoft 2025-01-09 21:05:40 UTC
The error is with function json_validate, which is only found in header aubit4glsrc/incl/a4gl_libaubit4gl.h and aubit4glsrc/lib/libaubit4gl/json.c source file. I can make a change to the source, what change do you think is needed to fix this?

Comment 2 Jakub Jelinek 2025-01-10 12:59:34 UTC
E.g. compilers/xgen/main.c
  fprintf(hsf,"#ifndef bool\n");
  fprintf (hsf, "#define bool int\n");
  fprintf(hsf,"#endif\n");
is not correct for C23, in C23 bool is a keyword, not a macro, and shouldn't be redefined.
You could perhaps use
  fprintf(hsf,"#if !defined(bool) && __STDC_VERSION__ < 202311L\n");
instead of the first line.
Ditto compilers/xgen_new/dump.c.
lib/extra_libs/infx_dump_screen/fgl_prtscr.c
then has
#define bool char
instead.

Comment 3 Stansoft 2025-01-10 18:47:39 UTC
The code changes have been made upstream. Does it compile using this source rpm now with GCC 15?

https://download.copr.fedorainfracloud.org/results/stansoft/aubit4gl/fedora-rawhide-x86_64/08499618-aubit4gl/aubit4gl-1.6.1.p5-1.fc42.src.rpm

Comment 4 Jakub Jelinek 2025-01-11 10:54:39 UTC
You can try yourself...
fedpkg build --scratch --target=f42-build-side-103300

Comment 5 Stansoft 2025-01-11 14:17:05 UTC
It builds successfully with GCC 15 using: fedpkg build --scratch --target=f42-build-side-103300

Comment 6 Siddhesh Poyarekar 2025-01-17 13:13:47 UTC
This passed the mass rebuild:

https://koji.fedoraproject.org/koji/buildinfo?buildID=2617358


Note You need to log in before you can comment on or make changes to this bug.