OSDN Git Service

* toplev.c (flag_exceptions): Default value is 2.
[pf3gnuchains/gcc-fork.git] / gcc / obstack.h
1 /* obstack.h - object stack macros
2    Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
17
18 /* Summary:
19
20 All the apparent functions defined here are macros. The idea
21 is that you would use these pre-tested macros to solve a
22 very specific set of problems, and they would run fast.
23 Caution: no side-effects in arguments please!! They may be
24 evaluated MANY times!!
25
26 These macros operate a stack of objects.  Each object starts life
27 small, and may grow to maturity.  (Consider building a word syllable
28 by syllable.)  An object can move while it is growing.  Once it has
29 been "finished" it never changes address again.  So the "top of the
30 stack" is typically an immature growing object, while the rest of the
31 stack is of mature, fixed size and fixed address objects.
32
33 These routines grab large chunks of memory, using a function you
34 supply, called `obstack_chunk_alloc'.  On occasion, they free chunks,
35 by calling `obstack_chunk_free'.  You must define them and declare
36 them before using any obstack macros.
37
38 Each independent stack is represented by a `struct obstack'.
39 Each of the obstack macros expects a pointer to such a structure
40 as the first argument.
41
42 One motivation for this package is the problem of growing char strings
43 in symbol tables.  Unless you are "fascist pig with a read-only mind"
44 --Gosper's immortal quote from HAKMEM item 154, out of context--you
45 would not like to put any arbitrary upper limit on the length of your
46 symbols.
47
48 In practice this often means you will build many short symbols and a
49 few long symbols.  At the time you are reading a symbol you don't know
50 how long it is.  One traditional method is to read a symbol into a
51 buffer, realloc()ating the buffer every time you try to read a symbol
52 that is longer than the buffer.  This is beaut, but you still will
53 want to copy the symbol from the buffer to a more permanent
54 symbol-table entry say about half the time.
55
56 With obstacks, you can work differently.  Use one obstack for all symbol
57 names.  As you read a symbol, grow the name in the obstack gradually.
58 When the name is complete, finalize it.  Then, if the symbol exists already,
59 free the newly read name.
60
61 The way we do this is to take a large chunk, allocating memory from
62 low addresses.  When you want to build a symbol in the chunk you just
63 add chars above the current "high water mark" in the chunk.  When you
64 have finished adding chars, because you got to the end of the symbol,
65 you know how long the chars are, and you can create a new object.
66 Mostly the chars will not burst over the highest address of the chunk,
67 because you would typically expect a chunk to be (say) 100 times as
68 long as an average object.
69
70 In case that isn't clear, when we have enough chars to make up
71 the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
72 so we just point to it where it lies.  No moving of chars is
73 needed and this is the second win: potentially long strings need
74 never be explicitly shuffled. Once an object is formed, it does not
75 change its address during its lifetime.
76
77 When the chars burst over a chunk boundary, we allocate a larger
78 chunk, and then copy the partly formed object from the end of the old
79 chunk to the beginning of the new larger chunk.  We then carry on
80 accreting characters to the end of the object as we normally would.
81
82 A special macro is provided to add a single char at a time to a
83 growing object.  This allows the use of register variables, which
84 break the ordinary 'growth' macro.
85
86 Summary:
87         We allocate large chunks.
88         We carve out one object at a time from the current chunk.
89         Once carved, an object never moves.
90         We are free to append data of any size to the currently
91           growing object.
92         Exactly one object is growing in an obstack at any one time.
93         You can run one obstack per control block.
94         You may have as many control blocks as you dare.
95         Because of the way we do it, you can `unwind' an obstack
96           back to a previous state. (You may remove objects much
97           as you would with a stack.)
98 */
99
100
101 /* Don't do the contents of this file more than once.  */
102
103 #ifndef __OBSTACK_H__
104 #define __OBSTACK_H__
105 \f
106 /* We use subtraction of (char *) 0 instead of casting to int
107    because on word-addressable machines a simple cast to int
108    may ignore the byte-within-word field of the pointer.  */
109
110 #ifndef __PTR_TO_INT
111 #define __PTR_TO_INT(P) ((P) - (char *) 0)
112 #endif
113
114 #ifndef __INT_TO_PTR
115 #define __INT_TO_PTR(P) ((P) + (char *) 0)
116 #endif
117
118 /* We need the type of the resulting object.  In ANSI C it is ptrdiff_t
119    but in traditional C it is usually long.  If we are in ANSI C and
120    don't already have ptrdiff_t get it.  */
121
122 #if defined (__STDC__) && __STDC__ && ! defined (offsetof)
123 #if defined (__GNUC__) && defined (IN_GCC)
124 /* On Next machine, the system's stddef.h screws up if included
125    after we have defined just ptrdiff_t, so include all of stddef.h.
126    Otherwise, define just ptrdiff_t, which is all we need.  */
127 #ifndef __NeXT__
128 #define __need_ptrdiff_t
129 #endif
130 #endif
131
132 #include <stddef.h>
133 #endif
134
135 #if defined (__STDC__) && __STDC__
136 #define PTR_INT_TYPE ptrdiff_t
137 #else
138 #define PTR_INT_TYPE long
139 #endif
140
141 struct _obstack_chunk           /* Lives at front of each chunk. */
142 {
143   char  *limit;                 /* 1 past end of this chunk */
144   struct _obstack_chunk *prev;  /* address of prior chunk or NULL */
145   char  contents[4];            /* objects begin here */
146 };
147
148 struct obstack          /* control current object in current chunk */
149 {
150   long  chunk_size;             /* preferred size to allocate chunks in */
151   struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
152   char  *object_base;           /* address of object we are building */
153   char  *next_free;             /* where to add next char to current object */
154   char  *chunk_limit;           /* address of char after current chunk */
155   PTR_INT_TYPE temp;            /* Temporary for some macros.  */
156   int   alignment_mask;         /* Mask of alignment for each object. */
157 #if defined (__STDC__) && __STDC__
158   /* These prototypes vary based on `use_extra_arg', and we use
159      casts to the prototypeless function type in all assignments,
160      but having prototypes here quiets -Wstrict-prototypes.  */
161   struct _obstack_chunk *(*chunkfun) (void *, long);
162   void (*freefun) (void *, struct _obstack_chunk *);
163   void *extra_arg;              /* first arg for chunk alloc/dealloc funcs */
164 #else
165   struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk.  */
166   void (*freefun) ();           /* User's function to free a chunk.  */
167   char *extra_arg;              /* first arg for chunk alloc/dealloc funcs */
168 #endif
169   unsigned use_extra_arg:1;     /* chunk alloc/dealloc funcs take extra arg */
170   unsigned maybe_empty_object:1;/* There is a possibility that the current
171                                    chunk contains a zero-length object.  This
172                                    prevents freeing the chunk if we allocate
173                                    a bigger chunk to replace it. */
174   unsigned alloc_failed:1;      /* chunk alloc func returned 0 */
175 };
176
177 /* Declare the external functions we use; they are in obstack.c.  */
178
179 #if defined (__STDC__) && __STDC__
180 extern void _obstack_newchunk (struct obstack *, int);
181 extern void _obstack_free (struct obstack *, void *);
182 extern int _obstack_begin (struct obstack *, int, int,
183                             void *(*) (long), void (*) (void *));
184 extern int _obstack_begin_1 (struct obstack *, int, int,
185                              void *(*) (void *, long),
186                              void (*) (void *, void *), void *);
187 #else
188 extern void _obstack_newchunk ();
189 extern void _obstack_free ();
190 extern int _obstack_begin ();
191 extern int _obstack_begin_1 ();
192 #endif
193 \f
194 #if defined (__STDC__) && __STDC__
195
196 /* Do the function-declarations after the structs
197    but before defining the macros.  */
198
199 void obstack_init (struct obstack *obstack);
200
201 void * obstack_alloc (struct obstack *obstack, int size);
202
203 void * obstack_copy (struct obstack *obstack, void *address, int size);
204 void * obstack_copy0 (struct obstack *obstack, void *address, int size);
205
206 void obstack_free (struct obstack *obstack, void *block);
207
208 void obstack_blank (struct obstack *obstack, int size);
209
210 void obstack_grow (struct obstack *obstack, void *data, int size);
211 void obstack_grow0 (struct obstack *obstack, void *data, int size);
212
213 void obstack_1grow (struct obstack *obstack, int data_char);
214 void obstack_ptr_grow (struct obstack *obstack, void *data);
215 void obstack_int_grow (struct obstack *obstack, int data);
216
217 void * obstack_finish (struct obstack *obstack);
218
219 int obstack_object_size (struct obstack *obstack);
220
221 int obstack_room (struct obstack *obstack);
222 void obstack_1grow_fast (struct obstack *obstack, int data_char);
223 void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
224 void obstack_int_grow_fast (struct obstack *obstack, int data);
225 void obstack_blank_fast (struct obstack *obstack, int size);
226
227 void * obstack_base (struct obstack *obstack);
228 void * obstack_next_free (struct obstack *obstack);
229 int obstack_alignment_mask (struct obstack *obstack);
230 int obstack_chunk_size (struct obstack *obstack);
231
232 #endif /* __STDC__ */
233
234 /* Non-ANSI C cannot really support alternative functions for these macros,
235    so we do not declare them.  */
236 \f
237 /* Pointer to beginning of object being allocated or to be allocated next.
238    Note that this might not be the final address of the object
239    because a new chunk might be needed to hold the final size.  */
240
241 #define obstack_base(h) ((h)->alloc_failed ? 0 : (h)->object_base)
242
243 /* Size for allocating ordinary chunks.  */
244
245 #define obstack_chunk_size(h) ((h)->chunk_size)
246
247 /* Pointer to next byte not yet allocated in current chunk.  */
248
249 #define obstack_next_free(h)    ((h)->alloc_failed ? 0 : (h)->next_free)
250
251 /* Mask specifying low bits that should be clear in address of an object.  */
252
253 #define obstack_alignment_mask(h) ((h)->alignment_mask)
254
255 /* To prevent prototype warnings provide complete argument list in
256    standard C version.  */
257 #if defined (__STDC__) && __STDC__
258
259 #define obstack_init(h) \
260   _obstack_begin ((h), 0, 0, \
261                   (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
262
263 #define obstack_begin(h, size) \
264   _obstack_begin ((h), (size), 0, \
265                   (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
266
267 #define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
268   _obstack_begin ((h), (size), (alignment), \
269                     (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun))
270
271 #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
272   _obstack_begin_1 ((h), (size), (alignment), \
273                     (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun), (arg))
274
275 #define obstack_chunkfun(h, newchunkfun) \
276   ((h) -> chunkfun = (struct _obstack_chunk *(*)(long)) (newchunkfun))
277
278 #define obstack_freefun(h, newfreefun) \
279   ((h) -> freefun = (void (*)(void *)) (newfreefun))
280
281 #else
282
283 #define obstack_init(h) \
284   _obstack_begin ((h), 0, 0, \
285                   (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
286
287 #define obstack_begin(h, size) \
288   _obstack_begin ((h), (size), 0, \
289                   (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
290
291 #define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
292   _obstack_begin ((h), (size), (alignment), \
293                     (void *(*) ()) (chunkfun), (void (*) ()) (freefun))
294
295 #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
296   _obstack_begin_1 ((h), (size), (alignment), \
297                     (void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg))
298
299 #define obstack_chunkfun(h, newchunkfun) \
300   ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
301
302 #define obstack_freefun(h, newfreefun) \
303   ((h) -> freefun = (void (*)()) (newfreefun))
304
305 #endif
306
307 #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
308
309 #define obstack_blank_fast(h,n) ((h)->next_free += (n))
310 \f
311 #if defined (__GNUC__) && defined (__STDC__) && __STDC__
312 /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
313    does not implement __extension__.  But that compiler doesn't define
314    __GNUC_MINOR__.  */
315 #if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
316 #define __extension__
317 #endif
318
319 /* For GNU C, if not -traditional,
320    we can define these macros to compute all args only once
321    without using a global variable.
322    Also, we can avoid using the `temp' slot, to make faster code.  */
323
324 #define obstack_object_size(OBSTACK)                                    \
325   __extension__                                                         \
326   ({ struct obstack *__o = (OBSTACK);                                   \
327      __o->alloc_failed ? 0 :                                            \
328      (unsigned) (__o->next_free - __o->object_base); })
329
330 #define obstack_room(OBSTACK)                                           \
331   __extension__                                                         \
332   ({ struct obstack *__o = (OBSTACK);                                   \
333      (unsigned) (__o->chunk_limit - __o->next_free); })
334
335 #define obstack_empty_p(OBSTACK)                                        \
336   __extension__                                                         \
337   ({ struct obstack *__o = (OBSTACK);                                   \
338      (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
339
340 #define obstack_grow(OBSTACK,where,length)                              \
341 __extension__                                                           \
342 ({ struct obstack *__o = (OBSTACK);                                     \
343    int __len = (length);                                                \
344    if (__o->next_free + __len > __o->chunk_limit)                       \
345      _obstack_newchunk (__o, __len);                                    \
346    if (!__o->alloc_failed)                                              \
347      {                                                                  \
348         bcopy ((char *) (where), __o->next_free, __len);                \
349         __o->next_free += __len;                                        \
350      }                                                                  \
351    (void) 0; })
352
353 #define obstack_grow0(OBSTACK,where,length)                             \
354 __extension__                                                           \
355 ({ struct obstack *__o = (OBSTACK);                                     \
356    int __len = (length);                                                \
357    if (__o->next_free + __len + 1 > __o->chunk_limit)                   \
358      _obstack_newchunk (__o, __len + 1);                                \
359    if (!__o->alloc_failed)                                              \
360      {                                                                  \
361        bcopy ((char *) (where), __o->next_free, __len);                 \
362        __o->next_free += __len;                                         \
363        *(__o->next_free)++ = 0;                                         \
364      }                                                                  \
365    (void) 0; })
366
367 #define obstack_1grow(OBSTACK,datum)                                    \
368 __extension__                                                           \
369 ({ struct obstack *__o = (OBSTACK);                                     \
370    if (__o->next_free + 1 > __o->chunk_limit)                           \
371      _obstack_newchunk (__o, 1);                                        \
372    if (!__o->alloc_failed)                                              \
373      *(__o->next_free)++ = (datum);                                     \
374    (void) 0; })
375
376 /* These assume that the obstack alignment is good enough for pointers or ints,
377    and that the data added so far to the current object
378    shares that much alignment.  */
379
380 #define obstack_ptr_grow(OBSTACK,datum)                                 \
381 __extension__                                                           \
382 ({ struct obstack *__o = (OBSTACK);                                     \
383    if (__o->next_free + sizeof (void *) > __o->chunk_limit)             \
384      _obstack_newchunk (__o, sizeof (void *));                          \
385    if (!__o->alloc_failed)                                              \
386      *((void **)__o->next_free)++ = ((void *)datum);                    \
387    (void) 0; })
388
389 #define obstack_int_grow(OBSTACK,datum)                                 \
390 __extension__                                                           \
391 ({ struct obstack *__o = (OBSTACK);                                     \
392    if (__o->next_free + sizeof (int) > __o->chunk_limit)                \
393      _obstack_newchunk (__o, sizeof (int));                             \
394    if (!__o->alloc_failed)                                              \
395      *((int *)__o->next_free)++ = ((int)datum);                         \
396    (void) 0; })
397
398 #define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr)
399 #define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint)
400
401 #define obstack_blank(OBSTACK,length)                                   \
402 __extension__                                                           \
403 ({ struct obstack *__o = (OBSTACK);                                     \
404    int __len = (length);                                                \
405    if (__o->chunk_limit - __o->next_free < __len)                       \
406      _obstack_newchunk (__o, __len);                                    \
407    if (!__o->alloc_failed)                                              \
408      __o->next_free += __len;                                           \
409    (void) 0; })
410
411 #define obstack_alloc(OBSTACK,length)                                   \
412 __extension__                                                           \
413 ({ struct obstack *__h = (OBSTACK);                                     \
414    obstack_blank (__h, (length));                                       \
415    obstack_finish (__h); })
416
417 #define obstack_copy(OBSTACK,where,length)                              \
418 __extension__                                                           \
419 ({ struct obstack *__h = (OBSTACK);                                     \
420    obstack_grow (__h, (where), (length));                               \
421    obstack_finish (__h); })
422
423 #define obstack_copy0(OBSTACK,where,length)                             \
424 __extension__                                                           \
425 ({ struct obstack *__h = (OBSTACK);                                     \
426    obstack_grow0 (__h, (where), (length));                              \
427    obstack_finish (__h); })
428
429 /* The local variable is named __o1 to avoid a name conflict
430    when obstack_blank is called.  */
431 #define obstack_finish(OBSTACK)                                         \
432 __extension__                                                           \
433 ({ struct obstack *__o1 = (OBSTACK);                                    \
434    void *value;                                                         \
435    if (__o1->alloc_failed)                                              \
436      value = 0;                                                         \
437    else                                                                 \
438      {                                                                  \
439        value = (void *) __o1->object_base;                              \
440        if (__o1->next_free == value)                                    \
441          __o1->maybe_empty_object = 1;                                  \
442        __o1->next_free                                                  \
443          = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
444                          & ~ (__o1->alignment_mask));                   \
445        if (__o1->next_free - (char *)__o1->chunk                        \
446            > __o1->chunk_limit - (char *)__o1->chunk)                   \
447          __o1->next_free = __o1->chunk_limit;                           \
448        __o1->object_base = __o1->next_free;                             \
449       }                                                                 \
450    value; })
451
452 #define obstack_free(OBSTACK, OBJ)                                      \
453 __extension__                                                           \
454 ({ struct obstack *__o = (OBSTACK);                                     \
455    void *__obj = (OBJ);                                                 \
456    if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit)  \
457      __o->next_free = __o->object_base = __obj;                         \
458    else (obstack_free) (__o, __obj); })
459 \f
460 #else /* not __GNUC__ or not __STDC__ */
461
462 #define obstack_object_size(h) \
463  (unsigned) ((h)->alloc_failed ? 0 : (h)->next_free - (h)->object_base)
464
465 #define obstack_room(h)         \
466  (unsigned) ((h)->chunk_limit - (h)->next_free)
467
468 #define obstack_empty_p(h) \
469  ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
470
471 /* Note that the call to _obstack_newchunk is enclosed in (..., 0)
472    so that we can avoid having void expressions
473    in the arms of the conditional expression.
474    Casting the third operand to void was tried before,
475    but some compilers won't accept it.  */
476
477 #define obstack_grow(h,where,length)                                    \
478 ( (h)->temp = (length),                                                 \
479   (((h)->next_free + (h)->temp > (h)->chunk_limit)                      \
480    ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                      \
481   ((h)->alloc_failed ? 0 :                                              \
482   (bcopy ((char *) (where), (h)->next_free, (h)->temp),                 \
483   (h)->next_free += (h)->temp)))
484
485 #define obstack_grow0(h,where,length)                                   \
486 ( (h)->temp = (length),                                                 \
487   (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit)                  \
488    ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0),                  \
489   ((h)->alloc_failed ? 0 :                                              \
490   (bcopy ((char *) (where), (h)->next_free, (h)->temp),                 \
491   (h)->next_free += (h)->temp,                                          \
492   *((h)->next_free)++ = 0)))
493
494 #define obstack_1grow(h,datum)                                          \
495 ( (((h)->next_free + 1 > (h)->chunk_limit)                              \
496    ? (_obstack_newchunk ((h), 1), 0) : 0),                              \
497  ((h)->alloc_failed ? 0 :                                               \
498   (*((h)->next_free)++ = (datum))))
499
500 #define obstack_ptr_grow(h,datum)                                       \
501 ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit)                \
502    ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0),                \
503   ((h)->alloc_failed ? 0 :                                              \
504   (*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum))))
505
506 #define obstack_int_grow(h,datum)                                       \
507 ( (((h)->next_free + sizeof (int) > (h)->chunk_limit)                   \
508    ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0),                   \
509   ((h)->alloc_failed ? 0 :                                              \
510   (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum))))
511
512 #define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr)
513 #define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint)
514
515 #define obstack_blank(h,length)                                         \
516 ( (h)->temp = (length),                                                 \
517   (((h)->chunk_limit - (h)->next_free < (h)->temp)                      \
518    ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                      \
519   ((h)->alloc_failed ? 0 :                                              \
520   ((h)->next_free += (h)->temp)))
521
522 #define obstack_alloc(h,length)                                         \
523  (obstack_blank ((h), (length)), obstack_finish ((h)))
524
525 #define obstack_copy(h,where,length)                                    \
526  (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
527
528 #define obstack_copy0(h,where,length)                                   \
529  (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
530
531 #define obstack_finish(h)                                               \
532 ( (h)->alloc_failed ? 0 :                                               \
533   (((h)->next_free == (h)->object_base                                  \
534    ? (((h)->maybe_empty_object = 1), 0)                                 \
535    : 0),                                                                \
536   (h)->temp = __PTR_TO_INT ((h)->object_base),                          \
537   (h)->next_free                                                        \
538     = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
539                     & ~ ((h)->alignment_mask)),                         \
540   (((h)->next_free - (char *) (h)->chunk                                        \
541     > (h)->chunk_limit - (char *) (h)->chunk)                           \
542    ? ((h)->next_free = (h)->chunk_limit) : 0),                          \
543   (h)->object_base = (h)->next_free,                                    \
544   __INT_TO_PTR ((h)->temp)))
545
546 #if defined (__STDC__) && __STDC__
547 #define obstack_free(h,obj)                                             \
548 ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                     \
549   (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
550    ? (int) ((h)->next_free = (h)->object_base                           \
551             = (h)->temp + (char *) (h)->chunk)                          \
552    : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
553 #else
554 #define obstack_free(h,obj)                                             \
555 ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                     \
556   (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
557    ? (int) ((h)->next_free = (h)->object_base                           \
558             = (h)->temp + (char *) (h)->chunk)                          \
559    : (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
560 #endif
561
562 #endif /* not __GNUC__ or not __STDC__ */
563
564 #endif /* not __OBSTACK_H__ */