Enforce C89/gnu89 standard in CI build-only tests#4850
Merged
Conversation
Add -std=gnu89 -Werror=declaration-after-statement to the default-build CI jobs (Linux and macOS) to catch C99-style mixed declarations and code. Fix all existing violations in the codebase. Co-Authored-By: Claude Code
Move variable declarations before PJ_UNUSED_ARG() statements in both pj_barrier_wait() implementations (native pthread_barrier and fallback) to comply with -std=gnu89 -Werror=declaration-after-statement. Co-Authored-By: Claude Code
-std=gnu89 leaks into C++ compilation via APP_CXXFLAGS inheriting APP_CFLAGS in build.mak, causing 'invalid argument not allowed with C++' on atomic_queue.cpp. Keep only -Werror=declaration-after-statement on macOS (clang supports it in default C mode). Linux CI still enforces -std=gnu89. Co-Authored-By: Claude Code
The -Werror=declaration-after-statement flag causes build failure on macOS ARM64 because third_party/webrtc aec_core_neon.c has C99-style declarations that we cannot modify. Linux CI still enforces the rule. Co-Authored-By: Claude Code
sauwming
approved these changes
Mar 13, 2026
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.
Summary
-std=gnu89 -Werror=declaration-after-statementto thedefault-buildCI job on Linux to enforce C89 compliance and catch mixed declarations/code at build time.aec_core_neon.c) contains C99-style declarations on ARM64 that we cannot modify.pjlib/src/pj/os_core_unix.c—pj_barrier_wait()pjlib/src/pj/atomic_slist.c—pj_atomic_slist_create()pjlib/src/pj/ip_helper_generic.c—get_ipv6_deprecated()(multiple)pjlib/src/pjlib-test/atomic_slist.c— test functionspjnath/src/pjturn-client/client_main.c— callback functionspjsip/src/pjsua-lib/pjsua_im.c—is_typing_indication()pjsip-apps/src/pjsystest/systest.c—systest_play_wav_impl()Test plan
./configure CFLAGS="-std=gnu89 -Werror=declaration-after-statement"passes with zero errors and zero warningsdefault-buildjob passes on LinuxCo-Authored-By: Claude Code