changeset 17721:3431efc25f3c

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.
author Assaf Gordon <assafgordon@gmail.com>
date Thu, 10 Jul 2014 19:42:02 +0100
parents 42ec2a5efa7a
children 20a6211f5d73
files ChangeLog lib/localename.c lib/localename.h
diffstat 3 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -2515,7 +2515,7 @@
 /* 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;
--- a/lib/localename.h
+++ b/lib/localename.h
@@ -85,8 +85,12 @@
       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
 }