changeset 9702:11e548fe7d73

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. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Wed, 13 Feb 2008 07:41:22 -0700
parents 69f562691d3c
children e29f811d31c0
files ChangeLog tests/test-quotearg.c
diffstat 2 files changed, 26 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/tests/test-quotearg.c
+++ b/tests/test-quotearg.c
@@ -29,6 +29,12 @@
 #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 @@
   "", "\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 @@
 {
   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 @@
   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