diff lib/propername.c @ 14610:b427a1938336

use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE
author Jim Meyering <meyering@redhat.com>
date Sun, 24 Apr 2011 19:02:10 +0200
parents 97fc9a21a8fb
children 6ef4f1f39105
line wrap: on
line diff
--- a/lib/propername.c
+++ b/lib/propername.c
@@ -38,6 +38,14 @@
 #include "xalloc.h"
 #include "gettext.h"
 
+/* The attribute __const__ was added in gcc 2.95.  */
+#undef _GL_ATTRIBUTE_CONST
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
+#else
+# define _GL_ATTRIBUTE_CONST /* empty */
+#endif
+
 
 /* Tests whether STRING contains trim (SUB), starting and ending at word
    boundaries.
@@ -148,7 +156,7 @@
 
 /* Return the localization of NAME.  NAME is written in ASCII.  */
 
-const char *
+const char * _GL_ATTRIBUTE_CONST
 proper_name (const char *name)
 {
   /* See whether there is a translation.   */