Blame SOURCES/0321-build-aux-snippet-Add-missing-gnulib-files.patch

f96e0b
From 45a73dcb6d7a100a14d9d9d54f3ab60278a05ca1 Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Wed, 17 Apr 2013 07:00:37 +0200
f96e0b
Subject: [PATCH 321/482] 	* build-aux/snippet: Add missing gnulib files.
f96e0b
f96e0b
---
f96e0b
 ChangeLog                       |   4 +
f96e0b
 build-aux/snippet/_Noreturn.h   |  10 ++
f96e0b
 build-aux/snippet/arg-nonnull.h |  26 ++++
f96e0b
 build-aux/snippet/c++defs.h     | 271 ++++++++++++++++++++++++++++++++++++++++
f96e0b
 build-aux/snippet/warn-on-use.h | 109 ++++++++++++++++
f96e0b
 5 files changed, 420 insertions(+)
f96e0b
 create mode 100644 build-aux/snippet/_Noreturn.h
f96e0b
 create mode 100644 build-aux/snippet/arg-nonnull.h
f96e0b
 create mode 100644 build-aux/snippet/c++defs.h
f96e0b
 create mode 100644 build-aux/snippet/warn-on-use.h
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index b60a71d..073207a 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,3 +1,7 @@
f96e0b
+2013-04-17  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
+	* build-aux/snippet: Add missing gnulib files.
f96e0b
+
f96e0b
 2013-04-16  Andrey Borzenkov <arvidjaar@gmail.com>
f96e0b
 
f96e0b
 	* grub-core/disk/efi/efidisk.c: Really limit transfer chunk size.
f96e0b
diff --git a/build-aux/snippet/_Noreturn.h b/build-aux/snippet/_Noreturn.h
f96e0b
new file mode 100644
f96e0b
index 0000000..c44ad89
f96e0b
--- /dev/null
f96e0b
+++ b/build-aux/snippet/_Noreturn.h
f96e0b
@@ -0,0 +1,10 @@
f96e0b
+#if !defined _Noreturn && __STDC_VERSION__ < 201112
f96e0b
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
f96e0b
+      || 0x5110 <= __SUNPRO_C)
f96e0b
+#  define _Noreturn __attribute__ ((__noreturn__))
f96e0b
+# elif 1200 <= _MSC_VER
f96e0b
+#  define _Noreturn __declspec (noreturn)
f96e0b
+# else
f96e0b
+#  define _Noreturn
f96e0b
+# endif
f96e0b
+#endif
f96e0b
diff --git a/build-aux/snippet/arg-nonnull.h b/build-aux/snippet/arg-nonnull.h
f96e0b
new file mode 100644
f96e0b
index 0000000..8ea2a47
f96e0b
--- /dev/null
f96e0b
+++ b/build-aux/snippet/arg-nonnull.h
f96e0b
@@ -0,0 +1,26 @@
f96e0b
+/* A C macro for declaring that specific arguments must not be NULL.
f96e0b
+   Copyright (C) 2009-2013 Free Software Foundation, Inc.
f96e0b
+
f96e0b
+   This program is free software: you can redistribute it and/or modify it
f96e0b
+   under the terms of the GNU General Public License as published
f96e0b
+   by the Free Software Foundation; either version 3 of the License, or
f96e0b
+   (at your option) any later version.
f96e0b
+
f96e0b
+   This program is distributed in the hope that it will be useful,
f96e0b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
f96e0b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
f96e0b
+   General Public License for more details.
f96e0b
+
f96e0b
+   You should have received a copy of the GNU General Public License
f96e0b
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
f96e0b
+
f96e0b
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
f96e0b
+   that the values passed as arguments n, ..., m must be non-NULL pointers.
f96e0b
+   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
f96e0b
+#ifndef _GL_ARG_NONNULL
f96e0b
+# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
f96e0b
+#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
f96e0b
+# else
f96e0b
+#  define _GL_ARG_NONNULL(params)
f96e0b
+# endif
f96e0b
+#endif
f96e0b
diff --git a/build-aux/snippet/c++defs.h b/build-aux/snippet/c++defs.h
f96e0b
new file mode 100644
f96e0b
index 0000000..b35b933
f96e0b
--- /dev/null
f96e0b
+++ b/build-aux/snippet/c++defs.h
f96e0b
@@ -0,0 +1,271 @@
f96e0b
+/* C++ compatible function declaration macros.
f96e0b
+   Copyright (C) 2010-2013 Free Software Foundation, Inc.
f96e0b
+
f96e0b
+   This program is free software: you can redistribute it and/or modify it
f96e0b
+   under the terms of the GNU General Public License as published
f96e0b
+   by the Free Software Foundation; either version 3 of the License, or
f96e0b
+   (at your option) any later version.
f96e0b
+
f96e0b
+   This program is distributed in the hope that it will be useful,
f96e0b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
f96e0b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
f96e0b
+   General Public License for more details.
f96e0b
+
f96e0b
+   You should have received a copy of the GNU General Public License
f96e0b
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
f96e0b
+
f96e0b
+#ifndef _GL_CXXDEFS_H
f96e0b
+#define _GL_CXXDEFS_H
f96e0b
+
f96e0b
+/* The three most frequent use cases of these macros are:
f96e0b
+
f96e0b
+   * For providing a substitute for a function that is missing on some
f96e0b
+     platforms, but is declared and works fine on the platforms on which
f96e0b
+     it exists:
f96e0b
+
f96e0b
+       #if @GNULIB_FOO@
f96e0b
+       # if !@HAVE_FOO@
f96e0b
+       _GL_FUNCDECL_SYS (foo, ...);
f96e0b
+       # endif
f96e0b
+       _GL_CXXALIAS_SYS (foo, ...);
f96e0b
+       _GL_CXXALIASWARN (foo);
f96e0b
+       #elif defined GNULIB_POSIXCHECK
f96e0b
+       ...
f96e0b
+       #endif
f96e0b
+
f96e0b
+   * For providing a replacement for a function that exists on all platforms,
f96e0b
+     but is broken/insufficient and needs to be replaced on some platforms:
f96e0b
+
f96e0b
+       #if @GNULIB_FOO@
f96e0b
+       # if @REPLACE_FOO@
f96e0b
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
f96e0b
+       #   undef foo
f96e0b
+       #   define foo rpl_foo
f96e0b
+       #  endif
f96e0b
+       _GL_FUNCDECL_RPL (foo, ...);
f96e0b
+       _GL_CXXALIAS_RPL (foo, ...);
f96e0b
+       # else
f96e0b
+       _GL_CXXALIAS_SYS (foo, ...);
f96e0b
+       # endif
f96e0b
+       _GL_CXXALIASWARN (foo);
f96e0b
+       #elif defined GNULIB_POSIXCHECK
f96e0b
+       ...
f96e0b
+       #endif
f96e0b
+
f96e0b
+   * For providing a replacement for a function that exists on some platforms
f96e0b
+     but is broken/insufficient and needs to be replaced on some of them and
f96e0b
+     is additionally either missing or undeclared on some other platforms:
f96e0b
+
f96e0b
+       #if @GNULIB_FOO@
f96e0b
+       # if @REPLACE_FOO@
f96e0b
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
f96e0b
+       #   undef foo
f96e0b
+       #   define foo rpl_foo
f96e0b
+       #  endif
f96e0b
+       _GL_FUNCDECL_RPL (foo, ...);
f96e0b
+       _GL_CXXALIAS_RPL (foo, ...);
f96e0b
+       # else
f96e0b
+       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
f96e0b
+       _GL_FUNCDECL_SYS (foo, ...);
f96e0b
+       #  endif
f96e0b
+       _GL_CXXALIAS_SYS (foo, ...);
f96e0b
+       # endif
f96e0b
+       _GL_CXXALIASWARN (foo);
f96e0b
+       #elif defined GNULIB_POSIXCHECK
f96e0b
+       ...
f96e0b
+       #endif
f96e0b
+*/
f96e0b
+
f96e0b
+/* _GL_EXTERN_C declaration;
f96e0b
+   performs the declaration with C linkage.  */
f96e0b
+#if defined __cplusplus
f96e0b
+# define _GL_EXTERN_C extern "C"
f96e0b
+#else
f96e0b
+# define _GL_EXTERN_C extern
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
f96e0b
+   declares a replacement function, named rpl_func, with the given prototype,
f96e0b
+   consisting of return type, parameters, and attributes.
f96e0b
+   Example:
f96e0b
+     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
f96e0b
+                                  _GL_ARG_NONNULL ((1)));
f96e0b
+ */
f96e0b
+#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
f96e0b
+  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
f96e0b
+#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
f96e0b
+  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
f96e0b
+
f96e0b
+/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
f96e0b
+   declares the system function, named func, with the given prototype,
f96e0b
+   consisting of return type, parameters, and attributes.
f96e0b
+   Example:
f96e0b
+     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
f96e0b
+                                  _GL_ARG_NONNULL ((1)));
f96e0b
+ */
f96e0b
+#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
f96e0b
+  _GL_EXTERN_C rettype func parameters_and_attributes
f96e0b
+
f96e0b
+/* _GL_CXXALIAS_RPL (func, rettype, parameters);
f96e0b
+   declares a C++ alias called GNULIB_NAMESPACE::func
f96e0b
+   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
f96e0b
+   Example:
f96e0b
+     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
f96e0b
+ */
f96e0b
+#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
f96e0b
+  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
f96e0b
+#if defined __cplusplus && defined GNULIB_NAMESPACE
f96e0b
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
f96e0b
+    namespace GNULIB_NAMESPACE                                \
f96e0b
+    {                                                         \
f96e0b
+      rettype (*const func) parameters = ::rpl_func;          \
f96e0b
+    }                                                         \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#else
f96e0b
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
f96e0b
+   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
f96e0b
+   except that the C function rpl_func may have a slightly different
f96e0b
+   declaration.  A cast is used to silence the "invalid conversion" error
f96e0b
+   that would otherwise occur.  */
f96e0b
+#if defined __cplusplus && defined GNULIB_NAMESPACE
f96e0b
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
f96e0b
+    namespace GNULIB_NAMESPACE                                     \
f96e0b
+    {                                                              \
f96e0b
+      rettype (*const func) parameters =                           \
f96e0b
+        reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
f96e0b
+    }                                                              \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#else
f96e0b
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_CXXALIAS_SYS (func, rettype, parameters);
f96e0b
+   declares a C++ alias called GNULIB_NAMESPACE::func
f96e0b
+   that redirects to the system provided function func, if GNULIB_NAMESPACE
f96e0b
+   is defined.
f96e0b
+   Example:
f96e0b
+     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
f96e0b
+ */
f96e0b
+#if defined __cplusplus && defined GNULIB_NAMESPACE
f96e0b
+  /* If we were to write
f96e0b
+       rettype (*const func) parameters = ::func;
f96e0b
+     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
f96e0b
+     better (remove an indirection through a 'static' pointer variable),
f96e0b
+     but then the _GL_CXXALIASWARN macro below would cause a warning not only
f96e0b
+     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
f96e0b
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
f96e0b
+    namespace GNULIB_NAMESPACE                     \
f96e0b
+    {                                              \
f96e0b
+      static rettype (*func) parameters = ::func;  \
f96e0b
+    }                                              \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#else
f96e0b
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
f96e0b
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
f96e0b
+   except that the C function func may have a slightly different declaration.
f96e0b
+   A cast is used to silence the "invalid conversion" error that would
f96e0b
+   otherwise occur.  */
f96e0b
+#if defined __cplusplus && defined GNULIB_NAMESPACE
f96e0b
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
f96e0b
+    namespace GNULIB_NAMESPACE                          \
f96e0b
+    {                                                   \
f96e0b
+      static rettype (*func) parameters =               \
f96e0b
+        reinterpret_cast<rettype(*)parameters>(::func); \
f96e0b
+    }                                                   \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#else
f96e0b
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
f96e0b
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
f96e0b
+   except that the C function is picked among a set of overloaded functions,
f96e0b
+   namely the one with rettype2 and parameters2.  Two consecutive casts
f96e0b
+   are used to silence the "cannot find a match" and "invalid conversion"
f96e0b
+   errors that would otherwise occur.  */
f96e0b
+#if defined __cplusplus && defined GNULIB_NAMESPACE
f96e0b
+  /* The outer cast must be a reinterpret_cast.
f96e0b
+     The inner cast: When the function is defined as a set of overloaded
f96e0b
+     functions, it works as a static_cast<>, choosing the designated variant.
f96e0b
+     When the function is defined as a single variant, it works as a
f96e0b
+     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
f96e0b
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
f96e0b
+    namespace GNULIB_NAMESPACE                                                \
f96e0b
+    {                                                                         \
f96e0b
+      static rettype (*func) parameters =                                     \
f96e0b
+        reinterpret_cast<rettype(*)parameters>(                               \
f96e0b
+          (rettype2(*)parameters2)(::func));                                  \
f96e0b
+    }                                                                         \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#else
f96e0b
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_CXXALIASWARN (func);
f96e0b
+   causes a warning to be emitted when ::func is used but not when
f96e0b
+   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
f96e0b
+   variants.  */
f96e0b
+#if defined __cplusplus && defined GNULIB_NAMESPACE
f96e0b
+# define _GL_CXXALIASWARN(func) \
f96e0b
+   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
f96e0b
+# define _GL_CXXALIASWARN_1(func,namespace) \
f96e0b
+   _GL_CXXALIASWARN_2 (func, namespace)
f96e0b
+/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
f96e0b
+   we enable the warning only when not optimizing.  */
f96e0b
+# if !__OPTIMIZE__
f96e0b
+#  define _GL_CXXALIASWARN_2(func,namespace) \
f96e0b
+    _GL_WARN_ON_USE (func, \
f96e0b
+                     "The symbol ::" #func " refers to the system function. " \
f96e0b
+                     "Use " #namespace "::" #func " instead.")
f96e0b
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
f96e0b
+#  define _GL_CXXALIASWARN_2(func,namespace) \
f96e0b
+     extern __typeof__ (func) func
f96e0b
+# else
f96e0b
+#  define _GL_CXXALIASWARN_2(func,namespace) \
f96e0b
+     _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+# endif
f96e0b
+#else
f96e0b
+# define _GL_CXXALIASWARN(func) \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
f96e0b
+   causes a warning to be emitted when the given overloaded variant of ::func
f96e0b
+   is used but not when GNULIB_NAMESPACE::func is used.  */
f96e0b
+#if defined __cplusplus && defined GNULIB_NAMESPACE
f96e0b
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
f96e0b
+   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
f96e0b
+                        GNULIB_NAMESPACE)
f96e0b
+# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
f96e0b
+   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
f96e0b
+/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
f96e0b
+   we enable the warning only when not optimizing.  */
f96e0b
+# if !__OPTIMIZE__
f96e0b
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
f96e0b
+    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
f96e0b
+                         "The symbol ::" #func " refers to the system function. " \
f96e0b
+                         "Use " #namespace "::" #func " instead.")
f96e0b
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
f96e0b
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
f96e0b
+     extern __typeof__ (func) func
f96e0b
+# else
f96e0b
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
f96e0b
+     _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+# endif
f96e0b
+#else
f96e0b
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
f96e0b
+    _GL_EXTERN_C int _gl_cxxalias_dummy
f96e0b
+#endif
f96e0b
+
f96e0b
+#endif /* _GL_CXXDEFS_H */
f96e0b
diff --git a/build-aux/snippet/warn-on-use.h b/build-aux/snippet/warn-on-use.h
f96e0b
new file mode 100644
f96e0b
index 0000000..1736a1b
f96e0b
--- /dev/null
f96e0b
+++ b/build-aux/snippet/warn-on-use.h
f96e0b
@@ -0,0 +1,109 @@
f96e0b
+/* A C macro for emitting warnings if a function is used.
f96e0b
+   Copyright (C) 2010-2013 Free Software Foundation, Inc.
f96e0b
+
f96e0b
+   This program is free software: you can redistribute it and/or modify it
f96e0b
+   under the terms of the GNU General Public License as published
f96e0b
+   by the Free Software Foundation; either version 3 of the License, or
f96e0b
+   (at your option) any later version.
f96e0b
+
f96e0b
+   This program is distributed in the hope that it will be useful,
f96e0b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
f96e0b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
f96e0b
+   General Public License for more details.
f96e0b
+
f96e0b
+   You should have received a copy of the GNU General Public License
f96e0b
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
f96e0b
+
f96e0b
+/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
f96e0b
+   for FUNCTION which will then trigger a compiler warning containing
f96e0b
+   the text of "literal string" anywhere that function is called, if
f96e0b
+   supported by the compiler.  If the compiler does not support this
f96e0b
+   feature, the macro expands to an unused extern declaration.
f96e0b
+
f96e0b
+   This macro is useful for marking a function as a potential
f96e0b
+   portability trap, with the intent that "literal string" include
f96e0b
+   instructions on the replacement function that should be used
f96e0b
+   instead.  However, one of the reasons that a function is a
f96e0b
+   portability trap is if it has the wrong signature.  Declaring
f96e0b
+   FUNCTION with a different signature in C is a compilation error, so
f96e0b
+   this macro must use the same type as any existing declaration so
f96e0b
+   that programs that avoid the problematic FUNCTION do not fail to
f96e0b
+   compile merely because they included a header that poisoned the
f96e0b
+   function.  But this implies that _GL_WARN_ON_USE is only safe to
f96e0b
+   use if FUNCTION is known to already have a declaration.  Use of
f96e0b
+   this macro implies that there must not be any other macro hiding
f96e0b
+   the declaration of FUNCTION; but undefining FUNCTION first is part
f96e0b
+   of the poisoning process anyway (although for symbols that are
f96e0b
+   provided only via a macro, the result is a compilation error rather
f96e0b
+   than a warning containing "literal string").  Also note that in
f96e0b
+   C++, it is only safe to use if FUNCTION has no overloads.
f96e0b
+
f96e0b
+   For an example, it is possible to poison 'getline' by:
f96e0b
+   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
f96e0b
+     [getline]) in configure.ac, which potentially defines
f96e0b
+     HAVE_RAW_DECL_GETLINE
f96e0b
+   - adding this code to a header that wraps the system <stdio.h>:
f96e0b
+     #undef getline
f96e0b
+     #if HAVE_RAW_DECL_GETLINE
f96e0b
+     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
f96e0b
+       "not universally present; use the gnulib module getline");
f96e0b
+     #endif
f96e0b
+
f96e0b
+   It is not possible to directly poison global variables.  But it is
f96e0b
+   possible to write a wrapper accessor function, and poison that
f96e0b
+   (less common usage, like &environ, will cause a compilation error
f96e0b
+   rather than issue the nice warning, but the end result of informing
f96e0b
+   the developer about their portability problem is still achieved):
f96e0b
+   #if HAVE_RAW_DECL_ENVIRON
f96e0b
+   static char ***rpl_environ (void) { return &environ; }
f96e0b
+   _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
f96e0b
+   # undef environ
f96e0b
+   # define environ (*rpl_environ ())
f96e0b
+   #endif
f96e0b
+   */
f96e0b
+#ifndef _GL_WARN_ON_USE
f96e0b
+
f96e0b
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
f96e0b
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
f96e0b
+#  define _GL_WARN_ON_USE(function, message) \
f96e0b
+extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
f96e0b
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
f96e0b
+/* Verify the existence of the function.  */
f96e0b
+#  define _GL_WARN_ON_USE(function, message) \
f96e0b
+extern __typeof__ (function) function
f96e0b
+# else /* Unsupported.  */
f96e0b
+#  define _GL_WARN_ON_USE(function, message) \
f96e0b
+_GL_WARN_EXTERN_C int _gl_warn_on_use
f96e0b
+# endif
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
f96e0b
+   is like _GL_WARN_ON_USE (function, "string"), except that the function is
f96e0b
+   declared with the given prototype, consisting of return type, parameters,
f96e0b
+   and attributes.
f96e0b
+   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
f96e0b
+   not work in this case.  */
f96e0b
+#ifndef _GL_WARN_ON_USE_CXX
f96e0b
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
f96e0b
+#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
f96e0b
+extern rettype function parameters_and_attributes \
f96e0b
+     __attribute__ ((__warning__ (msg)))
f96e0b
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
f96e0b
+/* Verify the existence of the function.  */
f96e0b
+#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
f96e0b
+extern rettype function parameters_and_attributes
f96e0b
+# else /* Unsupported.  */
f96e0b
+#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
f96e0b
+_GL_WARN_EXTERN_C int _gl_warn_on_use
f96e0b
+# endif
f96e0b
+#endif
f96e0b
+
f96e0b
+/* _GL_WARN_EXTERN_C declaration;
f96e0b
+   performs the declaration with C linkage.  */
f96e0b
+#ifndef _GL_WARN_EXTERN_C
f96e0b
+# if defined __cplusplus
f96e0b
+#  define _GL_WARN_EXTERN_C extern "C"
f96e0b
+# else
f96e0b
+#  define _GL_WARN_EXTERN_C extern
f96e0b
+# endif
f96e0b
+#endif
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b