/[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.5 by eggert, Mon Aug 12 14:12:57 2002 UTC revision 1.6 by eggert, Fri Dec 13 11:24:16 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.
    Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997,  
    1998, 1999, 2002 Free Software Foundation, Inc.  
3    
4     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
5     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 9  Line 7 
7     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.
8     Bugs can be reported to bug-glibc@gnu.org.     Bugs can be reported to bug-glibc@gnu.org.
9    
10     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify it
11     it under the terms of the GNU General Public License as published by     under the terms of the GNU General Public License as published by the
12     the Free Software Foundation; either version 2, or (at your option)     Free Software Foundation; either version 2, or (at your option) any
13     any later version.     later version.
14    
15     This program is distributed in the hope that it will be useful,     This program is distributed in the hope that it will be useful,
16     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18     GNU General Public License for more details.     Library General Public License for more details.
19    
20     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU Library General Public
21     along with this program; if not, write to the Free Software Foundation,     License along with this program; if not, write to the Free Software
22     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
23       USA.  */
24    
25  /* Summary:  /* Summary:
26    
# Line 124  extern "C" { Line 123  extern "C" {
123  #endif  #endif
124    
125  #ifndef __INT_TO_PTR  #ifndef __INT_TO_PTR
126  # ifdef __STDC__  # define __INT_TO_PTR(P) ((P) + (char *) 0)
 #  define __INT_TO_PTR(P) ((void *) ((P) + (char *) 0))  
 # else  
 #  define __INT_TO_PTR(P) ((P) + (char *) 0)  
 # endif  
127  #endif  #endif
128    
129  /* 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 175  struct obstack         /* control current objec Line 170  struct obstack         /* control current objec
170    char  *chunk_limit;           /* address of char after current chunk */    char  *chunk_limit;           /* address of char after current chunk */
171    PTR_INT_TYPE temp;            /* Temporary for some macros.  */    PTR_INT_TYPE temp;            /* Temporary for some macros.  */
172    int   alignment_mask;         /* Mask of alignment for each object. */    int   alignment_mask;         /* Mask of alignment for each object. */
173  #if PROTOTYPES || (defined __STDC__ && __STDC__)  #if defined __STDC__ && __STDC__
174    /* These prototypes vary based on `use_extra_arg', and we use    /* These prototypes vary based on `use_extra_arg', and we use
175       casts to the prototypeless function type in all assignments,       casts to the prototypeless function type in all assignments,
176       but having prototypes here quiets -Wstrict-prototypes.  */       but having prototypes here quiets -Wstrict-prototypes.  */
# Line 199  struct obstack         /* control current objec Line 194  struct obstack         /* control current objec
194    
195  /* Declare the external functions we use; they are in obstack.c.  */  /* Declare the external functions we use; they are in obstack.c.  */
196    
197  #if PROTOTYPES || (defined __STDC__ && __STDC__)  #if defined __STDC__ && __STDC__
198  extern void _obstack_newchunk (struct obstack *, int);  extern void _obstack_newchunk (struct obstack *, int);
199  extern void _obstack_free (struct obstack *, void *);  extern void _obstack_free (struct obstack *, void *);
200  extern int _obstack_begin (struct obstack *, int, int,  extern int _obstack_begin (struct obstack *, int, int,
# Line 216  extern int _obstack_begin_1 (); Line 211  extern int _obstack_begin_1 ();
211  extern int _obstack_memory_used ();  extern int _obstack_memory_used ();
212  #endif  #endif
213    
214  #if PROTOTYPES || (defined __STDC__ && __STDC__)  #if defined __STDC__ && __STDC__
215    
216  /* Do the function-declarations after the structs  /* Do the function-declarations after the structs
217     but before defining the macros.  */     but before defining the macros.  */
# Line 256  int obstack_alignment_mask (struct obsta Line 251  int obstack_alignment_mask (struct obsta
251  int obstack_chunk_size (struct obstack *obstack);  int obstack_chunk_size (struct obstack *obstack);
252  int obstack_memory_used (struct obstack *obstack);  int obstack_memory_used (struct obstack *obstack);
253    
254  #endif /* PROTOTYPES || (defined __STDC__ && __STDC__) */  #endif /* __STDC__ */
255    
256  /* Non-ANSI C cannot really support alternative functions for these macros,  /* Non-ANSI C cannot really support alternative functions for these macros,
257     so we do not declare them.  */     so we do not declare them.  */
# Line 265  int obstack_memory_used (struct obstack Line 260  int obstack_memory_used (struct obstack
260     more memory.  This can be set to a user defined function which     more memory.  This can be set to a user defined function which
261     should either abort gracefully or use longjump - but shouldn't     should either abort gracefully or use longjump - but shouldn't
262     return.  The default action is to print a message and abort.  */     return.  The default action is to print a message and abort.  */
263  #if PROTOTYPES || (defined __STDC__ && __STDC__)  #if defined __STDC__ && __STDC__
264  extern void (*obstack_alloc_failed_handler) (void);  extern void (*obstack_alloc_failed_handler) (void);
265  #else  #else
266  extern void (*obstack_alloc_failed_handler) ();  extern void (*obstack_alloc_failed_handler) ();
# Line 294  extern int obstack_exit_failure; Line 289  extern int obstack_exit_failure;
289    
290  /* To prevent prototype warnings provide complete argument list in  /* To prevent prototype warnings provide complete argument list in
291     standard C version.  */     standard C version.  */
292  #if PROTOYPES || (defined __STDC__ && __STDC__)  #if defined __STDC__ && __STDC__
293    
294  # define obstack_init(h)                                        \  # define obstack_init(h)                                        \
295    _obstack_begin ((h), 0, 0,                                    \    _obstack_begin ((h), 0, 0,                                    \
# Line 589  __extension__                                                          \ Line 584  __extension__                                                          \
584    (h)->object_base = (h)->next_free,                                    \    (h)->object_base = (h)->next_free,                                    \
585    __INT_TO_PTR ((h)->temp))    __INT_TO_PTR ((h)->temp))
586    
587  # if PROTOTYPES || (defined __STDC__ && __STDC__)  # if defined __STDC__ && __STDC__
588  #  define obstack_free(h,obj)                                           \  #  define obstack_free(h,obj)                                           \
589  ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                     \  ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                     \
590    (((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.5  
changed lines
  Added in v.1.6

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