Skip to content

Fix C23/GCC-14 build breaks in avb_gptp.h and ring_rawsock.c - #939

Open
srneeli wants to merge 2 commits into
Avnu:masterfrom
srneeli:fix/avb-gptp-stdbool-c23
Open

Fix C23/GCC-14 build breaks in avb_gptp.h and ring_rawsock.c#939
srneeli wants to merge 2 commits into
Avnu:masterfrom
srneeli:fix/avb-gptp-stdbool-c23

Conversation

@srneeli

@srneeli srneeli commented Aug 27, 2026

Copy link
Copy Markdown

Two small portability fixes so OpenAvnu builds with modern toolchains
(GCC 14 / C23 default), verified to still build on older ones.

  1. avb_gptp.h — replace the hand-rolled typedef enum { false, true } bool;
    (guarded by #ifndef false) with #include <stdbool.h>. Under C23,
    bool/true/false are keywords, so the old guard no longer suppressed
    the typedef and it caused a redefinition error.

  2. ring_rawsock.cppoll() was used without including <poll.h>, which
    only compiled via implicit declaration. GCC 14 makes that a hard error.
    Define _GNU_SOURCE and include <poll.h>.

srneeli and others added 2 commits August 27, 2026 15:49
The header defined its own bool type using an enum that was guarded by
an ifndef false check. That check only worked when false came from
stdbool.h as a macro. With newer compilers that default to C23, false
and true and bool are keywords instead of macros, so the guard no longer
did anything and the old typedef clashed with the built in bool. Because
of that the build broke on the newer toolchain.

Remove the hand-written bool type and include stdbool.h instead. This
keeps working on the older compilers and also builds cleanly on the newer
ones, so it fixes the failure without breaking anything that was building
before.

Signed-off-by: Srinivas Neeli <srinivas.neeli@amd.com>
Use of the ppoll function resulted in:
| ../OpenAvnu/lib/avtp_pipeline/platform/Linux/rawsock/ring_rawsock.c:513:27: error: implicit declaration of function 'ppoll'; did you mean 'poll'? [-Wimplicit-function-declaration]
|   513 |                 int ret = ppoll(&pfd, 1, pts, NULL);
|       |                           ^~~~~
|       |                           poll

ppoll is declared in poll.h only when _GNU_SOURCE is defined, so define
_GNU_SOURCE and include poll.h.

Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@amd.com>
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

Successfully merging this pull request may close these issues.

2 participants