tests: avoid compilation warnings in argmatch and exclude tests...
authorJim Meyering <meyering@redhat.com>
Fri, 11 Jun 2010 07:50:29 +0000 (09:50 +0200)
committerJim Meyering <meyering@redhat.com>
Fri, 11 Jun 2010 08:30:51 +0000 (10:30 +0200)
in packages that define ARGMATCH_DIE_DECL, like coreutils.
* tests/test-exclude.c [ARGMATCH_DIE_DECL]: Also declare the function.
Since it always exits, declare with the "noreturn" attribute.
* tests/test-argmatch.c: Likewise.

ChangeLog
tests/test-argmatch.c
tests/test-exclude.c

index 5b037a4ccdc1f91c004cdb9d9ad2d8439f547310..d96f7fe992e2d373415d30aa1d8bf8918cda856c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-06-11  Jim Meyering  <meyering@redhat.com>
 
+       tests: avoid compilation warnings in argmatch and exclude tests...
+       in packages that define ARGMATCH_DIE_DECL, like coreutils.
+       * tests/test-exclude.c [ARGMATCH_DIE_DECL]: Also declare the function.
+       Since it always exits, declare with the "noreturn" attribute.
+       * tests/test-argmatch.c: Likewise.
+
        tests: avoid 'const' discard warnings in mbsstr tests
        * tests/test-mbsstr1.c (main): Add "const" to avoid trivial warning.
        * tests/test-mbsstr2.c (main): Likewise.
index 807970e2cd9fa1007a0f91bd0bb18d99fda34905..bf4a22f92249c968f0fd0b3ae5e6c0d95be0af4d 100644 (file)
 /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
    thus must link with a definition of that function.  Provide it here.  */
 #ifdef ARGMATCH_DIE_DECL
+#ifndef __attribute__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
+#  define __attribute__(x) /* empty */
+# endif
+#endif
+
+#ifndef ATTRIBUTE_NORETURN
+# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+ARGMATCH_DIE_DECL ATTRIBUTE_NORETURN;
 ARGMATCH_DIE_DECL { exit (1); }
 #endif
 
index bffc62d20ada5b5e158cadf9bfe54089f918ed5b..0b8f9534eb391e1bcc9671cbc7fe117c24a05c86 100644 (file)
@@ -63,6 +63,17 @@ ARGMATCH_VERIFY (exclude_keywords, exclude_flags);
 /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
    thus must link with a definition of that function.  Provide it here.  */
 #ifdef ARGMATCH_DIE_DECL
+#ifndef __attribute__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
+#  define __attribute__(x) /* empty */
+# endif
+#endif
+
+#ifndef ATTRIBUTE_NORETURN
+# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+ARGMATCH_DIE_DECL ATTRIBUTE_NORETURN;
 ARGMATCH_DIE_DECL { exit (1); }
 #endif