Home | History | Annotate | Download | only in linux-lib
      1 #ifndef _GL_WARN_ON_USE
      2 
      3 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
      4 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
      5 #  define _GL_WARN_ON_USE(function, message) \
      6 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
      7 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
      8 /* Verify the existence of the function.  */
      9 #  define _GL_WARN_ON_USE(function, message) \
     10 extern __typeof__ (function) function
     11 # else /* Unsupported.  */
     12 #  define _GL_WARN_ON_USE(function, message) \
     13 _GL_WARN_EXTERN_C int _gl_warn_on_use
     14 # endif
     15 #endif
     16 
     17 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
     18    is like _GL_WARN_ON_USE (function, "string"), except that the function is
     19    declared with the given prototype, consisting of return type, parameters,
     20    and attributes.
     21    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
     22    not work in this case.  */
     23 #ifndef _GL_WARN_ON_USE_CXX
     24 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
     25 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
     26 extern rettype function parameters_and_attributes \
     27      __attribute__ ((__warning__ (msg)))
     28 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
     29 /* Verify the existence of the function.  */
     30 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
     31 extern rettype function parameters_and_attributes
     32 # else /* Unsupported.  */
     33 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
     34 _GL_WARN_EXTERN_C int _gl_warn_on_use
     35 # endif
     36 #endif
     37 
     38 /* _GL_WARN_EXTERN_C declaration;
     39    performs the declaration with C linkage.  */
     40 #ifndef _GL_WARN_EXTERN_C
     41 # if defined __cplusplus
     42 #  define _GL_WARN_EXTERN_C extern "C"
     43 # else
     44 #  define _GL_WARN_EXTERN_C extern
     45 # endif
     46 #endif
     47