/[bison]/bison/lib/obstack.h
ViewVC logotype

Diff of /bison/lib/obstack.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by eggert, Fri Oct 26 07:26:00 2001 UTC revision 1.5 by eggert, Mon Aug 12 14:12:57 2002 UTC
# Line 1  Line 1 
1  /* obstack.h - object stack macros  /* obstack.h - object stack macros
2     Copyright (C) 1988,89,90,91,92,93,94,96,97,98,99 Free Software Foundation, Inc.  
3       Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997,
4       1998, 1999, 2002 Free Software Foundation, Inc.
5    
6     This file is part of the GNU C Library.  Its master source is NOT part of     This file is part of the GNU C Library.  Its master source is NOT part of
7     the C library, however.  The master source lives in /gd/gnu/lib.     the C library, however.  The master source lives in /gd/gnu/lib.
# Line 7  Line 9 
9     NOTE: The canonical source of this file is maintained with the GNU C Library.     NOTE: The canonical source of this file is maintained with the GNU C Library.
10     Bugs can be reported to bug-glibc@gnu.org.     Bugs can be reported to bug-glibc@gnu.org.
11    
12     This program is free software; you can redistribute it and/or modify it     This program is free software; you can redistribute it and/or modify
13     under the terms of the GNU General Public License as published by the     it under the terms of the GNU General Public License as published by
14     Free Software Foundation; either version 2, or (at your option) any     the Free Software Foundation; either version 2, or (at your option)
15     later version.     any later version.
16    
17     This program is distributed in the hope that it will be useful,     This program is distributed in the hope that it will be useful,
18     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
19     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20     Library General Public License for more details.     GNU General Public License for more details.
21    
22     You should have received a copy of the GNU Library General Public     You should have received a copy of the GNU General Public License
23     License along with this program; if not, write to the Free Software     along with this program; if not, write to the Free Software Foundation,
24     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    USA.  */  
25    
26  /* Summary:  /* Summary:
27    
# Line 123  extern "C" { Line 124  extern "C" {
124  #endif  #endif
125    
126  #ifndef __INT_TO_PTR  #ifndef __INT_TO_PTR
127  # define __INT_TO_PTR(P) ((P) + (char *) 0)  # ifdef __STDC__
128    #  define __INT_TO_PTR(P) ((void *) ((P) + (char *) 0))
129    # else
130    #  define __INT_TO_PTR(P) ((P) + (char *) 0)
131    # endif
132  #endif  #endif
133    
134  /* We need the type of the resulting object.  If __PTRDIFF_TYPE__ is  /* We need the type of the resulting object.  If __PTRDIFF_TYPE__ is
# Line 170  struct obstack         /* control current objec Line 175  struct obstack         /* control current objec
175    char  *chunk_limit;           /* address of char after current chunk */    char  *chunk_limit;           /* address of char after current chunk */
176    PTR_INT_TYPE temp;            /* Temporary for some macros.  */    PTR_INT_TYPE temp;            /* Temporary for some macros.  */
177    int   alignment_mask;         /* Mask of alignment for each object. */    int   alignment_mask;         /* Mask of alignment for each object. */
178  #if defined __STDC__ && __STDC__  #if PROTOTYPES || (defined __STDC__ && __STDC__)
179    /* These prototypes vary based on `use_extra_arg', and we use    /* These prototypes vary based on `use_extra_arg', and we use
180       casts to the prototypeless function type in all assignments,       casts to the prototypeless function type in all assignments,
181       but having prototypes here quiets -Wstrict-prototypes.  */       but having prototypes here quiets -Wstrict-prototypes.  */
# Line 194  struct obstack         /* control current objec Line 199  struct obstack         /* control current objec
199    
200  /* Declare the external functions we use; they are in obstack.c.  */  /* Declare the external functions we use; they are in obstack.c.  */
201    
202  #if defined __STDC__ && __STDC__  #if PROTOTYPES || (defined __STDC__ && __STDC__)
203  extern void _obstack_newchunk (struct obstack *, int);  extern void _obstack_newchunk (struct obstack *, int);
204  extern void _obstack_free (struct obstack *, void *);  extern void _obstack_free (struct obstack *, void *);
205  extern int _obstack_begin (struct obstack *, int, int,  extern int _obstack_begin (struct obstack *, int, int,
# Line 211  extern int _obstack_begin_1 (); Line 216  extern int _obstack_begin_1 ();
216  extern int _obstack_memory_used ();  extern int _obstack_memory_used ();
217  #endif  #endif
218    
219  #if defined __STDC__ && __STDC__  #if PROTOTYPES || (defined __STDC__ && __STDC__)
220    
221  /* Do the function-declarations after the structs  /* Do the function-declarations after the structs
222     but before defining the macros.  */     but before defining the macros.  */
# Line 251  int obstack_alignment_mask (struct obsta Line 256  int obstack_alignment_mask (struct obsta
256  int obstack_chunk_size (struct obstack *obstack);  int obstack_chunk_size (struct obstack *obstack);
257  int obstack_memory_used (struct obstack *obstack);  int obstack_memory_used (struct obstack *obstack);
258    
259  #endif /* __STDC__ */  #endif /* PROTOTYPES || (defined __STDC__ && __STDC__) */
260    
261  /* Non-ANSI C cannot really support alternative functions for these macros,  /* Non-ANSI C cannot really support alternative functions for these macros,
262     so we do not declare them.  */     so we do not declare them.  */
# Line 260  int obstack_memory_used (struct obstack Line 265  int obstack_memory_used (struct obstack
265     more memory.  This can be set to a user defined function which     more memory.  This can be set to a user defined function which
266     should either abort gracefully or use longjump - but shouldn't     should either abort gracefully or use longjump - but shouldn't
267     return.  The default action is to print a message and abort.  */     return.  The default action is to print a message and abort.  */
268  #if defined __STDC__ && __STDC__  #if PROTOTYPES || (defined __STDC__ && __STDC__)
269  extern void (*obstack_alloc_failed_handler) (void);  extern void (*obstack_alloc_failed_handler) (void);
270  #else  #else
271  extern void (*obstack_alloc_failed_handler) ();  extern void (*obstack_alloc_failed_handler) ();
# Line 289  extern int obstack_exit_failure; Line 294  extern int obstack_exit_failure;
294    
295  /* To prevent prototype warnings provide complete argument list in  /* To prevent prototype warnings provide complete argument list in
296     standard C version.  */     standard C version.  */
297  #if defined __STDC__ && __STDC__  #if PROTOYPES || (defined __STDC__ && __STDC__)
298    
299  # define obstack_init(h)                                        \  # define obstack_init(h)                                        \
300    _obstack_begin ((h), 0, 0,                                    \    _obstack_begin ((h), 0, 0,                                    \
# Line 584  __extension__                                                          \ Line 589  __extension__                                                          \
589    (h)->object_base = (h)->next_free,                                    \    (h)->object_base = (h)->next_free,                                    \
590    __INT_TO_PTR ((h)->temp))    __INT_TO_PTR ((h)->temp))
591    
592  # if defined __STDC__ && __STDC__  # if PROTOTYPES || (defined __STDC__ && __STDC__)
593  #  define obstack_free(h,obj)                                           \  #  define obstack_free(h,obj)                                           \
594  ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                     \  ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                     \
595    (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\    (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26