Imported Upstream version 1.4
[debian/gzip] / build-aux / link-warning.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A C macro for emitting link time warnings.
4    Copyright (C) 1995, 1997, 2000, 2002-2003, 2007, 2009-2010 Free Software
5    Foundation, Inc.
6
7    This program is free software: you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published
9    by the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 /* GL_LINK_WARNING("literal string") arranges to emit the literal string as
21    a linker warning on most glibc systems.
22    We use a linker warning rather than a preprocessor warning, because
23    #warning cannot be used inside macros.  */
24 #ifndef GL_LINK_WARNING
25   /* This works on platforms with GNU ld and ELF object format.
26      Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
27      Testing __ELF__ guarantees the ELF object format.
28      Testing __GNUC__ is necessary for the compound expression syntax.  */
29 # if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
30 #  define GL_LINK_WARNING(message) \
31      GL_LINK_WARNING1 (__FILE__, __LINE__, message)
32 #  define GL_LINK_WARNING1(file, line, message) \
33      GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
34 #  define GL_LINK_WARNING2(file, line, message) \
35      GL_LINK_WARNING3 (file ":" #line ": warning: " message)
36 #  define GL_LINK_WARNING3(message) \
37      ({ static const char warning[sizeof (message)]             \
38           __attribute__ ((__unused__,                           \
39                           __section__ (".gnu.warning"),         \
40                           __aligned__ (1)))                     \
41           = message "\n";                                       \
42         (void)0;                                                \
43      })
44 # else
45 #  define GL_LINK_WARNING(message) ((void) 0)
46 # endif
47 #endif