New module 'link-warning'.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Feb 2007 22:21:32 +0000 (22:21 +0000)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Feb 2007 22:21:32 +0000 (22:21 +0000)
ChangeLog
build-aux/link-warning.h [new file with mode: 0644]
lib/string_.h
modules/link-warning [new file with mode: 0644]
modules/string

index a92d6a2..9dfe962 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2007-02-17  Bruno Haible  <bruno@clisp.org>
 
+       * modules/link-warning: New file.
+       * build-aux/link-warning.h: New file, extracted from lib/string_.h.
+       * lib/string_.h (GL_LINK_WARNING): Remove definition.
+       * modules/string (Depends-on): Add link-warning.
+       (Makefile.am): Copy the contents of build-aux/link-warning.h into
+       string.h.
+
+2007-02-17  Bruno Haible  <bruno@clisp.org>
+
        * lib/string_.h (memmem, mempcpy, memrchr, stpcpy, stpncpy, strcasecmp,
        strncasecmp, strchr, strchrnul, strdup, strndup, strnlen, strcspn,
        strpbrk, strspn, strrchr, strsep, strstr, strcasestr, strtok_r): Break
diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h
new file mode 100644 (file)
index 0000000..fda0194
--- /dev/null
@@ -0,0 +1,28 @@
+/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
+   a linker warning on most glibc systems.
+   We use a linker warning rather than a preprocessor warning, because
+   #warning cannot be used inside macros.  */
+#ifndef GL_LINK_WARNING
+  /* This works on platforms with GNU ld and ELF object format.
+     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
+     Testing __ELF__ guarantees the ELF object format.
+     Testing __GNUC__ is necessary for the compound expression syntax.  */
+# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
+#  define GL_LINK_WARNING(message) \
+     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
+#  define GL_LINK_WARNING1(file, line, message) \
+     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
+#  define GL_LINK_WARNING2(file, line, message) \
+     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
+#  define GL_LINK_WARNING3(message) \
+     ({ static const char warning[sizeof (message)]            \
+          __attribute__ ((__unused__,                          \
+                          __section__ (".gnu.warning"),                \
+                          __aligned__ (1)))                    \
+          = message "\n";                                      \
+        (void)0;                                               \
+     })
+# else
+#  define GL_LINK_WARNING(message) ((void) 0)
+# endif
+#endif
index a5887f9..14e7817 100644 (file)
 #include @ABSOLUTE_STRING_H@
 
 
-/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
-   a linker warning on most glibc systems.
-   We use a linker warning rather than a preprocessor warning, because
-   #warning cannot be used inside macros.  */
-#ifndef GL_LINK_WARNING
-  /* This works on platforms with GNU ld and ELF object format.
-     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
-     Testing __ELF__ guarantees the ELF object format.
-     Testing __GNUC__ is necessary for the compound expression syntax.  */
-# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
-#  define GL_LINK_WARNING(message) \
-     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
-#  define GL_LINK_WARNING1(file, line, message) \
-     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
-#  define GL_LINK_WARNING2(file, line, message) \
-     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
-#  define GL_LINK_WARNING3(message) \
-     ({ static const char warning[sizeof (message)]            \
-          __attribute__ ((__unused__,                          \
-                          __section__ (".gnu.warning"),                \
-                          __aligned__ (1)))                    \
-          = message "\n";                                      \
-        (void)0;                                               \
-     })
-# else
-#  define GL_LINK_WARNING(message) ((void) 0)
-# endif
-#endif
+/* The definition of GL_LINK_WARNING is copied here.  */
 
 
 #ifdef __cplusplus
diff --git a/modules/link-warning b/modules/link-warning
new file mode 100644 (file)
index 0000000..94fca4f
--- /dev/null
@@ -0,0 +1,21 @@
+Description:
+A C macro for emitting link time warnings.
+
+Files:
+build-aux/link-warning.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
+
+Include:
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
+
index 7b11e5d..28bd162 100644 (file)
@@ -8,6 +8,7 @@ m4/string_h.m4
 Depends-on:
 absolute-header
 extensions
+link-warning
 
 configure.ac:
 gl_HEADER_STRING_H
@@ -63,6 +64,7 @@ string.h: string_.h
              -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
              -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
              -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/string_.h; \
        } > $@-t
        mv $@-t $@