]> Savannah Git Hosting - gnulib.git/commitdiff
nl_langinfo: pacify gcc -Wunused-function
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Feb 2018 21:15:24 +0000 (13:15 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Feb 2018 21:16:14 +0000 (13:16 -0800)
* 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.

ChangeLog
lib/nl_langinfo.c

index bc80d00999bbb0dda419c741f90b5111f97d10c0..fcbda127183ad024f81c445727859833b52cea4e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2018-02-23  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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.
index b93f7be25be2df631fd02529efd3f94c3b5b4a93..d98f03462351c532b63d12d9050dea6c6ffb6a77 100644 (file)
@@ -28,6 +28,7 @@
 # include <stdio.h>
 #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