[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Bruno Haible
Subject: Re: SIZE_MAX
Date: Thu, 21 May 2009 15:15:29 +0200
User-agent: KMail/1.9.9

Simon Josefsson wrote:
> Bruno, what do you think about simply deprecating the size_max module?

This would cause problems in libintl. The intl/ directory, when shipped
as part of a package that used gettextize, should not create its own copy
of stdint.h. But the intl/ directory contains vasnprintf.c, which
depends on xsize.h, which needs a definition of SIZE_MAX. For this reason,
xsize.h arranges to get a correct SIZE_MAX in the cheapest possible way.

> I got a report about SIZE_MAX problems:
> In file included from ../gnutls_int.h:29,
>                  from opencdk.h:30,
>                  from kbnode.c:31:
> ../config.h:357:1: warning: "SIZE_MAX" redefined
> In file included from ./../gl/stdlib.h:52,
>                  from kbnode.c:28:
> ./../gl/stdint.h:473:1: warning: this is the location of the previous 
> definition

From looking at gnutls-2.6.6, it appears that the problem is that kbnode.c
includes <config.h>, then includes <stdlib.h> which includes <stdint.h>, and
then later indirectly includes <gnutls_int.h> which also includes <config.h>.
This is a bit unusual, but not wrong. gnulib should support this. I'm
applying this fix:

2009-05-21  Bruno Haible  <address@hidden>

        Avoid redefinition warnings for SIZE_MAX.
        * m4/size_max.m4 (gl_SIZE_MAX): Avoid redefining SIZE_MAX in config.h.
        Reported by Simon Josefsson.

--- m4/size_max.m4.orig 2009-05-21 15:07:21.000000000 +0200
+++ m4/size_max.m4      2009-05-21 15:07:02.000000000 +0200
@@ -1,4 +1,4 @@
-# size_max.m4 serial 8
+# size_max.m4 serial 9
 dnl Copyright (C) 2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -57,6 +57,15 @@
     AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
       [Define as the maximum value of type 'size_t', if the system doesn't 
define it.])
+  dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after
+  dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with
+  dnl #define by AC_DEFINE_UNQUOTED.
+[/* Define as the maximum value of type 'size_t', if the system doesn't define
+   it. */
+#ifndef SIZE_MAX
+# undef SIZE_MAX
 dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]