bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] obstack port to hosts with stiff alignment requirements on


From: Paul Eggert
Subject: [Bug-gnulib] obstack port to hosts with stiff alignment requirements on uintmax_t
Date: Wed, 11 Aug 2004 15:42:34 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

I installed this, merged from coreutils.  It's mostly a theoretical patch.

2004-08-11  Paul Eggert  <address@hidden>

        * modules/obstack (Files): Add m4/inttypes_h.m4, m4/stdint_h.m4,
        m4/uintmax_t.m4.
        * lib/obstack.c: Include <inttypes.h> and <stdint.h> if available.
        (union fooround): Use uintmax_t, not long int.
        The rest is a merge from libc:
        [defined _LIBC]: Include <shlib-compat.h>.
        (_obstack) [defined _LIBC]: Remove after 2.3.4.
        * m4/obstack.m4 (gl_PREREQ_OBSTACK): Require
        gl_AC_HEADER_INTTYPES_H, gl_AC_HEADER_STDINT_H, gl_AC_TYPE_UINTMAX_T.

Index: lib/obstack.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/obstack.c,v
retrieving revision 1.28
diff -p -u -r1.28 obstack.c
--- lib/obstack.c       10 Aug 2004 05:16:53 -0000      1.28
+++ lib/obstack.c       11 Aug 2004 22:39:10 -0000
@@ -24,6 +24,7 @@
 
 #ifdef _LIBC
 # include <obstack.h>
+# include <shlib-compat.h>
 #else
 # include "obstack.h"
 #endif
@@ -59,10 +60,17 @@
 #ifndef ELIDE_CODE
 
 
+# if HAVE_INTTYPES_H
+#  include <inttypes.h>
+# endif
+# if HAVE_STDINT_H || defined _LIBC
+#  include <stdint.h>
+# endif
+
 /* Determine default alignment.  */
 union fooround
 {
-  long int i;
+  uintmax_t i;
   long double d;
   void *p;
 };
@@ -103,10 +111,13 @@ int obstack_exit_failure = EXIT_FAILURE;
 # endif
 
 # ifdef _LIBC
+#  if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
 /* A looong time ago (before 1994, anyway; we're not sure) this global variable
    was used by non-GNU-C macros to avoid multiple evaluation.  The GNU C
    library still exports it because somebody might use it.  */
-struct obstack *_obstack;
+struct obstack *_obstack_compat;
+compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0);
+#  endif
 # endif
 
 /* Define a macro that either calls functions with the traditional malloc/free
Index: m4/obstack.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/obstack.m4,v
retrieving revision 1.4
diff -p -u -r1.4 obstack.m4
--- m4/obstack.m4       9 Sep 2003 23:00:43 -0000       1.4
+++ m4/obstack.m4       11 Aug 2004 22:39:10 -0000
@@ -1,5 +1,5 @@
-# obstack.m4 serial 2
-dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# obstack.m4 serial 3
+dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -16,4 +16,10 @@ AC_DEFUN([gl_OBSTACK],
 ])
 
 # Prerequisites of lib/obstack.c.
-AC_DEFUN([gl_PREREQ_OBSTACK], [:])
+AC_DEFUN([gl_PREREQ_OBSTACK],
+[
+  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+  AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])
+  :
+])
Index: modules/obstack
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/obstack,v
retrieving revision 1.6
diff -p -u -r1.6 obstack
--- modules/obstack     24 Jan 2004 07:22:34 -0000      1.6
+++ modules/obstack     11 Aug 2004 22:39:10 -0000
@@ -4,7 +4,10 @@ Memory allocation, optimized for stack-l
 Files:
 lib/obstack.h
 lib/obstack.c
+m4/inttypes_h.m4
 m4/obstack.m4
+m4/stdint_h.m4
+m4/uintmax_t.m4
 
 Depends-on:
 gettext




reply via email to

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