Page MenuHome GnuPG

libgpg-error: nullptr
Closed, ResolvedPublic

Description

{F16027297}libgpg-error: 1.50
gcc (GCC) 15.0.0 20240509 (experimental)

as of c23 'nullptr' is a reserved word in C https://en.cppreference.com/w/c/language/nullptr

unfortunately some of the tests of libgpg-error use 'nullptr'
so when i compile with $CFLAGS including -std=gnu23 with a gcc that supports c23 libgpg-error fails to compile

t-printf.c: In function ‘check_fprintf_sf’:
t-printf.c:452:18: error: expected identifier or ‘(’ before ‘nullptr’

452 |   volatile char *nullptr = NULL; /* Avoid compiler warning.  */

the fix is simple enough: rename nullptr to something else (i used nullptr1)

attached patch results in a successful compilation/test run.

Details

Version
1.50

Event Timeline

werner added a subscriber: werner.

The C comittee is getting more an more absurd by adding new keywords. Breaking software for fun and funding. Workaround should be easy: Don't use the C23 option.

werner triaged this task as Normal priority.Oct 22 2024, 4:58 PM