Skip to content

Commit

Permalink
include/
Browse files Browse the repository at this point in the history
2005-03-27  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        * partition.h: Remove use of PARAMS.
        * obstack.h: Remove conditional prototypes __STDC__.
        * objalloc.h:  Remove use of PARAMS.
        * splay-tree.h: Likewise.

libiberty/
2005-03-27  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        Convert libiberty to use ISO C prototype style 5/n.
        * random.c (srandom, initstate, setstate, random): Use ISO C
        prototypes.
        * putenv.c (putenv): Likewise.
        * physmem.c (physmem_available, physmem_total, main):
        Likewise.
        * pex-win32.c (fix_argv, pexecute, pwait): Likewise.
        * pex-unix.c (pexecute, pwait): Likewise.
        * pex-msdos.c (pexecute, pwait): Likewise.
        * pex-djgpp.c (pexecute, pwait): Likewise.
        * partition.c (partition_new, partition_delete,
        partition_union)
        (elem_compare, partition_print): Likewise.
        * obstack.c (_obstack_begin, _obstack_begin_1,
        _obstack_newchunk,
        _obstack_allocated_p, _obstack_free, obstack_free,
        _obstack_memory_used, print_and_abort, obstack_next_free,
        obstack_object_size, obstack_base): Likewise.  Remove codes
        predicated on !defined(__STDC__).
        * objalloc.c (objalloc_create, _objalloc_alloc, objalloc_free,
        objalloc_free_block): Use ISO C prototypes.
        * mkstemps.c (mkstemps): Likewise.
        * memset.c (memset): Likewise.
        * mempcpy.c (mempcpy): Likewise.
        * rename.c (rename): Likewise.
        * rindex.c (rindex): Likewise.
        * setenv.c (setenv, unsetenv): Likewise.
        * sigsetmask.c (sigsetmask): Likewise.
        * snprintf.c (snprintf): Likewise.
        * sort.c (sort_pointers, xmalloc): Likewise.
        * spaces.c (spaces): Likewise.
        * splay-tree.c (splay_tree_delete_helper,
        splay_tree_splay_helper, splay_tree_splay,
        splay_tree_foreach_helper, splay_tree_xmalloc_allocate,
        splay_tree_new, splay_tree_xmalloc_allocate,
        splay_tree_new_with_allocator, splay_tree_delete,
        splay_tree_insert, splay_tree_remove, splay_tree_lookup,
        splay_tree_max, splay_tree_min, splay_tree_predecessor,
        splay_tree_successor, splay_tree_foreach,
        splay_tree_compare_ints, splay_tree_compare_pointers):
        Likewise.
        * stpcpy.c (stpcpy): Likewise.
        * stpncpy.c (stpncpy): Likewise.
        * strcasecmp.c (strcasecmp): Likewise.
        * strchr.c (strchr): Likewise.
        * strdup.c (strdup): Likewise.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97125 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
gdr committed Mar 28, 2005
1 parent fb53528 commit f8d9d6a
Show file tree
Hide file tree
Showing 33 changed files with 224 additions and 490 deletions.
7 changes: 7 additions & 0 deletions include/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

* ternary.h: Don't use PARAMS anymore.

2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>

* partition.h: Remove use of PARAMS.
* obstack.h: Remove conditional prototypes __STDC__.
* objalloc.h: Remove use of PARAMS.
* splay-tree.h: Likewise.

2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>

* md5.h: Remove definition and uses of __P.
Expand Down
8 changes: 4 additions & 4 deletions include/objalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ struct objalloc_align { char x; double d; };

/* Create an objalloc structure. Returns NULL if malloc fails. */

extern struct objalloc *objalloc_create PARAMS ((void));
extern struct objalloc *objalloc_create (void);

/* Allocate space from an objalloc structure. Returns NULL if malloc
fails. */

extern PTR _objalloc_alloc PARAMS ((struct objalloc *, unsigned long));
extern PTR _objalloc_alloc (struct objalloc *, unsigned long);

/* The macro version of objalloc_alloc. We only define this if using
gcc, because otherwise we would have to evaluate the arguments
Expand Down Expand Up @@ -105,11 +105,11 @@ extern PTR _objalloc_alloc PARAMS ((struct objalloc *, unsigned long));

/* Free an entire objalloc structure. */

extern void objalloc_free PARAMS ((struct objalloc *));
extern void objalloc_free (struct objalloc *);

/* Free a block allocated by objalloc_alloc. This also frees all more
recently allocated blocks. */

extern void objalloc_free_block PARAMS ((struct objalloc *, PTR));
extern void objalloc_free_block (struct objalloc *, PTR);

#endif /* OBJALLOC_H */
72 changes: 3 additions & 69 deletions include/obstack.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* obstack.h - object stack macros
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
1999, 2000
1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Expand Down Expand Up @@ -145,11 +145,7 @@ extern "C" {

#if defined _LIBC || defined HAVE_STRING_H
# include <string.h>
# if defined __STDC__ && __STDC__
# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
# else
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
# endif
# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
#else
# ifdef memcpy
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
Expand All @@ -174,18 +170,12 @@ struct obstack /* control current object in current chunk */
char *chunk_limit; /* address of char after current chunk */
PTR_INT_TYPE temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
#if defined __STDC__ && __STDC__
/* These prototypes vary based on `use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, long);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
#else
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
void (*freefun) (); /* User's function to free a chunk. */
char *extra_arg; /* first arg for chunk alloc/dealloc funcs */
#endif
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
unsigned maybe_empty_object:1;/* There is a possibility that the current
chunk contains a zero-length object. This
Expand All @@ -198,7 +188,6 @@ struct obstack /* control current object in current chunk */

/* Declare the external functions we use; they are in obstack.c. */

#if defined __STDC__ && __STDC__
extern void _obstack_newchunk (struct obstack *, int);
extern void _obstack_free (struct obstack *, void *);
extern int _obstack_begin (struct obstack *, int, int,
Expand All @@ -207,16 +196,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int,
void *(*) (void *, long),
void (*) (void *, void *), void *);
extern int _obstack_memory_used (struct obstack *);
#else
extern void _obstack_newchunk ();
extern void _obstack_free ();
extern int _obstack_begin ();
extern int _obstack_begin_1 ();
extern int _obstack_memory_used ();
#endif

#if defined __STDC__ && __STDC__

/* Do the function-declarations after the structs
but before defining the macros. */

Expand Down Expand Up @@ -255,19 +235,10 @@ int obstack_alignment_mask (struct obstack *obstack);
int obstack_chunk_size (struct obstack *obstack);
int obstack_memory_used (struct obstack *obstack);

#endif /* __STDC__ */

/* Non-ANSI C cannot really support alternative functions for these macros,
so we do not declare them. */

/* Error handler called when `obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function. The
default action is to print a message and abort. */
#if defined __STDC__ && __STDC__
extern void (*obstack_alloc_failed_handler) (void);
#else
extern void (*obstack_alloc_failed_handler) ();
#endif

/* Exit value used when `print_and_abort' is used. */
extern int obstack_exit_failure;
Expand All @@ -292,8 +263,6 @@ extern int obstack_exit_failure;

/* To prevent prototype warnings provide complete argument list in
standard C version. */
#if defined __STDC__ && __STDC__

# define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
Expand All @@ -317,32 +286,6 @@ extern int obstack_exit_failure;
# define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))

#else

# define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)

# define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)

# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
(void *(*) ()) (chunkfun), (void (*) ()) (freefun))

# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
(void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg))

# define obstack_chunkfun(h, newchunkfun) \
((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))

# define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)()) (newfreefun))

#endif

#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))

#define obstack_blank_fast(h,n) ((h)->next_free += (n))
Expand Down Expand Up @@ -586,21 +529,12 @@ __extension__ \
(h)->object_base = (h)->next_free, \
__INT_TO_PTR ((h)->temp))

# if defined __STDC__ && __STDC__
# define obstack_free(h,obj) \
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
# else
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
# endif

#endif /* not __GNUC__ or not __STDC__ */

Expand Down
11 changes: 4 additions & 7 deletions include/partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,10 @@ typedef struct partition_def
struct partition_elem elements[1];
} *partition;

extern partition partition_new PARAMS((int));
extern void partition_delete PARAMS((partition));
extern int partition_union PARAMS((partition,
int,
int));
extern void partition_print PARAMS((partition,
FILE*));
extern partition partition_new (int);
extern void partition_delete (partition);
extern int partition_union (partition, int, int);
extern void partition_print (partition, FILE*);

/* Returns the canonical element corresponding to the class containing
ELEMENT__ in PARTITION__. */
Expand Down
69 changes: 27 additions & 42 deletions include/splay-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,30 @@ typedef struct splay_tree_node_s *splay_tree_node;

/* The type of a function which compares two splay-tree keys. The
function should return values as for qsort. */
typedef int (*splay_tree_compare_fn) PARAMS((splay_tree_key, splay_tree_key));
typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key);

/* The type of a function used to deallocate any resources associated
with the key. */
typedef void (*splay_tree_delete_key_fn) PARAMS((splay_tree_key));
typedef void (*splay_tree_delete_key_fn) (splay_tree_key);

/* The type of a function used to deallocate any resources associated
with the value. */
typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value));
typedef void (*splay_tree_delete_value_fn) (splay_tree_value);

/* The type of a function used to iterate over the tree. */
typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*));
typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*);

/* The type of a function used to allocate memory for tree root and
node structures. The first argument is the number of bytes needed;
the second is a data pointer the splay tree functions pass through
to the allocator. This function must never return zero. */
typedef PTR (*splay_tree_allocate_fn) PARAMS((int, void *));
typedef PTR (*splay_tree_allocate_fn) (int, void *);

/* The type of a function used to free memory allocated using the
corresponding splay_tree_allocate_fn. The first argument is the
memory to be freed; the latter is a data pointer the splay tree
functions pass through to the freer. */
typedef void (*splay_tree_deallocate_fn) PARAMS((void *, void *));
typedef void (*splay_tree_deallocate_fn) (void *, void *);

/* The nodes in the splay tree. */
struct splay_tree_node_s GTY(())
Expand Down Expand Up @@ -114,43 +114,28 @@ struct splay_tree_s GTY(())
};
typedef struct splay_tree_s *splay_tree;

extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn));
extern splay_tree splay_tree_new_with_allocator
PARAMS((splay_tree_compare_fn,
splay_tree_delete_key_fn,
extern splay_tree splay_tree_new (splay_tree_compare_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn);
extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn,
splay_tree_allocate_fn,
splay_tree_deallocate_fn,
void *));
extern void splay_tree_delete PARAMS((splay_tree));
extern splay_tree_node splay_tree_insert
PARAMS((splay_tree,
splay_tree_key,
splay_tree_value));
extern void splay_tree_remove PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_lookup
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_predecessor
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_successor
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_max
PARAMS((splay_tree));
extern splay_tree_node splay_tree_min
PARAMS((splay_tree));
extern int splay_tree_foreach PARAMS((splay_tree,
splay_tree_foreach_fn,
void*));
extern int splay_tree_compare_ints PARAMS((splay_tree_key,
splay_tree_key));
extern int splay_tree_compare_pointers PARAMS((splay_tree_key,
splay_tree_key));
splay_tree_allocate_fn,
splay_tree_deallocate_fn,
void *);
extern void splay_tree_delete (splay_tree);
extern splay_tree_node splay_tree_insert (splay_tree,
splay_tree_key,
splay_tree_value);
extern void splay_tree_remove (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_max (splay_tree);
extern splay_tree_node splay_tree_min (splay_tree);
extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key);

#ifdef __cplusplus
}
Expand Down
45 changes: 45 additions & 0 deletions libiberty/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>

Convert libiberty to use ISO C prototype style 5/n.
* random.c (srandom, initstate, setstate, random): Use ISO C
prototypes.
* putenv.c (putenv): Likewise.
* physmem.c (physmem_available, physmem_total, main): Likewise.
* pex-win32.c (fix_argv, pexecute, pwait): Likewise.
* pex-unix.c (pexecute, pwait): Likewise.
* pex-msdos.c (pexecute, pwait): Likewise.
* pex-djgpp.c (pexecute, pwait): Likewise.
* partition.c (partition_new, partition_delete, partition_union)
(elem_compare, partition_print): Likewise.
* obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk,
_obstack_allocated_p, _obstack_free, obstack_free,
_obstack_memory_used, print_and_abort, obstack_next_free,
obstack_object_size, obstack_base): Likewise. Remove codes
predicated on !defined(__STDC__).
* objalloc.c (objalloc_create, _objalloc_alloc, objalloc_free,
objalloc_free_block): Use ISO C prototypes.
* mkstemps.c (mkstemps): Likewise.
* memset.c (memset): Likewise.
* mempcpy.c (mempcpy): Likewise.
* rename.c (rename): Likewise.
* rindex.c (rindex): Likewise.
* setenv.c (setenv, unsetenv): Likewise.
* sigsetmask.c (sigsetmask): Likewise.
* snprintf.c (snprintf): Likewise.
* sort.c (sort_pointers, xmalloc): Likewise.
* spaces.c (spaces): Likewise.
* splay-tree.c (splay_tree_delete_helper,
splay_tree_splay_helper, splay_tree_splay,
splay_tree_foreach_helper, splay_tree_xmalloc_allocate,
splay_tree_new, splay_tree_xmalloc_allocate,
splay_tree_new_with_allocator, splay_tree_delete,
splay_tree_insert, splay_tree_remove, splay_tree_lookup,
splay_tree_max, splay_tree_min, splay_tree_predecessor,
splay_tree_successor, splay_tree_foreach,
splay_tree_compare_ints, splay_tree_compare_pointers): Likewise.
* stpcpy.c (stpcpy): Likewise.
* stpncpy.c (stpncpy): Likewise.
* strcasecmp.c (strcasecmp): Likewise.
* strchr.c (strchr): Likewise.
* strdup.c (strdup): Likewise.

2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>

Convert libiberty to use ISO C prototype style 6/n.
Expand Down
13 changes: 3 additions & 10 deletions libiberty/mempcpy.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Implement the mempcpy function.
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library.
Expand Down Expand Up @@ -30,19 +30,12 @@ Copies @var{length} bytes from memory region @var{in} to region
*/

#include <ansidecl.h>
#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
#endif

extern PTR memcpy PARAMS ((PTR, const PTR, size_t));
extern PTR memcpy (PTR, const PTR, size_t);

PTR
mempcpy (dst, src, len)
PTR dst;
const PTR src;
size_t len;
mempcpy (PTR dst, const PTR src, size_t len)
{
return (char *) memcpy (dst, src, len) + len;
}
Loading

0 comments on commit f8d9d6a

Please sign in to comment.