From: Bruno Haible Date: Tue, 21 Dec 2021 14:10:25 +0000 (+0100) Subject: snippet/warn-on-use: Fix compilation error in C++ mode on OpenBSD 7.0. X-Git-Tag: v1.0~2504 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=f60cf6564aaea54df034c5c5664d9c13664ee372;p=gnulib.git snippet/warn-on-use: Fix compilation error in C++ mode on OpenBSD 7.0. * lib/warn-on-use.h (_GL_WARN_ON_USE): In C++ mode, declare function with "C" linkage. --- diff --git a/ChangeLog b/ChangeLog index 2fb6603c8d..1d4432ab71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-12-21 Bruno Haible + + snippet/warn-on-use: Fix compilation error in C++ mode on OpenBSD 7.0. + * lib/warn-on-use.h (_GL_WARN_ON_USE): In C++ mode, declare function + with "C" linkage. + 2021-12-21 Bruno Haible Optimize redundant 'mkdir -p .' invocations. diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h index 612937abb0..3984294616 100644 --- a/lib/warn-on-use.h +++ b/lib/warn-on-use.h @@ -84,20 +84,20 @@ # 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(function, message) \ -extern __typeof__ (function) function __attribute__ ((__warning__ (message))) +_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ __attribute__ ((__warning__ (message))) # elif __clang_major__ >= 4 /* Another compiler attribute is available in clang. */ # define _GL_WARN_ON_USE(function, message) \ -extern __typeof__ (function) function \ +_GL_WARN_EXTERN_C __typeof__ (function) function \ __attribute__ ((__diagnose_if__ (1, message, "warning"))) # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ __attribute__ ((__diagnose_if__ (1, message, "warning"))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE(function, message) \ -extern __typeof__ (function) function +_GL_WARN_EXTERN_C __typeof__ (function) function # define _GL_WARN_ON_USE_ATTRIBUTE(message) # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \