Include config.h.
[gnulib.git] / lib / obstack.h
index 0176719..137e3ff 100644 (file)
@@ -103,6 +103,10 @@ Summary:
 #ifndef __OBSTACK_H__
 #define __OBSTACK_H__
 \f
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 /* We use subtraction of (char *)0 instead of casting to int
    because on word-addressable machines a simple cast to int
    may ignore the byte-within-word field of the pointer.  */
@@ -119,7 +123,7 @@ Summary:
    but in traditional C it is usually long.  If we are in ANSI C and
    don't already have ptrdiff_t get it.  */
 
-#if defined (__STDC__) && ! defined (offsetof)
+#if defined (__STDC__) && __STDC__ && ! defined (offsetof)
 #if defined (__GNUC__) && defined (IN_GCC)
 /* On Next machine, the system's stddef.h screws up if included
    after we have defined just ptrdiff_t, so include all of stddef.h.
@@ -132,12 +136,21 @@ Summary:
 #include <stddef.h>
 #endif
 
-#ifdef __STDC__
+#if defined (__STDC__) && __STDC__
 #define PTR_INT_TYPE ptrdiff_t
 #else
 #define PTR_INT_TYPE long
 #endif
 
+#if HAVE_STRING_H || STDC_HEADERS
+# include <string.h>
+# ifndef bcopy
+#  define bcopy(s, d, n) memcpy ((d), (s), (n))
+# endif
+#else /* HAVE_STRING_H || STDC_HEADERS */
+# include <strings.h>
+#endif   /* not (HAVE_STRING_H || STDC_HEADERS) */
+
 struct _obstack_chunk          /* Lives at front of each chunk. */
 {
   char  *limit;                        /* 1 past end of this chunk */
@@ -167,7 +180,7 @@ struct obstack              /* control current object in current chunk */
 
 /* Declare the external functions we use; they are in obstack.c.  */
 
-#ifdef __STDC__
+#if defined (__STDC__) && __STDC__
 extern void _obstack_newchunk (struct obstack *, int);
 extern void _obstack_free (struct obstack *, void *);
 extern int _obstack_begin (struct obstack *, int, int,
@@ -181,7 +194,7 @@ extern int _obstack_begin ();
 extern int _obstack_begin_1 ();
 #endif
 \f
-#ifdef __STDC__
+#if defined (__STDC__) && __STDC__
 
 /* Do the function-declarations after the structs
    but before defining the macros.  */
@@ -269,7 +282,10 @@ int obstack_chunk_size (struct obstack *obstack);
 #define obstack_blank_fast(h,n) ((h)->next_free += (n))
 \f
 #if defined (__GNUC__) && defined (__STDC__)
-#if __GNUC__ < 2
+/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
+   does not implement __extension__.  But that compiler doesn't define
+   __GNUC_MINOR__.  */
+#if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
 #define __extension__
 #endif
 
@@ -328,7 +344,7 @@ __extension__                                                               \
 /* These assume that the obstack alignment is good enough for pointers or ints,
    and that the data added so far to the current object
    shares that much alignment.  */
-   
+
 #define obstack_ptr_grow(OBSTACK,datum)                                        \
 __extension__                                                          \
 ({ struct obstack *__o = (OBSTACK);                                    \
@@ -492,7 +508,7 @@ __extension__                                                               \
   (h)->object_base = (h)->next_free,                                   \
   __INT_TO_PTR ((h)->temp)))
 
-#ifdef __STDC__
+#if defined (__STDC__) && __STDC__
 #define obstack_free(h,obj)                                            \
 ( (h)->temp = (char *)(obj) - (char *) (h)->chunk,                     \
   (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\