| 1 |
Description: nullptr is a reserved word in C23. Use mynullptr instead. |
| 2 |
Author: Agustin Martin Domingo <[email protected]> |
| 3 |
Forwarded: https://sourceforge.net/p/regina-rexx/bugs/612/ |
| 4 |
Bug-Debian: http://bugs.debian.org/1097785 |
| 5 |
|
| 6 |
C23 error message: |
| 7 |
--- |
| 8 |
x86_64-linux-gnu-gcc ... ./variable.c |
| 9 |
./variable.c: In function ‘assign_foliage’: |
| 10 |
./variable.c:1497:12: error: expected identifier or ‘(’ before ‘nullptr’ |
| 11 |
1497 | streng *nullptr = NULL; /* allow REPLACE_VALUE macro to pass NULL value under C++ */ |
| 12 |
| ^~~~~~~ |
| 13 |
make[1]: *** [Makefile:423: variable.o] Error 1 |
| 14 |
--- |
| 15 |
|
| 16 |
Seems that nullptr has become a reserved word in C23. |
| 17 |
Renaming internal nullptr to something else should |
| 18 |
fix this. This patch uses mynullptr. |
| 19 |
|
| 20 |
--- a/variable.c |
| 21 |
+++ b/variable.c |
| 22 |
@@ -1494,7 +1494,7 @@ static void assign_foliage( const tsd_t |
| 23 |
unsigned i; |
| 24 |
streng *copy; |
| 25 |
variableptr ptr, tptr, *queue, real; |
| 26 |
- streng *nullptr = NULL; /* allow REPLACE_VALUE macro to pass NULL value under C++ */ |
| 27 |
+ streng *mynullptr = NULL; /* allow REPLACE_VALUE macro to pass NULL value under C++ */ |
| 28 |
|
| 29 |
DPRINTF((TSD,"assign_foliage: ?")); |
| 30 |
|
| 31 |
@@ -1532,7 +1532,7 @@ static void assign_foliage( const tsd_t |
| 32 |
} |
| 33 |
else if ( real->value ) |
| 34 |
{ |
| 35 |
- REPLACE_VALUE( nullptr, real ); |
| 36 |
+ REPLACE_VALUE( mynullptr, real ); |
| 37 |
DSTART;DPRINT((TSD," "));DVAR(TSD,"real(now)",real);DEND; |
| 38 |
} |
| 39 |
|
| 40 |
--- a/yaccsrc.y |
| 41 |
+++ b/yaccsrc.y |
| 42 |
@@ -66,7 +66,7 @@ static int parendepth; |
| 43 |
|
| 44 |
static nodeptr current, with = NULL; |
| 45 |
|
| 46 |
-static char *nullptr = NULL; /* for C++ compilation */ |
| 47 |
+static char *mynullptr = NULL; /* for C++ compilation */ |
| 48 |
|
| 49 |
typedef enum { IS_UNKNOWN, |
| 50 |
IS_A_NUMBER, |
| 51 |
@@ -1285,9 +1285,9 @@ expr : '(' { |
| 52 |
| STRING { $$ = makenode( X_STRING, 0 ); |
| 53 |
$$->name = Str_cre_TSD(parser_data.TSD,retvalue) ; } |
| 54 |
| function { $$ = $1 ; } |
| 55 |
- | '+' expr %prec UPLUS { AUTO_REDUCE( $2, nullptr ); |
| 56 |
+ | '+' expr %prec UPLUS { AUTO_REDUCE( $2, mynullptr ); |
| 57 |
$$ = makenode( X_U_PLUSS, 1, $2 ); } |
| 58 |
- | '-' expr %prec UMINUS { AUTO_REDUCE( $2, nullptr ); |
| 59 |
+ | '-' expr %prec UMINUS { AUTO_REDUCE( $2, mynullptr ); |
| 60 |
$$ = makenode( X_U_MINUS, 1, $2 ); } |
| 61 |
| '+' error { exiterror( ERR_INVALID_EXPRESSION, 1, __reginatext ); } /* fixes bug 1107760 */ |
| 62 |
| '-' error { exiterror( ERR_INVALID_EXPRESSION, 1, __reginatext ); } /* fixes bug 1107760 */ |
| 63 |
--- a/yaccsrc.c |
| 64 |
+++ b/yaccsrc.c |
| 65 |
@@ -139,7 +139,7 @@ static int parendepth; |
| 66 |
|
| 67 |
static nodeptr current, with = NULL; |
| 68 |
|
| 69 |
-static char *nullptr = NULL; /* for C++ compilation */ |
| 70 |
+static char *mynullptr = NULL; /* for C++ compilation */ |
| 71 |
|
| 72 |
typedef enum { IS_UNKNOWN, |
| 73 |
IS_A_NUMBER, |
| 74 |
@@ -199,7 +199,7 @@ static void move_labels( nodeptr front, |
| 75 |
|
| 76 |
# ifndef YY_NULLPTR |
| 77 |
# if defined __cplusplus && 201103L <= __cplusplus |
| 78 |
-# define YY_NULLPTR nullptr |
| 79 |
+# define YY_NULLPTR mynullptr |
| 80 |
# else |
| 81 |
# define YY_NULLPTR 0 |
| 82 |
# endif |
| 83 |
@@ -4941,14 +4941,14 @@ yyreduce: |
| 84 |
|
| 85 |
case 434: |
| 86 |
#line 1288 "../yaccsrc.y" /* yacc.c:1646 */ |
| 87 |
- { AUTO_REDUCE( (yyvsp[0]), nullptr ); |
| 88 |
+ { AUTO_REDUCE( (yyvsp[0]), mynullptr ); |
| 89 |
(yyval) = makenode( X_U_PLUSS, 1, (yyvsp[0]) ); } |
| 90 |
#line 4947 "../yaccsrc.c" /* yacc.c:1646 */ |
| 91 |
break; |
| 92 |
|
| 93 |
case 435: |
| 94 |
#line 1290 "../yaccsrc.y" /* yacc.c:1646 */ |
| 95 |
- { AUTO_REDUCE( (yyvsp[0]), nullptr ); |
| 96 |
+ { AUTO_REDUCE( (yyvsp[0]), mynullptr ); |
| 97 |
(yyval) = makenode( X_U_MINUS, 1, (yyvsp[0]) ); } |
| 98 |
#line 4954 "../yaccsrc.c" /* yacc.c:1646 */ |
| 99 |
break; |