annotate link-warning.h @ 273:88bbffa404ea 2.5 2.5

Updated version for release
author lost
date Sun, 16 Aug 2009 17:18:11 +0000
parents d5392bb5da3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
272
d5392bb5da3c Added generated files
lost
parents:
diff changeset
1 /* GL_LINK_WARNING("literal string") arranges to emit the literal string as
d5392bb5da3c Added generated files
lost
parents:
diff changeset
2 a linker warning on most glibc systems.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
3 We use a linker warning rather than a preprocessor warning, because
d5392bb5da3c Added generated files
lost
parents:
diff changeset
4 #warning cannot be used inside macros. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
5 #ifndef GL_LINK_WARNING
d5392bb5da3c Added generated files
lost
parents:
diff changeset
6 /* This works on platforms with GNU ld and ELF object format.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
7 Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
8 Testing __ELF__ guarantees the ELF object format.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
9 Testing __GNUC__ is necessary for the compound expression syntax. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
10 # if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
d5392bb5da3c Added generated files
lost
parents:
diff changeset
11 # define GL_LINK_WARNING(message) \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
12 GL_LINK_WARNING1 (__FILE__, __LINE__, message)
d5392bb5da3c Added generated files
lost
parents:
diff changeset
13 # define GL_LINK_WARNING1(file, line, message) \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
14 GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
15 # define GL_LINK_WARNING2(file, line, message) \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
16 GL_LINK_WARNING3 (file ":" #line ": warning: " message)
d5392bb5da3c Added generated files
lost
parents:
diff changeset
17 # define GL_LINK_WARNING3(message) \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
18 ({ static const char warning[sizeof (message)] \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
19 __attribute__ ((__unused__, \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
20 __section__ (".gnu.warning"), \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
21 __aligned__ (1))) \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
22 = message "\n"; \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
23 (void)0; \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
24 })
d5392bb5da3c Added generated files
lost
parents:
diff changeset
25 # else
d5392bb5da3c Added generated files
lost
parents:
diff changeset
26 # define GL_LINK_WARNING(message) ((void) 0)
d5392bb5da3c Added generated files
lost
parents:
diff changeset
27 # endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
28 #endif