Skip to content

Enforce C89/gnu89 standard in CI build-only tests#4850

Merged
nanangizz merged 4 commits intomasterfrom
ci/enforce-gnu89-standard
Mar 13, 2026
Merged

Enforce C89/gnu89 standard in CI build-only tests#4850
nanangizz merged 4 commits intomasterfrom
ci/enforce-gnu89-standard

Conversation

@nanangizz
Copy link
Member

@nanangizz nanangizz commented Mar 12, 2026

Summary

  • Add -std=gnu89 -Werror=declaration-after-statement to the default-build CI job on Linux to enforce C89 compliance and catch mixed declarations/code at build time.
  • macOS CI is excluded because third-party webrtc NEON code (aec_core_neon.c) contains C99-style declarations on ARM64 that we cannot modify.
  • Fix all existing C99-style declaration-after-statement violations across the codebase:
    • pjlib/src/pj/os_core_unix.cpj_barrier_wait()
    • pjlib/src/pj/atomic_slist.cpj_atomic_slist_create()
    • pjlib/src/pj/ip_helper_generic.cget_ipv6_deprecated() (multiple)
    • pjlib/src/pjlib-test/atomic_slist.c — test functions
    • pjnath/src/pjturn-client/client_main.c — callback functions
    • pjsip/src/pjsua-lib/pjsua_im.cis_typing_indication()
    • pjsip-apps/src/pjsystest/systest.csystest_play_wav_impl()

Test plan

  • Local build with ./configure CFLAGS="-std=gnu89 -Werror=declaration-after-statement" passes with zero errors and zero warnings
  • CI default-build job passes on Linux
  • macOS CI excluded (third-party webrtc ARM64 NEON code has C99 declarations)

Co-Authored-By: Claude Code

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
@nanangizz nanangizz requested a review from sauwming March 13, 2026 03:01
@nanangizz nanangizz merged commit 3c5c3e8 into master Mar 13, 2026
74 of 76 checks passed
@nanangizz nanangizz deleted the ci/enforce-gnu89-standard branch March 13, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants