Skip to content

Compile with latest C standard#621

Merged
jgm merged 2 commits into
commonmark:masterfrom
nwellnhof:compile-with-latest-c-standard
Jun 10, 2026
Merged

Compile with latest C standard#621
jgm merged 2 commits into
commonmark:masterfrom
nwellnhof:compile-with-latest-c-standard

Conversation

@nwellnhof

Copy link
Copy Markdown
Contributor

The idea is to catch incompatibilites with newer C standards as early as possible.

nwellnhof added 2 commits June 9, 2026 15:08
C23 made bsearch a const-preserving type-generic macro.
Use latest C standard known to CMake. Remove CMAKE_C_STANDARD_REQUIRED
to fall back to earlier versions.

AFAIK, there's no way to set the minimum required version. But since we
support C99 and it's unlikely that CMake supports C89-only compilers,
this shouldn't be a problem.
@nwellnhof

Copy link
Copy Markdown
Contributor Author

Enabling C11 or later causes clang-tidy warnings, suggesting to use C11 Annex K functions like memcpy_s. These checks should be disabled, but I have no idea where the set of clang-tidy checks is defined in the first place. Running make lint locally results in Error: no checks enabled which is expected without the -checks option or a .clang-tidy file. It seems that under Github CI, all clang-analyzer-security checks are enabled by default. But I have no idea why.

@nwellnhof

Copy link
Copy Markdown
Contributor Author

The clang-analyzer-* checks were removed from the default checks in clang 22, see

I'll prepare another PR to address this.

@jgm jgm merged commit 4f6359e into commonmark:master Jun 10, 2026
14 of 15 checks passed
@nwellnhof nwellnhof deleted the compile-with-latest-c-standard branch June 10, 2026 09:31
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