]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix link errors related to C99-style extern inline.
authorDaiki Ueno <ueno@gnu.org>
Wed, 16 Jan 2013 08:08:28 +0000 (17:08 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 17 Jan 2013 09:10:37 +0000 (18:10 +0900)
After recent C99-style extern inline changes in gnulib, functions
defined in xsize.h are now declared as "extern inline".  That means
the libraries using those functions need to be linked to xsize.o.

ChangeLog
autogen.sh
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/Makefile.in
gettext-runtime/intl/xsize.c [new file with mode: 0644]
gettext-runtime/libasprintf/ChangeLog
gettext-runtime/libasprintf/Makefile.am
gettext-runtime/libasprintf/xsize.h [deleted file]

index f77a9d81775210924c8bf96d060cbd625dd4eaf9..2c0d25c62ef5232cad3a166d2dc722c18cb41fe9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-17  Daiki Ueno  <ueno@gnu.org>
+
+       Fix link errors related to C99-style extern inline.
+       Reported by Sam Thursfield <sam.thursfield@codethink.co.uk>.
+       * autogen.sh (GNULIB_MODULES_LIBASPRINTF): Add xsize.
+
 2012-12-25  Daiki Ueno  <ueno@gnu.org>
 
        * gettext-0.18.2 released.
index 33f909d06a3764ff38354103c439e0f31894d3a3..d1625cab96b7a1e91ff42d1117d60f4704d1de33 100755 (executable)
@@ -109,7 +109,7 @@ if ! $skip_gnulib; then
       alloca
       errno
       verify
-      extern-inline
+      xsize
     '
     GNULIB_MODULES_LIBASPRINTF_OTHER='
     '
index 8fe8f3d825659a23605e2b5b78979e7775c50d09..0fa70d93397a905e3c0bcd91b845c4e457071153 100644 (file)
@@ -1,3 +1,13 @@
+2013-01-17  Daiki Ueno  <ueno@gnu.org>
+
+       Fix link errors related to C99-style extern inline.
+       Reported by Sam Thursfield <sam.thursfield@codethink.co.uk>.
+       * Makefile.in (SOURCES): Add xsize.c.
+       (OBJECTS): Add xsize.$lo.
+       (xsize.lo): New rule.
+       (printf.$lo): Add xsize.c to dependencies.
+       * xsize.c: New file, imported from gnulib.
+
 2012-12-25  Daiki Ueno  <ueno@gnu.org>
 
        * gettext-0.18.2 released.
index 006d3b02a969e9a5a53aaaa14e3d658af0b60c43..449fdb1ef29737c886ad4c60d4d7b98bf49deba1 100644 (file)
@@ -158,6 +158,7 @@ SOURCES = \
   printf.c \
   setlocale.c \
   version.c \
+  xsize.c \
   osdep.c \
   os2compat.c \
   intl-exports.c \
@@ -190,6 +191,7 @@ OBJECTS = \
   printf.$lo \
   setlocale.$lo \
   version.$lo \
+  xsize.$lo \
   osdep.$lo \
   intl-compat.$lo
 OBJECTS_RES_yes = libintl.res.$lo
@@ -298,6 +300,8 @@ setlocale.lo: $(srcdir)/setlocale.c
        $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/setlocale.c
 version.lo: $(srcdir)/version.c
        $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/version.c
+xsize.lo: $(srcdir)/xsize.c
+       $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/xsize.c
 osdep.lo: $(srcdir)/osdep.c
        $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/osdep.c
 intl-compat.lo: $(srcdir)/intl-compat.c
@@ -585,7 +589,7 @@ dcigettext.$lo: $(srcdir)/eval-plural.h
 localcharset.$lo: $(srcdir)/localcharset.h
 bindtextdom.$lo dcigettext.$lo finddomain.$lo loadmsgcat.$lo localealias.$lo lock.$lo log.$lo: $(srcdir)/lock.h
 localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h
-printf.$lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-parse.h $(srcdir)/wprintf-parse.h $(srcdir)/xsize.h $(srcdir)/printf-parse.c $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h $(srcdir)/vasnprintf.c
+printf.$lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-parse.h $(srcdir)/wprintf-parse.h $(srcdir)/xsize.h $(srcdir)/xsize.c $(srcdir)/printf-parse.c $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h $(srcdir)/vasnprintf.c
 
 # A bison-2.1 generated plural.c includes <libintl.h> if ENABLE_NLS.
 PLURAL_DEPS_yes = libintl.h
diff --git a/gettext-runtime/intl/xsize.c b/gettext-runtime/intl/xsize.c
new file mode 100644 (file)
index 0000000..4b4914c
--- /dev/null
@@ -0,0 +1,3 @@
+#include <config.h>
+#define XSIZE_INLINE _GL_EXTERN_INLINE
+#include "xsize.h"
index 1299d16c0e2389b107e6e615b9a72b89cd11b14f..9b97cc6cad946e0fd5fc8d79a3f9c36febcee940 100644 (file)
@@ -1,3 +1,12 @@
+2013-01-17  Daiki Ueno  <ueno@gnu.org>
+
+       Fix link errors related to C99-style extern inline.
+       Reported by Sam Thursfield <sam.thursfield@codethink.co.uk>.
+       * Makefile.am (libasprintf_la_SOURCES): Add xsize.h and xsize.c.
+       (lib_asprintf_EXTRASOURCES): Remove xsize.h.
+       * xsize.h: Remove, replacing with the one from gnulib when
+       bootstrapping.
+
 2012-12-25  Daiki Ueno  <ueno@gnu.org>
 
        * gettext-0.18.2 released.
index 2aebbedf20a57226deede6071dfaf8d01ab8cafc..343ae4bd2cb6a5709e7f937b4b33bacde0f480e2 100644 (file)
@@ -49,13 +49,13 @@ lib_LTLIBRARIES = libasprintf.la
 noinst_LTLIBRARIES =
 
 libasprintf_la_SOURCES = \
+  xsize.h xsize.c \
   lib-asprintf.h lib-asprintf.c \
   autosprintf.h autosprintf.cc
 
 # Sources used only on platforms lacking vasprintf().
 lib_asprintf_EXTRASOURCES = \
   verify.h \
-  xsize.h \
   printf-args.h printf-args.c \
   printf-parse.h printf-parse.c \
   vasnprintf.h vasnprintf.c asnprintf.c \
diff --git a/gettext-runtime/libasprintf/xsize.h b/gettext-runtime/libasprintf/xsize.h
deleted file mode 100644 (file)
index 9abe1ce..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/* xsize.h -- Checked size_t computations.
-
-   Copyright (C) 2003, 2008-2012 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _XSIZE_H
-#define _XSIZE_H
-
-/* Get size_t.  */
-#include <stddef.h>
-
-/* Get SIZE_MAX.  */
-#include <limits.h>
-#if HAVE_STDINT_H
-# include <stdint.h>
-#endif
-
-_GL_INLINE_HEADER_BEGIN
-#ifndef XSIZE_INLINE
-# define XSIZE_INLINE _GL_INLINE
-#endif
-
-/* The size of memory objects is often computed through expressions of
-   type size_t. Example:
-      void* p = malloc (header_size + n * element_size).
-   These computations can lead to overflow.  When this happens, malloc()
-   returns a piece of memory that is way too small, and the program then
-   crashes while attempting to fill the memory.
-   To avoid this, the functions and macros in this file check for overflow.
-   The convention is that SIZE_MAX represents overflow.
-   malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
-   implementation that uses mmap --, it's recommended to use size_overflow_p()
-   or size_in_bounds_p() before invoking malloc().
-   The example thus becomes:
-      size_t size = xsum (header_size, xtimes (n, element_size));
-      void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
-*/
-
-/* Convert an arbitrary value >= 0 to type size_t.  */
-#define xcast_size_t(N) \
-  ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
-
-/* Sum of two sizes, with overflow check.  */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum (size_t size1, size_t size2)
-{
-  size_t sum = size1 + size2;
-  return (sum >= size1 ? sum : SIZE_MAX);
-}
-
-/* Sum of three sizes, with overflow check.  */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum3 (size_t size1, size_t size2, size_t size3)
-{
-  return xsum (xsum (size1, size2), size3);
-}
-
-/* Sum of four sizes, with overflow check.  */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
-{
-  return xsum (xsum (xsum (size1, size2), size3), size4);
-}
-
-/* Maximum of two sizes, with overflow check.  */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xmax (size_t size1, size_t size2)
-{
-  /* No explicit check is needed here, because for any n:
-     max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX.  */
-  return (size1 >= size2 ? size1 : size2);
-}
-
-/* Multiplication of a count with an element size, with overflow check.
-   The count must be >= 0 and the element size must be > 0.
-   This is a macro, not a function, so that it works correctly even
-   when N is of a wider type and N > SIZE_MAX.  */
-#define xtimes(N, ELSIZE) \
-  ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
-
-/* Check for overflow.  */
-#define size_overflow_p(SIZE) \
-  ((SIZE) == SIZE_MAX)
-/* Check against overflow.  */
-#define size_in_bounds_p(SIZE) \
-  ((SIZE) != SIZE_MAX)
-
-_GL_INLINE_HEADER_END
-
-#endif /* _XSIZE_H */