]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
intl: Consolidate fallback _GL_* macro definitions into intl.m4
authorDaiki Ueno <ueno@gnu.org>
Wed, 16 Jul 2014 06:19:30 +0000 (15:19 +0900)
committerDaiki Ueno <ueno@gnu.org>
Wed, 16 Jul 2014 06:34:56 +0000 (15:34 +0900)
We had defined _GL_* macros used by libintl itself in the corresponding
C files.  However, it will increase divergence between Gnulib and gettext.
This patch moves the fallback macro definitions into M4 and emit them only
when the project is not using Gnulib.

* gettext-runtime/m4/intl.m4 (gt_GL_ATTRIBUTE): New macro.
(AM_INTL_SUBDIR): Require gt_GL_ATTRIBUTE.
* gettext-runtime/intl/localename.c: Update from Gnulib.
2014-07-10  Assaf Gordon  <assafgordon@gmail.com>
    localename: avoid -Wsuggest-attribute={const,pure} warnings
    * lib/localename.c (string_hash): Tag internal function as pure.
* gettext-runtime/intl/xsize.c (XSIZE_INLINE): Remove _GL_UNUSED definition.
It will be set through intl.m4.
* Makefile.am (distcheck-hook): Add back localename.c check.

ChangeLog
Makefile.am
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/localename.c
gettext-runtime/intl/xsize.c
gettext-runtime/m4/ChangeLog
gettext-runtime/m4/intl.m4

index ed02dbad287b16bc91d675a4ff678779dc5c1227..4517273ef6a542b7d6b6917acdb0643e27d00301 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-07-16  Daiki Ueno  <ueno@gnu.org>
+
+       * Makefile.am (distcheck-hook): Add back localename.c check.
+
 2014-07-14  Daiki Ueno  <ueno@gnu.org>
 
        * gettext 0.19.2 released.
index c71b4ace01108422b51f2cf34a83d6bdef974923..22fe6144ddeb4fdec3c831cf8f8b2d36fd6274d4 100644 (file)
@@ -75,7 +75,7 @@ distcheck-hook:
        test "`sed 1,17d gettext-runtime/intl/config.charset | md5sum`" = "`sed 1,17d gettext-tools/gnulib-lib/config.charset | md5sum`"
        test "`sed 1,16d gettext-runtime/intl/localcharset.h | md5sum`" = "`sed 1,16d gettext-tools/gnulib-lib/localcharset.h | md5sum`"
        test "`sed 1,16d gettext-runtime/intl/localcharset.c | md5sum`" = "`sed 1,16d gettext-tools/gnulib-lib/localcharset.c | md5sum`"
-#      test "`sed 1,16d gettext-runtime/intl/localename.c | md5sum`" = "`sed 1,16d gettext-tools/gnulib-lib/localename.c | md5sum`"
+       test "`sed 1,16d gettext-runtime/intl/localename.c | md5sum`" = "`sed 1,16d gettext-tools/gnulib-lib/localename.c | md5sum`"
        test "`sed 1,15d gettext-runtime/intl/lock.h | md5sum`" = "`sed 1,15d gettext-tools/gnulib-lib/glthread/lock.h | md5sum`"
        test "`sed 1,15d gettext-runtime/intl/lock.c | md5sum`" = "`sed -e 1,15d -e 's,glthread/,,g' gettext-tools/gnulib-lib/glthread/lock.c | md5sum`"
        test "`sed 1,16d gettext-runtime/intl/verify.h | md5sum`" = "`sed 1,16d gettext-tools/gnulib-lib/verify.h | md5sum`"
index 9f44bf0ed95ff21f6366be7332859b4e9c5f7c68..c249299c75cf129af1226b9b27c2552fcd0f30c1 100644 (file)
@@ -1,3 +1,12 @@
+2014-07-16  Daiki Ueno  <ueno@gnu.org>
+
+       * localename.c: Update from Gnulib.
+       2014-07-10  Assaf Gordon  <assafgordon@gmail.com>
+            localename: avoid -Wsuggest-attribute={const,pure} warnings
+            * lib/localename.c (string_hash): Tag internal function as pure.
+       * xsize.c (XSIZE_INLINE): Remove _GL_UNUSED definition.  It will
+       be set through intl.m4.
+
 2014-07-14  Daiki Ueno  <ueno@gnu.org>
 
        * gettext 0.19.2 released.
index 108dd6f14562b8174232d1feace8c95ff00bd0fd..6cdd6cbfb61510f74bc3fb3a03923c35ea09691f 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 87d8add45d92419a23ee3bee98f6acff8ecf06d4..4b4914c2ca1f4d98015279b680e92294054687c2 100644 (file)
@@ -1,17 +1,3 @@
 #include <config.h>
-
-/* XSIZE_INLINE can be expanded to _GL_UNUSED, which is defined through
-   a gnulib-tool magic.  Define it here so not to require Gnulib.  */
-#if defined IN_LIBINTL && !defined GL_UNUSED
-/* Define as a marker that can be attached to declarations that might not
-    be used.  This helps to reduce warnings, such as from
-    GCC -Wunused-parameter.  */
-# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-#  define _GL_UNUSED __attribute__ ((__unused__))
-# else
-#  define _GL_UNUSED
-# endif
-#endif
-
 #define XSIZE_INLINE _GL_EXTERN_INLINE
 #include "xsize.h"
index 55dae9ec3c3e706ecabfb0e2fbfd3c1e8915c8bd..7db4c7eada8f3f5faf6efe1d7943a7b90c4d80b5 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-16  Daiki Ueno  <ueno@gnu.org>
+
+       * intl.m4 (gt_GL_ATTRIBUTE): New macro.
+       (AM_INTL_SUBDIR): Require gt_GL_ATTRIBUTE.
+
 2014-07-14  Daiki Ueno  <ueno@gnu.org>
 
        * gettext 0.19.2 released.
index 1fd396c18d62be9e99c2c7a607b04a0d0ad81f6e..1747af9097bfaafeba8390d7971082f0b9d7c559 100644 (file)
@@ -1,4 +1,4 @@
-# intl.m4 serial 26 (gettext-0.19)
+# intl.m4 serial 27 (gettext-0.19)
 dnl Copyright (C) 1995-2014 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -43,6 +43,7 @@ AC_DEFUN([AM_INTL_SUBDIR],
   AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl
   AC_REQUIRE([gt_INTL_MACOSX])dnl
   AC_REQUIRE([gl_EXTERN_INLINE])dnl
+  AC_REQUIRE([gt_GL_ATTRIBUTE])dnl
 
   dnl Support for automake's --enable-silent-rules.
   case "$enable_silent_rules" in
@@ -269,3 +270,29 @@ changequote([,])dnl
     INTLBISON=:
   fi
 ])
+
+dnl Copies _GL_UNUSED and _GL_ATTRIBUTE_PURE definitions from
+dnl gnulib-common.m4 as a fallback, if the project isn't using Gnulib.
+AC_DEFUN([gt_GL_ATTRIBUTE], [
+  m4_ifndef([gl_[]COMMON],
+    AH_VERBATIM([gt_gl_attribute],
+[/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
+#ifndef _GL_UNUSED
+# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+#  define _GL_UNUSED __attribute__ ((__unused__))
+# else
+#  define _GL_UNUSED
+# endif
+#endif
+
+/* The __pure__ attribute was added in gcc 2.96.  */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+]))])