This is an automated email from Gerrit.

"Bernhard Rosenkraenzer <b...@baylibre.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8258

-- gerrit

commit 90d29e22ea3f9909ed172621ab93c2bfd0620a1e
Author: Bernhard Rosenkränzer <b...@baylibre.com>
Date:   Thu May 9 15:30:13 2024 +0200

    Fix build with clang even if it sets __GNUC__ to >= 4.4
    
    clang doesn't support the gnu_printf attribute that OpenOCD uses if
    __GNUC__ and __GNUC_MINOR__ indicates gcc >= 4.4.
    
    Most clang builds set __GNUC__/__GNUC_MINOR__ to 4.2 for historical
    reasons, so they don't trigger this condition; however, some builds set
    it to something much higher to work around code using __GNUC__ to
    determine if a feature that does exist in clang (but not gcc 4.2) is
    available, causing OpenOCD to use attribute gnu_printf.
    
    The problem can be reproduced without a special clang build by adding
    -fgnuc-version=14.1 to CFLAGS.
    
    Change-Id: I3c0832d4201578b116c5214203f95b6153dad30e
    Signed-off-by: Bernhard Rosenkränzer <b...@baylibre.com>

diff --git a/src/helper/command.h b/src/helper/command.h
index dc45070420..fc26dda81a 100644
--- a/src/helper/command.h
+++ b/src/helper/command.h
@@ -21,7 +21,7 @@
 /* To achieve C99 printf compatibility in MinGW, gnu_printf should be
  * used for __attribute__((format( ... ))), with GCC v4.4 or later
  */
-#if (defined(IS_MINGW) && (((__GNUC__ << 16) + __GNUC_MINOR__) >= 0x00040004))
+#if (defined(IS_MINGW) && (((__GNUC__ << 16) + __GNUC_MINOR__) >= 0x00040004)) 
&& !defined(__clang__)
 #define PRINTF_ATTRIBUTE_FORMAT gnu_printf
 #else
 #define PRINTF_ATTRIBUTE_FORMAT printf
diff --git a/src/helper/log.h b/src/helper/log.h
index 818716a9df..d52c05f99d 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -19,7 +19,7 @@
 /* To achieve C99 printf compatibility in MinGW, gnu_printf should be
  * used for __attribute__((format( ... ))), with GCC v4.4 or later
  */
-#if (defined(IS_MINGW) && (((__GNUC__ << 16) + __GNUC_MINOR__) >= 0x00040004))
+#if (defined(IS_MINGW) && (((__GNUC__ << 16) + __GNUC_MINOR__) >= 0x00040004)) 
&& !defined(__clang__)
 #define PRINTF_ATTRIBUTE_FORMAT gnu_printf
 #else
 #define PRINTF_ATTRIBUTE_FORMAT printf

-- 

Reply via email to