* lib/obstack.h: Formatting changes.

(obstack_grow, obstack_grow0): Don't cast WHERE at all: it
prevents type checking.
(obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't
cast the value to (void *): assigning a `foo *' to a `void *'
variable is valid.
(obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int.
* src/reader.c (parse_union_decl): Typo: use obstack_1grow to
append characters.
This commit is contained in:
Akim Demaille
2000-11-17 14:14:36 +00:00
parent 6fd54b73c3
commit d7045ec672
3 changed files with 60 additions and 35 deletions

View File

@@ -1,3 +1,15 @@
2000-11-17 Akim Demaille <akim@epita.fr>
* lib/obstack.h: Formatting changes.
(obstack_grow, obstack_grow0): Don't cast WHERE at all: it
prevents type checking.
(obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't
cast the value to (void *): assigning a `foo *' to a `void *'
variable is valid.
(obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int.
* src/reader.c (parse_union_decl): Typo: use obstack_1grow to
append characters.
2000-11-17 Akim Demaille <akim@epita.fr> 2000-11-17 Akim Demaille <akim@epita.fr>
* tests/Makefile.am (suite.m4, regression.m4, calc.m4): Rename * tests/Makefile.am (suite.m4, regression.m4, calc.m4): Rename

View File

@@ -288,21 +288,24 @@ extern int obstack_exit_failure;
standard C version. */ standard C version. */
#if defined __STDC__ && __STDC__ #if defined __STDC__ && __STDC__
# define obstack_init(h) \ # define obstack_init(h) \
_obstack_begin ((h), 0, 0, \ _obstack_begin ((h), 0, 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) (void *(*) (long)) obstack_chunk_alloc, \
(void (*) (void *)) obstack_chunk_free)
# define obstack_begin(h, size) \ # define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \ _obstack_begin ((h), (size), 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) (void *(*) (long)) obstack_chunk_alloc, \
(void (*) (void *)) obstack_chunk_free)
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ # define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \ _obstack_begin ((h), (size), (alignment), \
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun)) (void *(*) (long)) (chunkfun), \
(void (*) (void *)) (freefun))
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ # define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \ _obstack_begin_1 ((h), (size), (alignment), \
(void *(*) (void *, long)) (chunkfun), \ (void *(*) (void *, long)) (chunkfun), \
(void (*) (void *, void *)) (freefun), (arg)) (void (*) (void *, void *)) (freefun), (arg))
# define obstack_chunkfun(h, newchunkfun) \ # define obstack_chunkfun(h, newchunkfun) \
@@ -313,21 +316,25 @@ extern int obstack_exit_failure;
#else #else
# define obstack_init(h) \ # define obstack_init(h) \
_obstack_begin ((h), 0, 0, \ _obstack_begin ((h), 0, 0, \
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) (void *(*) ()) obstack_chunk_alloc, \
(void (*) ()) obstack_chunk_free)
# define obstack_begin(h, size) \ # define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \ _obstack_begin ((h), (size), 0, \
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) (void *(*) ()) obstack_chunk_alloc, \
(void (*) ()) obstack_chunk_free)
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ # define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \ _obstack_begin ((h), (size), (alignment), \
(void *(*) ()) (chunkfun), (void (*) ()) (freefun)) (void *(*) ()) (chunkfun), \
(void (*) ()) (freefun))
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ # define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \ _obstack_begin_1 ((h), (size), (alignment), \
(void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg)) (void *(*) ()) (chunkfun), \
(void (*) ()) (freefun), (arg))
# define obstack_chunkfun(h, newchunkfun) \ # define obstack_chunkfun(h, newchunkfun) \
((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun)) ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
@@ -385,7 +392,7 @@ __extension__ \
int __len = (length); \ int __len = (length); \
if (__o->next_free + __len > __o->chunk_limit) \ if (__o->next_free + __len > __o->chunk_limit) \
_obstack_newchunk (__o, __len); \ _obstack_newchunk (__o, __len); \
_obstack_memcpy (__o->next_free, (const char *) (where), __len); \ _obstack_memcpy (__o->next_free, (where), __len); \
__o->next_free += __len; \ __o->next_free += __len; \
(void) 0; }) (void) 0; })
@@ -395,7 +402,7 @@ __extension__ \
int __len = (length); \ int __len = (length); \
if (__o->next_free + __len + 1 > __o->chunk_limit) \ if (__o->next_free + __len + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, __len + 1); \ _obstack_newchunk (__o, __len + 1); \
_obstack_memcpy (__o->next_free, (const char *) (where), __len); \ _obstack_memcpy (__o->next_free, (where), __len); \
__o->next_free += __len; \ __o->next_free += __len; \
*(__o->next_free)++ = 0; \ *(__o->next_free)++ = 0; \
(void) 0; }) (void) 0; })
@@ -408,8 +415,8 @@ __extension__ \
*(__o->next_free)++ = (datum); \ *(__o->next_free)++ = (datum); \
(void) 0; }) (void) 0; })
/* These assume that the obstack alignment is good enough for pointers or ints, /* These assume that the obstack alignment is good enough for pointers
and that the data added so far to the current object or ints, and that the data added so far to the current object
shares that much alignment. */ shares that much alignment. */
# define obstack_ptr_grow(OBSTACK,datum) \ # define obstack_ptr_grow(OBSTACK,datum) \
@@ -417,7 +424,7 @@ __extension__ \
({ struct obstack *__o = (OBSTACK); \ ({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \ _obstack_newchunk (__o, sizeof (void *)); \
*((void **)__o->next_free)++ = ((const void *)datum); \ *((void **)__o->next_free)++ = (datum); \
(void) 0; }) (void) 0; })
# define obstack_int_grow(OBSTACK,datum) \ # define obstack_int_grow(OBSTACK,datum) \
@@ -425,11 +432,14 @@ __extension__ \
({ struct obstack *__o = (OBSTACK); \ ({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (int) > __o->chunk_limit) \ if (__o->next_free + sizeof (int) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (int)); \ _obstack_newchunk (__o, sizeof (int)); \
*((int *)__o->next_free)++ = ((int)datum); \ *((int *)__o->next_free)++ = (datum); \
(void) 0; }) (void) 0; })
# define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr) # define obstack_ptr_grow_fast(h,aptr) \
# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) (*((void **) (h)->next_free)++ = (aptr))
# define obstack_int_grow_fast(h,aint) \
(*((int *) (h)->next_free)++ = (aint))
# define obstack_blank(OBSTACK,length) \ # define obstack_blank(OBSTACK,length) \
__extension__ \ __extension__ \
@@ -510,14 +520,14 @@ __extension__ \
( (h)->temp = (length), \ ( (h)->temp = (length), \
(((h)->next_free + (h)->temp > (h)->chunk_limit) \ (((h)->next_free + (h)->temp > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
_obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \ _obstack_memcpy ((h)->next_free, (where), (h)->temp), \
(h)->next_free += (h)->temp) (h)->next_free += (h)->temp)
# define obstack_grow0(h,where,length) \ # define obstack_grow0(h,where,length) \
( (h)->temp = (length), \ ( (h)->temp = (length), \
(((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \
_obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \ _obstack_memcpy ((h)->next_free, (where), (h)->temp), \
(h)->next_free += (h)->temp, \ (h)->next_free += (h)->temp, \
*((h)->next_free)++ = 0) *((h)->next_free)++ = 0)
@@ -529,15 +539,18 @@ __extension__ \
# define obstack_ptr_grow(h,datum) \ # define obstack_ptr_grow(h,datum) \
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
(*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum))) (*((const char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = (datum)))
# define obstack_int_grow(h,datum) \ # define obstack_int_grow(h,datum) \
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ ( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
(*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum))) (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = (datum)))
# define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr) # define obstack_ptr_grow_fast(h,aptr) \
# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) (*((const char **) (h)->next_free)++ = (aptr))
# define obstack_int_grow_fast(h,aint) \
(*((int *) (h)->next_free)++ = (aint))
# define obstack_blank(h,length) \ # define obstack_blank(h,length) \
( (h)->temp = (length), \ ( (h)->temp = (length), \

View File

@@ -793,7 +793,7 @@ parse_union_decl (void)
{ {
obstack_1grow (&attrs_obstack, c); obstack_1grow (&attrs_obstack, c);
if (defines_flag) if (defines_flag)
obstack_grow_literal_string (&defines_obstack, c); obstack_1grow (&defines_obstack, c);
switch (c) switch (c)
{ {