From: Paul Eggert Date: Fri, 23 Feb 2018 21:15:24 +0000 (-0800) Subject: nl_langinfo: pacify gcc -Wunused-function X-Git-Tag: v1.0~5727 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=88cfbe67e7d2e3a4f944f8dc23e88520eca3f6dd;p=gnulib.git nl_langinfo: pacify gcc -Wunused-function * lib/nl_langinfo.c (ctype_codeset): Do not define if REPLACE_NL_LANGINFO && !GNULIB_defined_CODESET, as it is unused in this case. Without this change, I got a diagnostic when building coreutils on Fedora 27 with gcc 7.3.1 20180130. --- diff --git a/ChangeLog b/ChangeLog index bc80d00999..fcbda12718 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2018-02-23 Paul Eggert + nl_langinfo: pacify gcc -Wunused-function + * lib/nl_langinfo.c (ctype_codeset): Do not define if + REPLACE_NL_LANGINFO && !GNULIB_defined_CODESET, as it is unused in + this case. Without this change, I got a diagnostic when building + coreutils on Fedora 27 with gcc 7.3.1 20180130. + same: pacify gcc -Wunused-variable * lib/same.c (same_nameat) [!CHECK_TRUNCATION]: Omit unused variable. diff --git a/lib/nl_langinfo.c b/lib/nl_langinfo.c index b93f7be25b..d98f034623 100644 --- a/lib/nl_langinfo.c +++ b/lib/nl_langinfo.c @@ -28,6 +28,7 @@ # include #endif +#if !REPLACE_NL_LANGINFO || GNULIB_defined_CODESET /* Return the codeset of the current locale, if this is easily deducible. Otherwise, return "". */ static char * @@ -64,7 +65,7 @@ ctype_codeset (void) } } -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* If setlocale is successful, it returns the number of the codepage, as a string. Otherwise, fall back on Windows API GetACP, which returns the locale's codepage as a number (although @@ -76,9 +77,10 @@ ctype_codeset (void) else sprintf (buf + 2, "%u", GetACP ()); codeset = memcpy (buf, "CP", 2); -#endif +# endif return codeset; } +#endif #if REPLACE_NL_LANGINFO