tools.c: do not use keywords 'nullptr' as a variable in code

Without the patch:

  tools.c: In function ‘drop_core’:
  tools.c:6251:23: error: expected identifier or ‘(’ before ‘nullptr’
   6251 |         volatile int *nullptr;
        |                       ^~~~~~~
  tools.c:6259:17: error: lvalue required as left operand of assignment
   6259 |         nullptr = NULL;
        |                 ^
  tools.c:6261:21: error: invalid type argument of unary ‘*’ (have ‘typeof (nullptr)’)
   6261 |                 i = *nullptr;
        |                     ^~~~~~~~
  make[6]: *** [Makefile:345: tools.o] Error 1

Note: this was observed on gcc version 15.0.1

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
Lianbo Jiang 2025-01-24 15:32:59 +08:00
parent 772fbb1022
commit 325a9d1b3b

View File

@ -6248,7 +6248,7 @@ lowest_bit_long(ulong val)
void
drop_core(char *s)
{
volatile int *nullptr;
volatile int *ptr;
int i ATTRIBUTE_UNUSED;
if (s && ascii_string(s))
@ -6256,9 +6256,9 @@ drop_core(char *s)
kill((pid_t)pc->program_pid, 3);
nullptr = NULL;
ptr = NULL;
while (TRUE)
i = *nullptr;
i = *ptr;
}