bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: An update for clang >= 16


From: Bruno Haible
Subject: Re: An update for clang >= 16
Date: Mon, 05 Aug 2024 16:31:02 +0200

On 2024-07-29 I did:
> 2024-07-29  Bruno Haible  <bruno@clisp.org>
> 
>       An update for clang >= 16.
>       * m4/gnulib-common.m4 (gl_COMMON_BODY): Don't define
>       _GL_BRACKET_BEFORE_ATTRIBUTE with clang++ 16 or newer.

But this causes a compilation error on FreeBSD 14.0, which uses clang 16.
The problem is that my test case was incomplete and clang 16 fixes the
problem only in some circumstances, not in others.

Reported as a clang++ bug at
<https://github.com/llvm/llvm-project/issues/101990>.

This patch fixes it.

Oh, btw, did I already say that C++ is an eternal waste of time?


2024-08-05  Bruno Haible  <bruno@clisp.org>

        Fix compilation error in C++ mode with clang >= 16 (regr. 2024-07-29).
        * m4/gnulib-common.m4 (gl_COMMON_BODY): Define
        _GL_BRACKET_BEFORE_ATTRIBUTE with clang++ 16 or newer.

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index f716d7a353..b208dc1266 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
 # gnulib-common.m4
-# serial 99
+# serial 100
 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,
@@ -146,6 +146,8 @@ AC_DEFUN([gl_COMMON_BODY]
       This gives a syntax error
         - in C mode with gcc, and
         - in C++ mode with clang++ version < 16.
+        - in C++ mode, inside extern "C" {}, still in newer clang++ versions
+          <https://github.com/llvm/llvm-project/issues/101990>.
  */
 /* Define if, in a function declaration, the attributes in bracket syntax
    [[...]] must come before the attributes in __attribute__((...)) syntax.
@@ -153,7 +155,7 @@ AC_DEFUN([gl_COMMON_BODY]
    various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any
    order.  */
 #ifdef __cplusplus
-# if defined __clang__ && __clang_major__ < 16
+# if defined __clang__
 #  define _GL_BRACKET_BEFORE_ATTRIBUTE 1
 # endif
 #else






reply via email to

[Prev in Thread] Current Thread [Next in Thread]