]> Savannah Git Hosting - gnulib.git/commitdiff
localename: avoid -Wsuggest-attribute={const,pure} warnings
authorAssaf Gordon <assafgordon@gmail.com>
Thu, 10 Jul 2014 18:42:02 +0000 (19:42 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 10 Jul 2014 19:11:33 +0000 (20:11 +0100)
* lib/localename.c (string_has): Tag internal function as pure.
* lib/localename.h (gl_locale_name_default): Tag extern declaration
as const when appropriate.

ChangeLog
lib/localename.c
lib/localename.h

index 4e8a5d334f364d6ad2d1977fc2311de415fba1ac..6c465134aa915466ad200b1934f8454e125c2e8a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-07-10  Assaf Gordon  <assafgordon@gmail.com>
+
+       localename: avoid -Wsuggest-attribute={const,pure} warnings
+       * lib/localename.c (string_has): Tag internal function as pure.
+       * lib/localename.h (gl_locale_name_default): Tag extern declaration
+       as const when appropriate.
+
 2014-07-10  Eli Zaretskii <eliz@gnu.org>
 
        nl_langinfo: Fix last change.
index faf3f925221b2092a7e1b54ecfc2188e92c1d2e9..9b6f67c55cb1c024d697ee85c5d939029b1512f5 100644 (file)
@@ -2515,7 +2515,7 @@ gl_locale_name_from_win32_LCID (LCID lcid)
 /* A hash function for NUL-terminated char* strings using
    the method described by Bruno Haible.
    See http://www.haible.de/bruno/hashfunc.html.  */
-static size_t
+static size_t _GL_ATTRIBUTE_PURE
 string_hash (const void *x)
 {
   const char *s = (const char *) x;
index c73dfa83a4d8cf9f31cf2194cec173783cd59823..687f1dd4fba8c293a0681b35ab002ec32c61f30e 100644 (file)
@@ -85,8 +85,12 @@ extern const char * gl_locale_name_environ (int category, const char *categoryna
       not require such a facility."
 
    The result must not be freed; it is statically allocated.  */
-extern const char * gl_locale_name_default (void);
-
+extern const char * gl_locale_name_default (void)
+#if !(HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE \
+      || defined _WIN32 || defined __WIN32__ || defined __CYGWIN__)
+  _GL_ATTRIBUTE_CONST
+#endif
+  ;
 
 #ifdef __cplusplus
 }