A misspelling of __clang_major__ in glibc made it into Gnulib.
Paul fixed it in glibc:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=7999b8a3aa76eae4f75b76fd6797e832274b8114
but the occurrences in Gnulib are still opportunities for bugs
through copy&paste.

This patch fixes them.


2024-07-29  Bruno Haible  <br...@clisp.org>

        Fix misspelling of __clang_major__.
        * lib/cdefs.h (__THROW, __THROWNL, __NTH, __NTHNL): Fix misspelled macro
        name.
        * m4/gnulib-common.m4 (gl_COMMON_BODY): Likewise.
        * lib/malloc.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
        * lib/stddef.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
        * lib/stdio.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
        * lib/stdlib.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
        * lib/string.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
        * lib/sys_stat.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
        * lib/wchar.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.

diff --git a/lib/cdefs.h b/lib/cdefs.h
index d38382ad9d..9c49eeb413 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -83,7 +83,7 @@
 #  define __NTH(fct)   __attribute__ ((__nothrow__ __LEAF)) fct
 #  define __NTHNL(fct)  __attribute__ ((__nothrow__)) fct
 # else
-#  if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
+#  if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
 #   if __cplusplus >= 201103L
 #    define __THROW    noexcept (true)
 #   else
diff --git a/lib/malloc.in.h b/lib/malloc.in.h
index 3ca364cbe2..a08f21fb84 100644
--- a/lib/malloc.in.h
+++ b/lib/malloc.in.h
@@ -65,7 +65,7 @@
  */
 #ifndef _GL_ATTRIBUTE_NOTHROW
 # if defined __cplusplus
-#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
 #   if __cplusplus >= 201103L
 #    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
 #   else
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 0abc449704..49449315cf 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -131,7 +131,7 @@ typedef long max_align_t;
  */
 #ifndef _GL_ATTRIBUTE_NOTHROW
 # if defined __cplusplus
-#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
 #   if __cplusplus >= 201103L
 #    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
 #   else
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 4ea4e3cc16..39c1182f7e 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -155,7 +155,7 @@
  */
 #ifndef _GL_ATTRIBUTE_NOTHROW
 # if defined __cplusplus
-#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
 #   if __cplusplus >= 201103L
 #    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
 #   else
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index d86b3ad53c..29a48e86ae 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -161,7 +161,7 @@ struct random_data
  */
 #ifndef _GL_ATTRIBUTE_NOTHROW
 # if defined __cplusplus
-#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
 #   if __cplusplus >= 201103L
 #    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
 #   else
diff --git a/lib/string.in.h b/lib/string.in.h
index 44ec2e7ecd..613d0337d5 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -115,7 +115,7 @@
  */
 #ifndef _GL_ATTRIBUTE_NOTHROW
 # if defined __cplusplus
-#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
 #   if __cplusplus >= 201103L
 #    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
 #   else
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 820c1087f7..1e82399c87 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -65,7 +65,7 @@
  */
 #ifndef _GL_ATTRIBUTE_NOTHROW
 # if defined __cplusplus
-#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
 #   if __cplusplus >= 201103L
 #    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
 #   else
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index a33a10f747..5261692fc9 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -141,7 +141,7 @@
  */
 #ifndef _GL_ATTRIBUTE_NOTHROW
 # if defined __cplusplus
-#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
 #   if __cplusplus >= 201103L
 #    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
 #   else
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index b34b4534bf..71d90dfe71 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
 # gnulib-common.m4
-# serial 95
+# serial 96
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -488,7 +488,7 @@ AC_DEFUN([gl_COMMON_BODY]
    other attributes.  */
 #ifndef _GL_ATTRIBUTE_NOTHROW
 # if defined __cplusplus
-#  if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4
+#  if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
 #   if __cplusplus >= 201103L
 #    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
 #   else




Reply via email to