Fix C23/GCC-14 build breaks in avb_gptp.h and ring_rawsock.c - #939
Open
srneeli wants to merge 2 commits into
Open
Fix C23/GCC-14 build breaks in avb_gptp.h and ring_rawsock.c#939srneeli wants to merge 2 commits into
srneeli wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small portability fixes so OpenAvnu builds with modern toolchains
(GCC 14 / C23 default), verified to still build on older ones.
avb_gptp.h — replace the hand-rolled
typedef enum { false, true } bool;(guarded by
#ifndef false) with#include <stdbool.h>. Under C23,bool/true/falseare keywords, so the old guard no longer suppressedthe typedef and it caused a redefinition error.
ring_rawsock.c —
ppoll()was used without including<poll.h>, whichonly compiled via implicit declaration. GCC 14 makes that a hard error.
Define
_GNU_SOURCEand include<poll.h>.