Skip to content

Conversation

@JamieMagee
Copy link
Contributor

@JamieMagee JamieMagee commented Jul 2, 2025

GCC changed the default C standard from gnu17 to gnu23 in GCC 151

C23 by default: GCC 15 changes the default language version for C compilation from -std=gnu17 to -std=gnu23. If your code relies on older versions of the C standard, you will need to either add -std= to your build flags, or port your code; see the porting notes.

This started causing errors when compiling libgpg-error

t-printf.c:452:18: error: expected identifier or ‘(’ before ‘nullptr’
  452 |   volatile char *nullptr = NULL; /* Avoid compiler warning.  */
      |                  ^~~~~~~

nullptr is a reserved constant in C232, so the compilation fails.

This change explicitly adds -std=c99 to CFLAGS when compiling libgpg-error to avoid this issue.

This issue was also fixed upstream by renaming nullptr to null_ptr3 and released in libgpg-error 1.51.

Closes #199

Footnotes

  1. https://gcc.gnu.org/gcc-15/changes.html#c

  2. https://en.cppreference.com/w/c/language/nullptr.html

  3. https://github.com/gpg/libgpg-error/commit/d14c69a7f256a9444c5c64b808d8767e5a8ba68e

'--enable-static',
'--disable-nls',
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
"CFLAGS=-fPIC -std=c99 #{ENV["CFLAGS"]}",
Copy link
Owner

Choose a reason for hiding this comment

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

The bundled libgpg-error is a bit outdated (the latest is 1.55). Perhaps bumping it would make this unnecessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I created #201 which also solves the issue. If you merge that, I'll close this.

@JamieMagee
Copy link
Contributor Author

Closing as this was resolved in #201

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.

Fails to compile with GCC 15

2 participants