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

Diff of /bison/lib/obstack.c

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

revision 1.3 by eggert, Fri Oct 26 07:26:00 2001 UTC revision 1.4 by eggert, Mon Aug 12 14:12:57 2002 UTC
# Line 1  Line 1 
1  /* obstack.c - subroutines used implicitly by object stack macros  /* obstack.c - subroutines used implicitly by object stack macros
2     Copyright (C) 1988-1994,96,97,98,99,2000,2001 Free Software Foundation, Inc.  
3       Copyright (C) 1988-1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002
4       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.
8    
9     The GNU C Library is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or modify
10     modify it under the terms of the GNU Lesser General Public     it under the terms of the GNU General Public License as published by
11     License as published by the Free Software Foundation; either     the Free Software Foundation; either version 2, or (at your option)
12     version 2.1 of the License, or (at your option) any later version.     any later version.
13    
14     The GNU C Library is distributed in the hope that it will be useful,     This program is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     Lesser General Public License for more details.     GNU General Public License for more details.
18    
19     You should have received a copy of the GNU Lesser General Public     You should have received a copy of the GNU General Public License
20     License along with the GNU C Library; if not, write to the Free     along with this program; if not, write to the Free Software Foundation,
21     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    02111-1307 USA.  */  
22    
23  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
24  # include <config.h>  # include <config.h>
# Line 53  Line 55 
55  #ifndef ELIDE_CODE  #ifndef ELIDE_CODE
56    
57    
58  # if defined __STDC__ && __STDC__  # ifdef __STDC__
59  #  define POINTER void *  #  define POINTER void *
60  # else  # else
61  #  define POINTER char *  #  define POINTER char *
# Line 84  union fooround {long x; double d;}; Line 86  union fooround {long x; double d;};
86     abort gracefully or use longjump - but shouldn't return.  This     abort gracefully or use longjump - but shouldn't return.  This
87     variable by default points to the internal function     variable by default points to the internal function
88     `print_and_abort'.  */     `print_and_abort'.  */
89  # if defined __STDC__ && __STDC__  # if PROTOTYPES || (defined __STDC__ && __STDC__)
90  static void print_and_abort (void);  static void print_and_abort (void);
91  void (*obstack_alloc_failed_handler) (void) = print_and_abort;  void (*obstack_alloc_failed_handler) (void) = print_and_abort;
92  # else  # else
# Line 112  struct obstack *_obstack; Line 114  struct obstack *_obstack;
114     For free, do not use ?:, since some compilers, like the MIPS compilers,     For free, do not use ?:, since some compilers, like the MIPS compilers,
115     do not allow (expr) ? void : void.  */     do not allow (expr) ? void : void.  */
116    
117  # if defined __STDC__ && __STDC__  # if PROTOTYPES || (defined __STDC__ && __STDC__)
118  #  define CALL_CHUNKFUN(h, size) \  #  define CALL_CHUNKFUN(h, size) \
119    (((h) -> use_extra_arg) \    (((h) -> use_extra_arg) \
120     ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \     ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
# Line 154  _obstack_begin (h, size, alignment, chun Line 156  _obstack_begin (h, size, alignment, chun
156       struct obstack *h;       struct obstack *h;
157       int size;       int size;
158       int alignment;       int alignment;
159  # if defined __STDC__ && __STDC__  # if PROTOTYPES || (defined __STDC__ && __STDC__)
160       POINTER (*chunkfun) (long);       POINTER (*chunkfun) (long);
161       void (*freefun) (void *);       void (*freefun) (void *);
162  # else  # else
# Line 183  _obstack_begin (h, size, alignment, chun Line 185  _obstack_begin (h, size, alignment, chun
185        size = 4096 - extra;        size = 4096 - extra;
186      }      }
187    
188  # if defined __STDC__ && __STDC__  # if PROTOTYPES || (defined __STDC__ && __STDC__)
189    h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;    h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
190    h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;    h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
191  # else  # else
# Line 212  _obstack_begin_1 (h, size, alignment, ch Line 214  _obstack_begin_1 (h, size, alignment, ch
214       struct obstack *h;       struct obstack *h;
215       int size;       int size;
216       int alignment;       int alignment;
217  # if defined __STDC__ && __STDC__  # if PROTOTYPES || (defined __STDC__ && __STDC__)
218       POINTER (*chunkfun) (POINTER, long);       POINTER (*chunkfun) (POINTER, long);
219       void (*freefun) (POINTER, POINTER);       void (*freefun) (POINTER, POINTER);
220  # else  # else
# Line 242  _obstack_begin_1 (h, size, alignment, ch Line 244  _obstack_begin_1 (h, size, alignment, ch
244        size = 4096 - extra;        size = 4096 - extra;
245      }      }
246    
247  # if defined __STDC__ && __STDC__  # if PROTOTYPES || (defined __STDC__ && __STDC__)
248    h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;    h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
249    h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;    h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
250  # else  # else
# Line 343  _obstack_newchunk (h, length) Line 345  _obstack_newchunk (h, length)
345     This is here for debugging.     This is here for debugging.
346     If you use it in a program, you are probably losing.  */     If you use it in a program, you are probably losing.  */
347    
348  # if defined __STDC__ && __STDC__  # if PROTOTYPES || (defined __STDC__ && __STDC__)
349  /* Suppress -Wmissing-prototypes warning.  We don't want to declare this in  /* Suppress -Wmissing-prototypes warning.  We don't want to declare this in
350     obstack.h because it is just for debugging.  */     obstack.h because it is just for debugging.  */
351  int _obstack_allocated_p (struct obstack *h, POINTER obj);  int _obstack_allocated_p (struct obstack *h, POINTER obj);
# Line 505  print_and_abort () Line 507  print_and_abort ()
507  /* Now define the functional versions of the obstack macros.  /* Now define the functional versions of the obstack macros.
508     Define them to simply use the corresponding macros to do the job.  */     Define them to simply use the corresponding macros to do the job.  */
509    
510  #  if defined __STDC__ && __STDC__  #  if PROTOTYPES || (defined __STDC__ && __STDC__)
511  /* These function definitions do not work with non-ANSI preprocessors;  /* These function definitions do not work with non-ANSI preprocessors;
512     they won't pass through the macro names in parentheses.  */     they won't pass through the macro names in parentheses.  */
513    
# Line 616  POINTER (obstack_copy0) (obstack, addres Line 618  POINTER (obstack_copy0) (obstack, addres
618    return obstack_copy0 (obstack, address, length);    return obstack_copy0 (obstack, address, length);
619  }  }
620    
621  #  endif /* __STDC__ */  #  endif /* PROTOTYPES || (defined __STDC__ && __STDC__) */
622    
623  # endif /* 0 */  # endif /* 0 */
624    

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

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