Skip to content

build: enforce C11 as minimum compiler standard - #617

Open
hugo-hur wants to merge 1 commit into
LinearTapeFileSystem:mainfrom
hugo-hur:enforce-c11-build
Open

build: enforce C11 as minimum compiler standard#617
hugo-hur wants to merge 1 commit into
LinearTapeFileSystem:mainfrom
hugo-hur:enforce-c11-build

Conversation

@hugo-hur

@hugo-hur hugo-hur commented Jun 14, 2026

Copy link
Copy Markdown

Replace obsolete AC_PROG_CC_C99 with AC_PROG_CC (which auto-selects the newest available standard: C17 on GCC 8+, C11 on GCC 4.9-7) and add an AC_COMPILE_IFELSE gate that aborts configure if STDC_VERSION < 201112L.

Description

Makes C11 or newer a hard build requirement in line with the project coding guidelines ("C11 recommended, C99 acceptable") and enables use of _Static_assert, _Noreturn, and inline functions without preprocessor guards.

Type of change

  • This change might need a documentation update (the C11 compiler is actually a requirement now)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have confirmed my fix is effective or that my feature works

Replace obsolete AC_PROG_CC_C99 with AC_PROG_CC (which auto-selects the
newest available standard: C17 on GCC 8+, C11 on GCC 4.9-7) and add an
AC_COMPILE_IFELSE gate that aborts configure if __STDC_VERSION__ < 201112L.
Makes C11 or newer a hard build requirement in line with the project coding
guidelines ("C11 recommended, C99 acceptable") and enables use of _Static_assert,
_Noreturn, and inline functions without preprocessor guards.
@vandelvan
vandelvan requested review from XV02, madjesc and syaoraang June 15, 2026 15:20
@YaoFei509

Copy link
Copy Markdown

works on Ubuntu 26.04

@XV02 XV02 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this change. First of all a discussion should be opened about making C11 the minimum compiler standard, that hasn't been discussed yet so please open an Issue first with this topic so other contributors can be part of said decision.

Also, even if the community decides to continue with the standard change, there's a comment for this change.

Comment thread configure.ac
Comment on lines +50 to +61
dnl
dnl Check that compiler supports C11 or newer standard
dnl
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
# error C11 or newer required
#endif
]])],
[],
[AC_MSG_ERROR([C11 or newer compiler required (GCC >= 4.9, Clang >= 3.3)])]
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AC_PROG_CC_C99 checks and sets -std flag to use C99 version. So we should reproduce that functionality, this code snippet just checks the default version of C used, doesn't actually probe if the compiler is capable of using C11 standard, and also doesn't set the required flag. I'm aware the flag AC_PROG_CC_C11 exists but this breaks compilation on certain systems. Another approach for actually probing capability and setting the flag should be used.

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.

3 participants