summaryrefslogtreecommitdiffstats
path: root/gettext-runtime/m4
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2014-07-16 15:19:30 +0900
committerDaiki Ueno <ueno@gnu.org>2014-07-16 15:34:56 +0900
commit0f8e2ccaa854fc17ac3d5412d944160aa2e78ea5 (patch)
tree075af05aaee2c11cb0a7e5d5d7b4e32ab386e361 /gettext-runtime/m4
parent5395556cb127387fd43368a1b9702179360f4f11 (diff)
downloadexternal_gettext-0f8e2ccaa854fc17ac3d5412d944160aa2e78ea5.zip
external_gettext-0f8e2ccaa854fc17ac3d5412d944160aa2e78ea5.tar.gz
external_gettext-0f8e2ccaa854fc17ac3d5412d944160aa2e78ea5.tar.bz2
intl: Consolidate fallback _GL_* macro definitions into intl.m4
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.
Diffstat (limited to 'gettext-runtime/m4')
-rw-r--r--gettext-runtime/m4/ChangeLog5
-rw-r--r--gettext-runtime/m4/intl.m429
2 files changed, 33 insertions, 1 deletions
diff --git a/gettext-runtime/m4/ChangeLog b/gettext-runtime/m4/ChangeLog
index 55dae9e..7db4c7e 100644
--- a/gettext-runtime/m4/ChangeLog
+++ b/gettext-runtime/m4/ChangeLog
@@ -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.
diff --git a/gettext-runtime/m4/intl.m4 b/gettext-runtime/m4/intl.m4
index 1fd396c..1747af9 100644
--- a/gettext-runtime/m4/intl.m4
+++ b/gettext-runtime/m4/intl.m4
@@ -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
+]))])