]> Savannah Git Hosting - gnulib.git/commitdiff
Consider that clang defines __OPTIMIZE__ like GCC does.
authorBruno Haible <bruno@clisp.org>
Thu, 6 Aug 2020 18:55:13 +0000 (20:55 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 6 Aug 2020 18:55:53 +0000 (20:55 +0200)
* lib/streq.h: Define the inline functions also on clang.
* lib/c-strcaseeq.h: Likewise.
* lib/c++defs.h (_GL_CXXALIASWARN_2, _GL_CXXALIASWARN1_2): Don't enable
the GCC workaround to clang.

ChangeLog
lib/c++defs.h
lib/c-strcaseeq.h
lib/streq.h

index 12b4bf3870330a9e8f5fa89190344dbe63b91297..26e33d964fa4af0276de86d3bb31ceefbfda89f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-08-06  Bruno Haible  <bruno@clisp.org>
+
+       Consider that clang defines __OPTIMIZE__ like GCC does.
+       * lib/streq.h: Define the inline functions also on clang.
+       * lib/c-strcaseeq.h: Likewise.
+       * lib/c++defs.h (_GL_CXXALIASWARN_2, _GL_CXXALIASWARN1_2): Don't enable
+       the GCC workaround to clang.
+
 2020-08-06  Bruno Haible  <bruno@clisp.org>
 
        safe-alloc: Remove unused code.
index 402cae4bd5ab50408e6aa68445c8e4572c266ced..75d6250ece16dca5ebc16e80d1165136c219b84f 100644 (file)
    _GL_CXXALIASWARN_2 (func, namespace)
 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
    we enable the warning only when not optimizing.  */
-# if !__OPTIMIZE__
+# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
 #  define _GL_CXXALIASWARN_2(func,namespace) \
     _GL_WARN_ON_USE (func, \
                      "The symbol ::" #func " refers to the system function. " \
    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
    we enable the warning only when not optimizing.  */
-# if !__OPTIMIZE__
+# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
                          "The symbol ::" #func " refers to the system function. " \
index 3c33b6eacf29488efcd23dcdfcadde3ea550120a..897dc99ba964124fb9a5f1caea46cdcf23d69621 100644 (file)
@@ -27,7 +27,7 @@
 
 /* Help GCC to generate good code for string comparisons with
    immediate strings. */
-#if defined (__GNUC__) && defined (__OPTIMIZE__)
+#if (defined __GNUC__ || defined __clang__) && defined __OPTIMIZE__
 
 /* Case insensitive comparison of ASCII characters.  */
 # if C_CTYPE_ASCII
index cf15c0df6692abdcea849cd3cafd15a77d389daa..978267b6757640ac2abbe1ead7b480ba0930b425 100644 (file)
@@ -29,7 +29,7 @@
 
 /* Help GCC to generate good code for string comparisons with
    immediate strings. */
-#if defined (__GNUC__) && defined (__OPTIMIZE__)
+#if (defined __GNUC__ || defined __clang__) && defined __OPTIMIZE__
 
 static inline int
 streq9 (const char *s1, const char *s2)