diff options
author | Bruno Haible <bruno@clisp.org> | 2020-08-10 03:17:06 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-08-10 03:17:06 +0200 |
commit | 7fac3d3da0c24cd1e9cb344c622728c1a114788d (patch) | |
tree | b7c8274806156f8584eb444838f303b39ff50f25 /lib/warn-on-use.h | |
parent | 444acd314f6c4a1fb7ea7412a54b8ea5fc0ad7c2 (diff) | |
download | gnulib-7fac3d3da0c24cd1e9cb344c622728c1a114788d.tar.gz |
string: Fix build error in C++ mode with clang (regression from today).
* lib/warn-on-use.h (_GL_WARN_ON_USE_CXX): Expect two rettype
parameters, one for GCC, one for clang.
* lib/c++defs.h (_GL_CXXALIASWARN1_2): Update.
* lib/string.in.h (strchr, strpbrk, strrchr): For clang, pass 'char *'
as return type.
Diffstat (limited to 'lib/warn-on-use.h')
-rw-r--r-- | lib/warn-on-use.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h index a39e3a394c..5ff2163a25 100644 --- a/lib/warn-on-use.h +++ b/lib/warn-on-use.h @@ -106,33 +106,33 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use # endif #endif -/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") - is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the +/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") + is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the function is declared with the given prototype, consisting of return type, parameters, and attributes. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does not work in this case. */ #ifndef _GL_WARN_ON_USE_CXX # if !defined __cplusplus -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ _GL_WARN_ON_USE (function, msg) # else # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) /* A compiler attribute is available in gcc versions 4.3.0 and later. */ -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -extern rettype function parameters_and_attributes \ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes \ __attribute__ ((__warning__ (msg))) # elif __clang_major__ >= 4 /* Another compiler attribute is available in clang. */ -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -extern rettype function parameters_and_attributes \ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_clang function parameters_and_attributes \ __attribute__ ((__diagnose_if__ (1, msg, "warning"))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -extern rettype function parameters_and_attributes +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes # else /* Unsupported. */ -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # endif # endif |