in c23 "true" is a reserved word. There is a test in GPG's tests/asschk.c that uses a local variable "true" for storing the value "1", fiddling around with it, and then eventually returning a boolean value. The following patch simply renames it to 'tr' which allows for compilation under gcc with -std=gnu2x
Description
Description
Details
Details
- Version
- 2.4.5
Revisions and Commits
Revisions and Commits
rG GnuPG | |||
rG6228bb001257 tests: Avoid new C23 keyword true. | |||
rG7728a179e0b7 tests: Avoid new C23 keyword true. | |||
rGf119444e6442 tests: Avoid new C23 keyword true. |
Event Timeline
Comment Actions
--- gnupg-2.4.5/tests/asschk.c 2023-04-04 02:28:39.000000000 -0600 +++ gnupg-2.4.5-c23/tests/asschk.c 2024-04-19 21:21:36.460724329 -0600 @@ -656,13 +656,13 @@ static int eval_boolean (const char *cond) { - int true = 1; + int tr = 1; for ( ; *cond == '!'; cond++) - true = !true; + tr = !tr; if (!*cond || (*cond == '0' && !cond[1])) - return !true; - return true; + return !tr; + return tr; }
Comment Actions
Okay, fix pushed to master, 2.4, and 2.2. Thanks.
Introducing a new keyword into C was a Bad Idea™. Should have been hidden behind a pragma.