]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Use nullptr instead of NULL in producer.[ch]
authorTom de Vries <tdevries@suse.de>
Mon, 17 Nov 2025 16:33:03 +0000 (17:33 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 17 Nov 2025 16:33:03 +0000 (17:33 +0100)
Replace the uses of NULL in gdb/producer.[ch] by nullptr.

Tested on x86_64-linux.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/producer.c
gdb/producer.h

index 91c2d1c2ca3ac63b432d8bf1ca4c84247b57aa26..baac115c587564f773fd0f409ad92673706c0183 100644 (file)
@@ -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));
   }
index 5ae90350caabad30890999b496a99fe14754f558..21201cd206dceb5cebe38549930191f4342d803c 100644 (file)
 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