From: Tom de Vries Date: Mon, 17 Nov 2025 16:33:03 +0000 (+0100) Subject: [gdb] Use nullptr instead of NULL in producer.[ch] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efa10c9cd5f86b3c57f24896de08a59988d84ce7;p=thirdparty%2Fbinutils-gdb.git [gdb] Use nullptr instead of NULL in producer.[ch] Replace the uses of NULL in gdb/producer.[ch] by nullptr. Tested on x86_64-linux. Approved-By: Simon Marchi --- diff --git a/gdb/producer.c b/gdb/producer.c index 91c2d1c2ca3..baac115c587 100644 --- a/gdb/producer.c +++ b/gdb/producer.c @@ -44,13 +44,13 @@ producer_is_gcc (const char *producer, int *major, int *minor) { const char *cs; - if (producer != NULL && startswith (producer, "GNU ")) + if (producer != nullptr && startswith (producer, "GNU ")) { int maj, min; - if (major == NULL) + if (major == nullptr) major = &maj; - if (minor == NULL) + if (minor == nullptr) minor = &min; /* Skip GNU. */ @@ -167,8 +167,9 @@ producer_is_icc (const char *producer, int *major, int *minor) bool producer_is_llvm (const char *producer) { - return ((producer != NULL) && (startswith (producer, "clang ") - || startswith (producer, " F90 Flang "))); + return ((producer != nullptr) + && (startswith (producer, "clang ") + || startswith (producer, " F90 Flang "))); } /* See producer.h. */ @@ -209,7 +210,7 @@ producer_is_realview (const char *producer) "ARM C/C++ Compiler, RVCT" }; - if (producer == NULL) + if (producer == nullptr) return false; for (const char *ident : arm_idents) @@ -283,7 +284,7 @@ Version 18.0 Beta"; { static const char gnu[] = "GNU C 4.7.2"; - SELF_CHECK (!producer_is_icc (gnu, NULL, NULL)); + SELF_CHECK (!producer_is_icc (gnu, nullptr, nullptr)); int major = 0, minor = 0; SELF_CHECK (producer_is_gcc (gnu, &major, &minor) @@ -293,7 +294,7 @@ Version 18.0 Beta"; { static const char gnu_exp[] = "GNU C++14 5.0.0 20150123 (experimental)"; int major = 0, minor = 0; - SELF_CHECK (!producer_is_icc (gnu_exp, NULL, NULL)); + SELF_CHECK (!producer_is_icc (gnu_exp, nullptr, nullptr)); SELF_CHECK (producer_is_gcc (gnu_exp, &major, &minor) && major == 5 && minor == 0); } @@ -301,7 +302,7 @@ Version 18.0 Beta"; { static const char clang_llvm_exp[] = "clang version 12.0.0 (CLANG: bld#8)"; int major = 0, minor = 0; - SELF_CHECK (!producer_is_icc (clang_llvm_exp, NULL, NULL)); + SELF_CHECK (!producer_is_icc (clang_llvm_exp, nullptr, nullptr)); SELF_CHECK (!producer_is_gcc (clang_llvm_exp, &major, &minor)); SELF_CHECK (producer_is_llvm (clang_llvm_exp)); } @@ -309,7 +310,7 @@ Version 18.0 Beta"; { static const char flang_llvm_exp[] = " F90 Flang - 1.5 2017-05-01"; int major = 0, minor = 0; - SELF_CHECK (!producer_is_icc (flang_llvm_exp, NULL, NULL)); + SELF_CHECK (!producer_is_icc (flang_llvm_exp, nullptr, nullptr)); SELF_CHECK (!producer_is_gcc (flang_llvm_exp, &major, &minor)); SELF_CHECK (producer_is_llvm (flang_llvm_exp)); } diff --git a/gdb/producer.h b/gdb/producer.h index 5ae90350caa..21201cd206d 100644 --- a/gdb/producer.h +++ b/gdb/producer.h @@ -26,20 +26,20 @@ extern int producer_is_gcc_ge_4 (const char *producer); /* Return true if the given PRODUCER string is GCC and sets the MAJOR - and MINOR versions when not NULL. Return false if the given PRODUCER - is NULL or it isn't GCC. */ + and MINOR versions when not nullptr. Return false if the given PRODUCER + is nullptr or it isn't GCC. */ extern bool producer_is_gcc (const char *producer, int *major, int *minor); /* Return true if the given PRODUCER string is GAS and sets the MAJOR - and MINOR versions when not NULL. Returns false if the given PRODUCER - is NULL or it isn't GAS. */ + and MINOR versions when not nullptr. Returns false if the given PRODUCER + is nullptr or it isn't GAS. */ bool producer_is_gas (const char *producer, int *major, int *minor); /* Check for Intel compilers >= 19.0. */ extern bool producer_is_icc_ge_19 (const char *producer); /* Returns true if the given PRODUCER string is Intel or false - otherwise. Sets the MAJOR and MINOR versions when not NULL. */ + otherwise. Sets the MAJOR and MINOR versions when not nullptr. */ extern bool producer_is_icc (const char *producer, int *major, int *minor); /* Returns true if the given PRODUCER string is LLVM (clang/flang) or @@ -47,7 +47,7 @@ extern bool producer_is_icc (const char *producer, int *major, int *minor); extern bool producer_is_llvm (const char *producer); /* Returns true if the given PRODUCER string is clang, false otherwise. - Sets MAJOR and MINOR accordingly, if not NULL. */ + Sets MAJOR and MINOR accordingly, if not nullptr. */ extern bool producer_is_clang (const char *producer, int *major, int *minor); /* Return true if the supplied producer string matches the ARM