From: Bruno Haible Date: Sat, 20 Mar 2010 23:50:39 +0000 (+0100) Subject: Make _GL_WARN_ON_USE usable in C++ and C mode in the same compilation unit. X-Git-Tag: v0.1~4467 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=c08fc917860633e239da067ff42c397cc4729933;p=gnulib.git Make _GL_WARN_ON_USE usable in C++ and C mode in the same compilation unit. --- diff --git a/ChangeLog b/ChangeLog index cc3ef5aa3..71bd014c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2010-03-20 Bruno Haible + Make _GL_WARN_ON_USE usable in C++ and C mode in the same compilation. + * build-aux/warn-on-use.h (_GL_WARN_EXTERN_C): New macro. + (_GL_WARN_ON_USE, _GL_WARN_ON_USE_CXX): Likewise. + Reported by John W. Eaton . + +2010-03-20 Bruno Haible + * m4/unlink.m4 (gl_FUNC_UNLINK): Fix last commit. Reported by Jim Meyering. diff --git a/build-aux/warn-on-use.h b/build-aux/warn-on-use.h index d33cfe620..37b6d2986 100644 --- a/build-aux/warn-on-use.h +++ b/build-aux/warn-on-use.h @@ -70,7 +70,7 @@ extern __typeof__ (function) function __attribute__ ((__warning__ (message))) # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \ -extern int _gl_warn_on_use +_GL_WARN_EXTERN_C int _gl_warn_on_use # endif #endif @@ -87,6 +87,16 @@ extern rettype function parameters_and_attributes \ __attribute__ ((__warning__ (msg))) # else /* Unsupported. */ # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -extern int _gl_warn_on_use +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +#endif + +/* _GL_WARN_EXTERN_C declaration; + performs the declaration with C linkage. */ +#ifndef _GL_WARN_EXTERN_C +# if defined __cplusplus +# define _GL_WARN_EXTERN_C extern "C" +# else +# define _GL_WARN_EXTERN_C extern # endif #endif