From: Eric Blake Date: Wed, 13 Feb 2008 14:41:22 +0000 (-0700) Subject: Avoid shadowing warning and compile errors on Linux. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1ae289c18bbacb82a70f7e2ab759e2f4a09b03a;p=pspp Avoid shadowing warning and compile errors on Linux. * tests/test-quotearg.c [ENABLE_NLS]: Disable forwarding macros on Linux. (dcgettext): Define a stub, for Linux. (results_g, main): Avoid warnings. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 9059b3153f..155d5f7be8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-02-13 Jim Meyering + and Eric Blake + + Avoid shadowing warning and compile errors on Linux. + * tests/test-quotearg.c [ENABLE_NLS]: Disable + forwarding macros on Linux. + (dcgettext): Define a stub, for Linux. + (results_g, main): Avoid warnings. + 2008-02-12 Eric Blake Silence warning in last patch. diff --git a/tests/test-quotearg.c b/tests/test-quotearg.c index 86ffd7c5c1..c6db70ea4e 100644 --- a/tests/test-quotearg.c +++ b/tests/test-quotearg.c @@ -29,6 +29,12 @@ #include #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 /* 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