Avoid shadowing warning and compile errors on Linux.
authorEric Blake <ebb9@byu.net>
Wed, 13 Feb 2008 14:41:22 +0000 (07:41 -0700)
committerEric Blake <ebb9@byu.net>
Wed, 13 Feb 2008 14:41:22 +0000 (07:41 -0700)
* tests/test-quotearg.c [ENABLE_NLS]: Disable <libintl.h>
forwarding macros on Linux.
(dcgettext): Define a stub, for Linux.
(results_g, main): Avoid warnings.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
tests/test-quotearg.c

index 9059b3153f19dfc692c98006c8f3297551f87453..155d5f7be8feded1a3784d17089f05fb73a2285b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-02-13  Jim Meyering  <meyering@redhat.com>
+       and Eric Blake  <ebb9@byu.net>
+
+       Avoid shadowing warning and compile errors on Linux.
+       * tests/test-quotearg.c [ENABLE_NLS]: Disable <libintl.h>
+       forwarding macros on Linux.
+       (dcgettext): Define a stub, for Linux.
+       (results_g, main): Avoid warnings.
+
 2008-02-12  Eric Blake  <ebb9@byu.net>
 
        Silence warning in last patch.
index 86ffd7c5c1b34361ba399deb62134305f694c9e7..c6db70ea4e8ec9ada77056e0c25a0c5d36eb7095 100644 (file)
 #include <string.h>
 
 #if ENABLE_NLS
+/* On Linux, gettext is optionally defined as a forwarding macro,
+   which would cause syntax errors in our definition below.  But on
+   platforms that require -lintl, we cannot #undef gettext, since we
+   want to provide the entry point libintl_gettext.  So we disable
+   optimizations to avoid the Linux macros.  */
+# undef __OPTIMIZE__
 # include <libintl.h>
 
 /* These quotes are borrowed from a pt_PT.utf8 translation.  */
@@ -66,7 +72,7 @@ static struct result_strings inputs = {
   "", "\0001\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b"
 };
 
-static struct result_groups results[] = {
+static struct result_groups results_g[] = {
   /* literal_quoting_style */
   { { "", "\0""1\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b" },
     { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b" },
@@ -231,10 +237,16 @@ dgettext (char const *d, char const *str)
 {
   return gettext (str);
 }
+
+char *
+dcgettext (char const *d, char const *str, int c)
+{
+  return gettext (str);
+}
 #endif /* ENABLE_NLS */
 
 int
-main (int argc, char **argv)
+main ()
 {
   int i;
 
@@ -244,9 +256,9 @@ main (int argc, char **argv)
   for (i = literal_quoting_style; i <= clocale_quoting_style; i++)
     {
       set_quoting_style (NULL, i);
-      compare_strings (use_quotearg_buffer, &results[i].group1);
-      compare_strings (use_quotearg, &results[i].group2);
-      compare_strings (use_quotearg_colon, &results[i].group3);
+      compare_strings (use_quotearg_buffer, &results_g[i].group1);
+      compare_strings (use_quotearg, &results_g[i].group2);
+      compare_strings (use_quotearg_colon, &results_g[i].group3);
     }
 
 #if ENABLE_NLS