forked from pool/gap-fplsa
68 lines
1.7 KiB
Diff
68 lines
1.7 KiB
Diff
From 9f93c5bd460007141969c395c492e27bf027342f Mon Sep 17 00:00:00 2001
|
||
From: Jan Engelhardt <jengelh@inai.de>
|
||
Date: Wed, 18 Jun 2025 20:24:08 +0200
|
||
Subject: [PATCH] Avoid use of reserved C99 keyword "bool" as a variable name
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
References: https://github.com/gap-packages/FPLSA/pull/13
|
||
|
||
gcc15 comes with -std=c23 by default. The C99 bool keyword is still
|
||
in effect. C23 has only deprecated it, not removed it.
|
||
|
||
gcc-15 output:
|
||
|
||
```
|
||
src/fplsa4.c: In function ‘ReadBooleanFromFile’:
|
||
src/fplsa4.c:7013:7: error: ‘bool’ cannot be used here
|
||
7013 | int bool;
|
||
src/fplsa4.c:7013:7: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
|
||
src/fplsa4.c:7013:3: warning: useless type name in empty declaration
|
||
7013 | int bool;
|
||
```
|
||
|
||
gcc-14 output:
|
||
|
||
```
|
||
src/fplsa4.c: In function ‘ReadBooleanFromFile’:
|
||
src/fplsa4.c:7027:10: warning: ‘bool’ may be used uninitialized [-Wmaybe-uninitialized]
|
||
7027 | return bool;
|
||
```
|
||
---
|
||
src/fplsa4.c | 8 ++++----
|
||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||
|
||
diff --git a/src/fplsa4.c b/src/fplsa4.c
|
||
index 4b5e7d6..e541059 100644
|
||
--- a/src/fplsa4.c
|
||
+++ b/src/fplsa4.c
|
||
@@ -7010,21 +7010,21 @@ void ReadAndProcessStringsFromFile(void (*proc_func)(char *str), FILE *inf,
|
||
int ReadBooleanFromFile(FILE *file)
|
||
{
|
||
short c;
|
||
- int bool;
|
||
+ int b = NO;
|
||
c = fgetc(file);
|
||
switch(c)
|
||
{
|
||
case 'Y': case 'y':
|
||
- bool = YES;
|
||
+ b = YES;
|
||
break;
|
||
case 'N': case 'n':
|
||
- bool = NO;
|
||
+ b = NO;
|
||
break;
|
||
}
|
||
while(!isspace(c = fgetc(file)) && c != EOF)
|
||
;
|
||
ungetc(c, file);
|
||
- return bool;
|
||
+ return b;
|
||
}
|
||
/*=ReadCaseFromFile=====================================
|
||
*/
|
||
--
|
||
2.49.0
|
||
|