From: Bruno Haible Date: Thu, 6 Aug 2020 18:55:13 +0000 (+0200) Subject: Consider that clang defines __OPTIMIZE__ like GCC does. X-Git-Tag: v1.0~3814 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=d6f8ef89919919b7cde9ac7ca8621ba2e76a2b85;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 12b4bf3870..26e33d964f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-08-06 Bruno Haible + + 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 safe-alloc: Remove unused code. diff --git a/lib/c++defs.h b/lib/c++defs.h index 402cae4bd5..75d6250ece 100644 --- a/lib/c++defs.h +++ b/lib/c++defs.h @@ -268,7 +268,7 @@ _GL_CXXALIASWARN_2 (func, namespace) /* To work around GCC bug , 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. " \ @@ -296,7 +296,7 @@ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) /* To work around GCC bug , 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. " \ diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h index 3c33b6eacf..897dc99ba9 100644 --- a/lib/c-strcaseeq.h +++ b/lib/c-strcaseeq.h @@ -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 diff --git a/lib/streq.h b/lib/streq.h index cf15c0df66..978267b675 100644 --- a/lib/streq.h +++ b/lib/streq.h @@ -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)