From: Daiki Ueno Date: Wed, 16 Jan 2013 08:08:28 +0000 (+0900) Subject: Fix link errors related to C99-style extern inline. X-Git-Tag: v0.18.3~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb1ef102cceb2eeb86d48c757cb76a1964f28f82;p=thirdparty%2Fgettext.git Fix link errors related to C99-style extern inline. 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. --- diff --git a/ChangeLog b/ChangeLog index f77a9d817..2c0d25c62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-01-17 Daiki Ueno + + Fix link errors related to C99-style extern inline. + Reported by Sam Thursfield . + * autogen.sh (GNULIB_MODULES_LIBASPRINTF): Add xsize. + 2012-12-25 Daiki Ueno * gettext-0.18.2 released. diff --git a/autogen.sh b/autogen.sh index 33f909d06..d1625cab9 100755 --- a/autogen.sh +++ b/autogen.sh @@ -109,7 +109,7 @@ if ! $skip_gnulib; then alloca errno verify - extern-inline + xsize ' GNULIB_MODULES_LIBASPRINTF_OTHER=' ' diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 8fe8f3d82..0fa70d933 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,13 @@ +2013-01-17 Daiki Ueno + + Fix link errors related to C99-style extern inline. + Reported by Sam Thursfield . + * 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 * gettext-0.18.2 released. diff --git a/gettext-runtime/intl/Makefile.in b/gettext-runtime/intl/Makefile.in index 006d3b02a..449fdb1ef 100644 --- a/gettext-runtime/intl/Makefile.in +++ b/gettext-runtime/intl/Makefile.in @@ -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 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 index 000000000..4b4914c2c --- /dev/null +++ b/gettext-runtime/intl/xsize.c @@ -0,0 +1,3 @@ +#include +#define XSIZE_INLINE _GL_EXTERN_INLINE +#include "xsize.h" diff --git a/gettext-runtime/libasprintf/ChangeLog b/gettext-runtime/libasprintf/ChangeLog index 1299d16c0..9b97cc6ca 100644 --- a/gettext-runtime/libasprintf/ChangeLog +++ b/gettext-runtime/libasprintf/ChangeLog @@ -1,3 +1,12 @@ +2013-01-17 Daiki Ueno + + Fix link errors related to C99-style extern inline. + Reported by Sam Thursfield . + * 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 * gettext-0.18.2 released. diff --git a/gettext-runtime/libasprintf/Makefile.am b/gettext-runtime/libasprintf/Makefile.am index 2aebbedf2..343ae4bd2 100644 --- a/gettext-runtime/libasprintf/Makefile.am +++ b/gettext-runtime/libasprintf/Makefile.am @@ -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 index 9abe1cefd..000000000 --- a/gettext-runtime/libasprintf/xsize.h +++ /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 . */ - -#ifndef _XSIZE_H -#define _XSIZE_H - -/* Get size_t. */ -#include - -/* Get SIZE_MAX. */ -#include -#if HAVE_STDINT_H -# include -#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 */