This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Convert libiberty to use ISO C prototype style65/n
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: 28 Mar 2005 00:49:12 +0200
- Subject: Convert libiberty to use ISO C prototype style65/n
- Organization: Integrable Solutions
The sixth set. Bootstrapping is running.
It remains to convert the regex component.
-- Gaby
include/
2005-03-27 Gabriel Dos Reis <gdr@integreable-solutions.net>
* ternary.h: Don't use PARAMS anymore.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 6/n.
* strerror.c (init_error_tables, errno_max, strerror, strerrno,
strtoerrno, main): Use ISO C prototype style.
* strncasecmp.c (strncasecmp): Likewise.
* strncmp.c (strncmp): Likewise.
* strndup.c (strndup): Likewise.
* strrchr.c (strrchr): Likewise.
* strsignal.c (init_signal_tables, signo_max, strsignal,
strsigno, strtosigno, psignal, main): Likewise.
* strstr.c (strstr): Likewise.
* strtod.c (strtod, atof): Likewise.
* strtol.c (strtol): Likewise.
* strtoul.c (strtoul): Likewise.
* ternary.c (ternary_insert, ternary_cleanup, ternary_search,
ternary_recursivesearch): Likewise.
* tmpnam.c (tmpnam): Likewise.
* unlink-if-ordinary.c (unlink_if_ordinary): Likewise.
* vasprintf.c (int_vasprintf, vasprintf, checkit, main): Likewise.
* vfork.c (vfork): Likewise.
* vfprintf.c (vfprintf): Likewise.
* vprintf.c (vprintf): Likewise.
* vsnprintf.c (vsnprintf, checkit, main): Likewise.
* vsprintf.c (vsprintf): Likewise.
* waitpid.c (waitpid): Likewise.
* xatexit.c (xatexit, xatexit_cleanup): Likewise.
* xexit.c (xexit): Likewise.
* xmalloc.c (xmalloc_set_program_name, xmalloc_failed, xmalloc,
xcalloc, xrealloc): Likewise.
* xmemdup.c (xmemdup): Likewise.
* xstrdup.c (xstrdup): Likewise.
* xstrerror.c (xstrerror): Likewise.
* xstrndup.c (xstrndup): Likewise.
Index: include/ternary.h
===================================================================
RCS file: /cvs/gcc/gcc/include/ternary.h,v
retrieving revision 1.2
diff -p -r1.2 ternary.h
*** include/ternary.h 8 May 2001 06:13:58 -0000 1.2
--- include/ternary.h 27 Mar 2005 22:50:24 -0000
*************** ternary_node;
*** 38,51 ****
already there, and replace is 0.
Otherwise, replaces if it it exists, inserts if it doesn't, and
returns the data you passed in. */
! PTR ternary_insert PARAMS ((ternary_tree *p, const char *s,
! PTR data, int replace));
/* Delete the ternary search tree rooted at P.
Does NOT delete the data you associated with the strings. */
! void ternary_cleanup PARAMS ((ternary_tree p));
/* Search the ternary tree for string S, returning the data associated
with it if found. */
! PTR ternary_search PARAMS ((const ternary_node *p, const char *s));
#endif
--- 38,51 ----
already there, and replace is 0.
Otherwise, replaces if it it exists, inserts if it doesn't, and
returns the data you passed in. */
! PTR ternary_insert (ternary_tree *p, const char *s,
! PTR data, int replace);
/* Delete the ternary search tree rooted at P.
Does NOT delete the data you associated with the strings. */
! void ternary_cleanup (ternary_tree p);
/* Search the ternary tree for string S, returning the data associated
with it if found. */
! PTR ternary_search (const ternary_node *p, const char *s);
#endif
Index: libiberty/strerror.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strerror.c,v
retrieving revision 1.13
diff -p -r1.13 strerror.c
*** libiberty/strerror.c 13 Apr 2004 19:46:01 -0000 1.13
--- libiberty/strerror.c 27 Mar 2005 22:50:25 -0000
*************** extern PTR memset ();
*** 43,49 ****
# define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
! static void init_error_tables PARAMS ((void));
/* Translation table for errno values. See intro(2) in most UNIX systems
Programmers Reference Manuals.
--- 43,49 ----
# define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
! static void init_error_tables (void);
/* Translation table for errno values. See intro(2) in most UNIX systems
Programmers Reference Manuals.
*************** BUGS
*** 503,509 ****
*/
static void
! init_error_tables ()
{
const struct error_info *eip;
int nbytes;
--- 503,509 ----
*/
static void
! init_error_tables (void)
{
const struct error_info *eip;
int nbytes;
*************** symbolic name or message.
*** 584,590 ****
*/
int
! errno_max ()
{
int maxsize;
--- 584,590 ----
*/
int
! errno_max (void)
{
int maxsize;
*************** next call to @code{strerror}.
*** 623,630 ****
*/
char *
! strerror (errnoval)
! int errnoval;
{
const char *msg;
static char buf[32];
--- 623,629 ----
*/
char *
! strerror (int errnoval)
{
const char *msg;
static char buf[32];
*************** valid until the next call to @code{strer
*** 690,697 ****
*/
const char *
! strerrno (errnoval)
! int errnoval;
{
const char *name;
static char buf[32];
--- 689,695 ----
*/
const char *
! strerrno (int errnoval)
{
const char *name;
static char buf[32];
*************** to an errno value. If no translation is
*** 738,745 ****
*/
int
! strtoerrno (name)
! const char *name;
{
int errnoval = 0;
--- 736,742 ----
*/
int
! strtoerrno (const char *name)
{
int errnoval = 0;
*************** strtoerrno (name)
*** 779,785 ****
#include <stdio.h>
int
! main ()
{
int errn;
int errnmax;
--- 776,782 ----
#include <stdio.h>
int
! main (void)
{
int errn;
int errnmax;
Index: libiberty/strncasecmp.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strncasecmp.c,v
retrieving revision 1.5
diff -p -r1.5 strncasecmp.c
*** libiberty/strncasecmp.c 15 Apr 2003 03:35:47 -0000 1.5
--- libiberty/strncasecmp.c 27 Mar 2005 22:50:25 -0000
*************** static char sccsid[] = "@(#)strcasecmp.c
*** 25,35 ****
#endif /* LIBC_SCCS and not lint */
#include <ansidecl.h>
- #ifdef ANSI_PROTOTYPES
#include <stddef.h>
- #else
- #define size_t unsigned long
- #endif
/*
* This array is designed for mapping upper and lower case letter
--- 25,31 ----
*************** static const unsigned char charmap[] = {
*** 72,80 ****
};
int
! strncasecmp(s1, s2, n)
! const char *s1, *s2;
! register size_t n;
{
register unsigned char u1, u2;
--- 68,74 ----
};
int
! strncasecmp(const char *s1, const char *s2, register size_t n)
{
register unsigned char u1, u2;
Index: libiberty/strncmp.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strncmp.c,v
retrieving revision 1.3
diff -p -r1.3 strncmp.c
*** libiberty/strncmp.c 15 Apr 2003 03:35:47 -0000 1.3
--- libiberty/strncmp.c 27 Mar 2005 22:50:25 -0000
*************** Compares the first @var{n} bytes of two
*** 13,28 ****
*/
#include <ansidecl.h>
- #ifdef ANSI_PROTOTYPES
#include <stddef.h>
- #else
- #define size_t unsigned long
- #endif
int
! strncmp(s1, s2, n)
! const char *s1, *s2;
! register size_t n;
{
register unsigned char u1, u2;
--- 13,22 ----
*/
#include <ansidecl.h>
#include <stddef.h>
int
! strncmp(const char *s1, const char *s2, register size_t n)
{
register unsigned char u1, u2;
Index: libiberty/strndup.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strndup.c,v
retrieving revision 1.1
diff -p -r1.1 strndup.c
*** libiberty/strndup.c 25 Mar 2005 04:41:38 -0000 1.1
--- libiberty/strndup.c 27 Mar 2005 22:50:25 -0000
*************** memory was available. The result is alw
*** 31,50 ****
*/
#include "ansidecl.h"
- #ifdef ANSI_PROTOTYPES
#include <stddef.h>
- #else
- #define size_t unsigned long
- #endif
! extern size_t strlen PARAMS ((const char*));
! extern PTR malloc PARAMS ((size_t));
! extern PTR memcpy PARAMS ((PTR, const PTR, size_t));
char *
! strndup(s, n)
! const char *s;
! size_t n;
{
char *result;
size_t len = strlen (s);
--- 31,44 ----
*/
#include "ansidecl.h"
#include <stddef.h>
! extern size_t strlen (const char*);
! extern PTR malloc (size_t);
! extern PTR memcpy (PTR, const PTR, size_t);
char *
! strndup (const char *s, size_t n)
{
char *result;
size_t len = strlen (s);
Index: libiberty/strrchr.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strrchr.c,v
retrieving revision 1.6
diff -p -r1.6 strrchr.c
*** libiberty/strrchr.c 7 Oct 2001 21:53:31 -0000 1.6
--- libiberty/strrchr.c 27 Mar 2005 22:50:25 -0000
*************** null character, the results are undefine
*** 16,24 ****
#include <ansidecl.h>
char *
! strrchr (s, c)
! register const char *s;
! int c;
{
char *rtnval = 0;
--- 16,22 ----
#include <ansidecl.h>
char *
! strrchr (register const char *s, int c)
{
char *rtnval = 0;
Index: libiberty/strsignal.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strsignal.c,v
retrieving revision 1.12
diff -p -r1.12 strsignal.c
*** libiberty/strsignal.c 20 Nov 2004 02:44:34 -0000 1.12
--- libiberty/strsignal.c 27 Mar 2005 22:50:25 -0000
*************** extern PTR memset ();
*** 41,58 ****
#undef sys_nsig
#ifndef NULL
! # ifdef ANSI_PROTOTYPES
! # define NULL (void *) 0
! # else
! # define NULL 0
! # endif
#endif
#ifndef MAX
# define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
! static void init_signal_tables PARAMS ((void));
/* Translation table for signal values.
--- 41,54 ----
#undef sys_nsig
#ifndef NULL
! # define NULL (void *) 0
#endif
#ifndef MAX
# define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
! static void init_signal_tables (void);
/* Translation table for signal values.
*************** BUGS
*** 288,294 ****
*/
static void
! init_signal_tables ()
{
const struct signal_info *eip;
int nbytes;
--- 284,290 ----
*/
static void
! init_signal_tables (void)
{
const struct signal_info *eip;
int nbytes;
*************** symbolic name or message.
*** 369,375 ****
*/
int
! signo_max ()
{
int maxsize;
--- 365,371 ----
*/
int
! signo_max (void)
{
int maxsize;
*************** call to @code{strsignal}.
*** 409,416 ****
#ifndef HAVE_STRSIGNAL
const char *
! strsignal (signo)
! int signo;
{
const char *msg;
static char buf[32];
--- 405,411 ----
#ifndef HAVE_STRSIGNAL
const char *
! strsignal (int signo)
{
const char *msg;
static char buf[32];
*************** valid until the next call to @code{strsi
*** 469,476 ****
*/
const char *
! strsigno (signo)
! int signo;
{
const char *name;
static char buf[32];
--- 464,470 ----
*/
const char *
! strsigno (int signo)
{
const char *name;
static char buf[32];
*************** translation is found, returns 0.
*** 513,520 ****
*/
int
! strtosigno (name)
! const char *name;
{
int signo = 0;
--- 507,513 ----
*/
int
! strtosigno (const char *name)
{
int signo = 0;
*************** followed by a newline.
*** 556,564 ****
#ifndef HAVE_PSIGNAL
void
! psignal (signo, message)
! unsigned signo;
! char *message;
{
if (signal_names == NULL)
{
--- 549,555 ----
#ifndef HAVE_PSIGNAL
void
! psignal (unsigned signo, char *message)
{
if (signal_names == NULL)
{
*************** psignal (signo, message)
*** 585,591 ****
#include <stdio.h>
int
! main ()
{
int signo;
int maxsigno;
--- 576,582 ----
#include <stdio.h>
int
! main (void)
{
int signo;
int maxsigno;
Index: libiberty/strstr.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strstr.c,v
retrieving revision 1.6
diff -p -r1.6 strstr.c
*** libiberty/strstr.c 15 Apr 2003 20:36:33 -0000 1.6
--- libiberty/strstr.c 27 Mar 2005 22:50:25 -0000
*************** length, the function returns @var{string
*** 21,28 ****
been validated to comply with it. -fnf */
char *
! strstr (s1, s2)
! char *s1, *s2;
{
register char *p = s1;
extern char *strchr ();
--- 21,27 ----
been validated to comply with it. -fnf */
char *
! strstr (char *s1, char *s2)
{
register char *p = s1;
extern char *strchr ();
Index: libiberty/strtod.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strtod.c,v
retrieving revision 1.8
diff -p -r1.8 strtod.c
*** libiberty/strtod.c 18 Mar 2002 19:52:14 -0000 1.8
--- libiberty/strtod.c 27 Mar 2005 22:50:25 -0000
*************** the location referenced by @var{endptr}.
*** 40,55 ****
#include "ansidecl.h"
#include "safe-ctype.h"
! extern double atof ();
/* Disclaimer: this is currently just used by CHILL in GDB and therefore
has not been tested well. It may have been tested for nothing except
that it compiles. */
double
! strtod (str, ptr)
! char *str;
! char **ptr;
{
char *p;
--- 40,53 ----
#include "ansidecl.h"
#include "safe-ctype.h"
! extern double atof (const char *);
/* Disclaimer: this is currently just used by CHILL in GDB and therefore
has not been tested well. It may have been tested for nothing except
that it compiles. */
double
! strtod (char *str, char **ptr)
{
char *p;
Index: libiberty/strtol.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strtol.c,v
retrieving revision 1.10
diff -p -r1.10 strtol.c
*** libiberty/strtol.c 16 Oct 2001 02:50:13 -0000 1.10
--- libiberty/strtol.c 27 Mar 2005 22:50:25 -0000
*************** extern int errno;
*** 85,94 ****
* alphabets and digits are each contiguous.
*/
long
! strtol(nptr, endptr, base)
! const char *nptr;
! char **endptr;
! register int base;
{
register const char *s = nptr;
register unsigned long acc;
--- 85,91 ----
* alphabets and digits are each contiguous.
*/
long
! strtol(const char *nptr, char **endptr, register int base)
{
register const char *s = nptr;
register unsigned long acc;
Index: libiberty/strtoul.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strtoul.c,v
retrieving revision 1.9
diff -p -r1.9 strtoul.c
*** libiberty/strtoul.c 13 Dec 2000 17:44:01 -0000 1.9
--- libiberty/strtoul.c 27 Mar 2005 22:50:25 -0000
*************** extern int errno;
*** 58,67 ****
* alphabets and digits are each contiguous.
*/
unsigned long
! strtoul(nptr, endptr, base)
! const char *nptr;
! char **endptr;
! register int base;
{
register const char *s = nptr;
register unsigned long acc;
--- 58,64 ----
* alphabets and digits are each contiguous.
*/
unsigned long
! strtoul(const char *nptr, char **endptr, register int base)
{
register const char *s = nptr;
register unsigned long acc;
Index: libiberty/ternary.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/ternary.c,v
retrieving revision 1.2
diff -p -r1.2 ternary.c
*** libiberty/ternary.c 8 May 2001 06:13:58 -0000 1.2
--- libiberty/ternary.c 27 Mar 2005 22:50:25 -0000
***************
*** 34,44 ****
insertions. */
PTR
! ternary_insert (root, s, data, replace)
! ternary_tree *root;
! const char *s;
! PTR data;
! int replace;
{
int diff;
ternary_tree curr, *pcurr;
--- 34,40 ----
insertions. */
PTR
! ternary_insert (ternary_tree *root, const char *s, PTR data, int replace)
{
int diff;
ternary_tree curr, *pcurr;
*************** ternary_insert (root, s, data, replace)
*** 98,105 ****
/* Free the ternary search tree rooted at p. */
void
! ternary_cleanup (p)
! ternary_tree p;
{
if (p)
{
--- 94,100 ----
/* Free the ternary search tree rooted at p. */
void
! ternary_cleanup (ternary_tree p)
{
if (p)
{
*************** ternary_cleanup (p)
*** 113,121 ****
/* Non-recursive find of a string in the ternary tree */
PTR
! ternary_search (p, s)
! const ternary_node *p;
! const char *s;
{
const ternary_node *curr;
int diff, spchar;
--- 108,114 ----
/* Non-recursive find of a string in the ternary tree */
PTR
! ternary_search (const ternary_node *p, const char *s)
{
const ternary_node *curr;
int diff, spchar;
*************** ternary_search (p, s)
*** 147,155 ****
/* For those who care, the recursive version of the search. Useful if
you want a starting point for pmsearch or nearsearch. */
static PTR
! ternary_recursivesearch (p, s)
! const ternary_node *p;
! const char *s;
{
if (!p)
return 0;
--- 140,146 ----
/* For those who care, the recursive version of the search. Useful if
you want a starting point for pmsearch or nearsearch. */
static PTR
! ternary_recursivesearch (const ternary_node *p, const char *s)
{
if (!p)
return 0;
Index: libiberty/tmpnam.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/tmpnam.c,v
retrieving revision 1.5
diff -p -r1.5 tmpnam.c
*** libiberty/tmpnam.c 7 Oct 2001 21:53:31 -0000 1.5
--- libiberty/tmpnam.c 27 Mar 2005 22:50:25 -0000
*************** not be used in new projects. Use @code{
*** 24,34 ****
static char tmpnam_buffer[L_tmpnam];
static int tmpnam_counter;
! extern int getpid ();
char *
! tmpnam (s)
! char *s;
{
int pid = getpid ();
--- 24,33 ----
static char tmpnam_buffer[L_tmpnam];
static int tmpnam_counter;
! extern int getpid (void);
char *
! tmpnam (char *s)
{
int pid = getpid ();
Index: libiberty/unlink-if-ordinary.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/unlink-if-ordinary.c,v
retrieving revision 1.1
diff -p -r1.1 unlink-if-ordinary.c
*** libiberty/unlink-if-ordinary.c 1 Mar 2005 09:23:26 -0000 1.1
--- libiberty/unlink-if-ordinary.c 27 Mar 2005 22:50:25 -0000
*************** was made to unlink the file because it i
*** 58,65 ****
#endif
int
! unlink_if_ordinary (name)
! const char *name;
{
struct stat st;
--- 58,64 ----
#endif
int
! unlink_if_ordinary (const char *name)
{
struct stat st;
Index: libiberty/vasprintf.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/vasprintf.c,v
retrieving revision 1.14
diff -p -r1.14 vasprintf.c
*** libiberty/vasprintf.c 8 Sep 2004 21:29:42 -0000 1.14
--- libiberty/vasprintf.c 27 Mar 2005 22:50:25 -0000
*************** Boston, MA 02111-1307, USA. */
*** 22,32 ****
#include "config.h"
#endif
#include <ansidecl.h>
- #ifdef ANSI_PROTOTYPES
#include <stdarg.h>
- #else
- #include <varargs.h>
- #endif
#if !defined (va_copy) && defined (__va_copy)
# define va_copy(d,s) __va_copy((d),(s))
#endif
--- 22,28 ----
*************** not be allocated, minus one is returned
*** 62,74 ****
*/
! static int int_vasprintf PARAMS ((char **, const char *, va_list));
static int
! int_vasprintf (result, format, args)
! char **result;
! const char *format;
! va_list args;
{
const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc
--- 58,67 ----
*/
! static int int_vasprintf (char **, const char *, va_list);
static int
! int_vasprintf (char **result, const char *format, va_list args)
{
const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc
*************** int_vasprintf (result, format, args)
*** 156,168 ****
}
int
! vasprintf (result, format, args)
! char **result;
! const char *format;
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
! _BSD_VA_LIST_ args;
#else
! va_list args;
#endif
{
return int_vasprintf (result, format, args);
--- 149,159 ----
}
int
! vasprintf (char **result, const char *format,
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
! _BSD_VA_LIST_ args)
#else
! va_list args)
#endif
{
return int_vasprintf (result, format, args);
*************** vasprintf (result, format, args)
*** 170,176 ****
#ifdef TEST
static void ATTRIBUTE_PRINTF_1
! checkit VPARAMS ((const char *format, ...))
{
char *result;
VA_OPEN (args, format);
--- 161,167 ----
#ifdef TEST
static void ATTRIBUTE_PRINTF_1
! checkit (const char *format, ...)
{
char *result;
VA_OPEN (args, format);
*************** checkit VPARAMS ((const char *format, ..
*** 187,196 ****
free (result);
}
! extern int main PARAMS ((void));
int
! main ()
{
checkit ("%d", 0x12345678);
checkit ("%200d", 5);
--- 178,187 ----
free (result);
}
! extern int main (void);
int
! main (void)
{
checkit ("%d", 0x12345678);
checkit ("%200d", 5);
Index: libiberty/vfork.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/vfork.c,v
retrieving revision 1.5
diff -p -r1.5 vfork.c
*** libiberty/vfork.c 7 Oct 2001 21:53:31 -0000 1.5
--- libiberty/vfork.c 27 Mar 2005 22:50:25 -0000
*************** Emulates @code{vfork} by calling @code{f
*** 13,22 ****
#include "ansidecl.h"
! extern int fork PARAMS ((void));
int
! vfork ()
{
return (fork ());
}
--- 13,22 ----
#include "ansidecl.h"
! extern int fork (void);
int
! vfork (void)
{
return (fork ());
}
Index: libiberty/vfprintf.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/vfprintf.c,v
retrieving revision 1.4
diff -p -r1.4 vfprintf.c
*** libiberty/vfprintf.c 15 Apr 2003 20:36:33 -0000 1.4
--- libiberty/vfprintf.c 27 Mar 2005 22:50:25 -0000
***************
*** 4,22 ****
*/
#include "ansidecl.h"
- #ifdef ANSI_PROTOTYPES
#include <stdarg.h>
- #else
- #include <varargs.h>
- #endif
#include <stdio.h>
#undef vfprintf
int
! vfprintf (stream, format, ap)
! FILE * stream;
! const char * format;
! va_list ap;
{
return _doprnt (format, ap, stream);
}
--- 4,15 ----
*/
#include "ansidecl.h"
#include <stdarg.h>
#include <stdio.h>
#undef vfprintf
int
! vfprintf (FILE *stream, const char *format, va_list ap)
{
return _doprnt (format, ap, stream);
}
Index: libiberty/vprintf.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/vprintf.c,v
retrieving revision 1.5
diff -p -r1.5 vprintf.c
*** libiberty/vprintf.c 15 Apr 2003 20:36:33 -0000 1.5
--- libiberty/vprintf.c 27 Mar 2005 22:50:25 -0000
*************** nonstandard but common function @code{_d
*** 16,32 ****
*/
#include <ansidecl.h>
- #ifdef ANSI_PROTOTYPES
#include <stdarg.h>
- #else
- #include <varargs.h>
- #endif
#include <stdio.h>
#undef vprintf
int
! vprintf (format, ap)
! const char *format;
! va_list ap;
{
return vfprintf (stdout, format, ap);
}
--- 16,26 ----
*/
#include <ansidecl.h>
#include <stdarg.h>
#include <stdio.h>
#undef vprintf
int
! vprintf (const char *format, va_list ap)
{
return vfprintf (stdout, format, ap);
}
Index: libiberty/vsnprintf.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/vsnprintf.c,v
retrieving revision 1.2
diff -p -r1.2 vsnprintf.c
*** libiberty/vsnprintf.c 22 Apr 2003 19:58:57 -0000 1.2
--- libiberty/vsnprintf.c 27 Mar 2005 22:50:25 -0000
***************
*** 1,5 ****
/* Implement the vsnprintf function.
! Copyright (C) 2003 Free Software Foundation, Inc.
Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This library is free
--- 1,5 ----
/* Implement the vsnprintf function.
! 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. This library is free
*************** system version of this function is used.
*** 42,52 ****
#include "config.h"
#include "ansidecl.h"
- #ifdef ANSI_PROTOTYPES
#include <stdarg.h>
- #else
- #include <varargs.h>
- #endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
--- 42,48 ----
*************** system version of this function is used.
*** 58,68 ****
/* This implementation relies on a working vasprintf. */
int
! vsnprintf (s, n, format, ap)
! char * s;
! size_t n;
! const char *format;
! va_list ap;
{
char *buf = 0;
int result = vasprintf (&buf, format, ap);
--- 54,60 ----
/* This implementation relies on a working vasprintf. */
int
! vsnprintf (char *s, size_t n, const char *format, va_list ap)
{
char *buf = 0;
int result = vasprintf (&buf, format, ap);
*************** vsnprintf (s, n, format, ap)
*** 97,103 ****
#define VERIFY(P) do { if (!(P)) abort(); } while (0)
static int ATTRIBUTE_PRINTF_3
! checkit VPARAMS ((char *s, size_t n, const char *format, ...))
{
int result;
VA_OPEN (ap, format);
--- 89,95 ----
#define VERIFY(P) do { if (!(P)) abort(); } while (0)
static int ATTRIBUTE_PRINTF_3
! checkit (char *s, size_t n, const char *format, ...)
{
int result;
VA_OPEN (ap, format);
*************** checkit VPARAMS ((char *s, size_t n, con
*** 109,117 ****
return result;
}
! extern int main PARAMS ((void));
int
! main ()
{
char buf[128];
int status;
--- 101,109 ----
return result;
}
! extern int main (void);
int
! main (void)
{
char buf[128];
int status;
Index: libiberty/vsprintf.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/vsprintf.c,v
retrieving revision 1.4
diff -p -r1.4 vsprintf.c
*** libiberty/vsprintf.c 15 Apr 2003 20:36:33 -0000 1.4
--- libiberty/vsprintf.c 27 Mar 2005 22:50:25 -0000
*************** This exception does not however invalida
*** 27,47 ****
the executable file might be covered by the GNU General Public License. */
#include <ansidecl.h>
- #ifdef ANSI_PROTOTYPES
#include <stdarg.h>
- #else
- #include <varargs.h>
- #endif
#include <stdio.h>
#undef vsprintf
#if defined _IOSTRG && defined _IOWRT
int
! vsprintf (buf, format, ap)
! char *buf;
! const char *format;
! va_list ap;
{
FILE b;
int ret;
--- 27,40 ----
the executable file might be covered by the GNU General Public License. */
#include <ansidecl.h>
#include <stdarg.h>
#include <stdio.h>
#undef vsprintf
#if defined _IOSTRG && defined _IOWRT
int
! vsprintf (char *buf, const char *format, va_list ap)
{
FILE b;
int ret;
Index: libiberty/waitpid.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/waitpid.c,v
retrieving revision 1.5
diff -p -r1.5 waitpid.c
*** libiberty/waitpid.c 7 May 2002 18:50:53 -0000 1.5
--- libiberty/waitpid.c 27 Mar 2005 22:50:25 -0000
*************** does the return value. The third argume
*** 23,31 ****
#endif
pid_t
! waitpid (pid, stat_loc, options)
! pid_t pid;
! int *stat_loc, options;
{
for (;;)
{
--- 23,29 ----
#endif
pid_t
! waitpid (pid_t pid, int *stat_loc, int options)
{
for (;;)
{
Index: libiberty/xatexit.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/xatexit.c,v
retrieving revision 1.7
diff -p -r1.7 xatexit.c
*** libiberty/xatexit.c 15 Apr 2003 03:35:47 -0000 1.7
--- libiberty/xatexit.c 27 Mar 2005 22:50:25 -0000
*************** failure. If you use @code{xatexit} to r
*** 27,57 ****
#include <stdio.h>
- #ifdef ANSI_PROTOTYPES
#include <stddef.h>
- #else
- #define size_t unsigned long
- #endif
#if VMS
#include <stdlib.h>
#include <unixlib.h>
#else
/* For systems with larger pointers than ints, this must be declared. */
! PTR malloc PARAMS ((size_t));
#endif
! static void xatexit_cleanup PARAMS ((void));
/* Pointer to function run by xexit. */
! extern void (*_xexit_cleanup) PARAMS ((void));
#define XATEXIT_SIZE 32
struct xatexit {
struct xatexit *next; /* next in list */
int ind; /* next index in this table */
! void (*fns[XATEXIT_SIZE]) PARAMS ((void)); /* the table itself */
};
/* Allocate one struct statically to guarantee that we can register
--- 27,53 ----
#include <stdio.h>
#include <stddef.h>
#if VMS
#include <stdlib.h>
#include <unixlib.h>
#else
/* For systems with larger pointers than ints, this must be declared. */
! PTR malloc (size_t);
#endif
! static void xatexit_cleanup (void);
/* Pointer to function run by xexit. */
! extern void (*_xexit_cleanup) (void);
#define XATEXIT_SIZE 32
struct xatexit {
struct xatexit *next; /* next in list */
int ind; /* next index in this table */
! void (*fns[XATEXIT_SIZE]) (void); /* the table itself */
};
/* Allocate one struct statically to guarantee that we can register
*************** static struct xatexit *xatexit_head = &x
*** 65,72 ****
Return 0 if successful, -1 if not. */
int
! xatexit (fn)
! void (*fn) PARAMS ((void));
{
register struct xatexit *p;
--- 61,67 ----
Return 0 if successful, -1 if not. */
int
! xatexit (void (*fn) (void))
{
register struct xatexit *p;
*************** xatexit (fn)
*** 90,96 ****
/* Call any cleanup functions. */
static void
! xatexit_cleanup ()
{
register struct xatexit *p;
register int n;
--- 85,91 ----
/* Call any cleanup functions. */
static void
! xatexit_cleanup (void)
{
register struct xatexit *p;
register int n;
Index: libiberty/xexit.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/xexit.c,v
retrieving revision 1.6
diff -p -r1.6 xexit.c
*** libiberty/xexit.c 27 Sep 2001 19:55:37 -0000 1.6
--- libiberty/xexit.c 27 Mar 2005 22:50:25 -0000
*************** Termination is handled via the system's
*** 41,51 ****
/* This variable is set by xatexit if it is called. This way, xmalloc
doesn't drag xatexit into the link. */
! void (*_xexit_cleanup) PARAMS ((void));
void
! xexit (code)
! int code;
{
if (_xexit_cleanup != NULL)
(*_xexit_cleanup) ();
--- 41,50 ----
/* This variable is set by xatexit if it is called. This way, xmalloc
doesn't drag xatexit into the link. */
! void (*_xexit_cleanup) (void);
void
! xexit (int code)
{
if (_xexit_cleanup != NULL)
(*_xexit_cleanup) ();
Index: libiberty/xmalloc.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/xmalloc.c,v
retrieving revision 1.16
diff -p -r1.16 xmalloc.c
*** libiberty/xmalloc.c 15 Apr 2003 03:35:47 -0000 1.16
--- libiberty/xmalloc.c 27 Mar 2005 22:50:25 -0000
*************** function will be called to print an erro
*** 68,89 ****
#include <stdio.h>
- #ifdef ANSI_PROTOTYPES
#include <stddef.h>
- #else
- #define size_t unsigned long
- #define ptrdiff_t long
- #endif
#if VMS
#include <stdlib.h>
#include <unixlib.h>
#else
/* For systems with larger pointers than ints, these must be declared. */
! PTR malloc PARAMS ((size_t));
! PTR realloc PARAMS ((PTR, size_t));
! PTR calloc PARAMS ((size_t, size_t));
! PTR sbrk PARAMS ((ptrdiff_t));
#endif
/* The program name if set. */
--- 68,84 ----
#include <stdio.h>
#include <stddef.h>
#if VMS
#include <stdlib.h>
#include <unixlib.h>
#else
/* For systems with larger pointers than ints, these must be declared. */
! PTR malloc (size_t);
! PTR realloc (PTR, size_t);
! PTR calloc (size_t, size_t);
! PTR sbrk (ptrdiff_t);
#endif
/* The program name if set. */
*************** static char *first_break = NULL;
*** 96,103 ****
#endif /* HAVE_SBRK */
void
! xmalloc_set_program_name (s)
! const char *s;
{
name = s;
#ifdef HAVE_SBRK
--- 91,97 ----
#endif /* HAVE_SBRK */
void
! xmalloc_set_program_name (const char *s)
{
name = s;
#ifdef HAVE_SBRK
*************** xmalloc_set_program_name (s)
*** 108,115 ****
}
void
! xmalloc_failed (size)
! size_t size;
{
#ifdef HAVE_SBRK
extern char **environ;
--- 102,108 ----
}
void
! xmalloc_failed (size_t size)
{
#ifdef HAVE_SBRK
extern char **environ;
*************** xmalloc_failed (size)
*** 133,140 ****
}
PTR
! xmalloc (size)
! size_t size;
{
PTR newmem;
--- 126,132 ----
}
PTR
! xmalloc (size_t size)
{
PTR newmem;
*************** xmalloc (size)
*** 148,155 ****
}
PTR
! xcalloc (nelem, elsize)
! size_t nelem, elsize;
{
PTR newmem;
--- 140,146 ----
}
PTR
! xcalloc (size_t nelem, size_t elsize)
{
PTR newmem;
*************** xcalloc (nelem, elsize)
*** 164,172 ****
}
PTR
! xrealloc (oldmem, size)
! PTR oldmem;
! size_t size;
{
PTR newmem;
--- 155,161 ----
}
PTR
! xrealloc (PTR oldmem, size_t size)
{
PTR newmem;
Index: libiberty/xmemdup.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/xmemdup.c,v
retrieving revision 1.5
diff -p -r1.5 xmemdup.c
*** libiberty/xmemdup.c 25 Mar 2005 04:05:12 -0000 1.5
--- libiberty/xmemdup.c 27 Mar 2005 22:50:25 -0000
*************** allocated, the remaining memory is zeroe
*** 31,40 ****
#endif
PTR
! xmemdup (input, copy_size, alloc_size)
! const PTR input;
! size_t copy_size;
! size_t alloc_size;
{
PTR output = xcalloc (1, alloc_size);
return (PTR) memcpy (output, input, copy_size);
--- 31,37 ----
#endif
PTR
! xmemdup (const PTR input, size_t copy_size, size_t alloc_size)
{
PTR output = xcalloc (1, alloc_size);
return (PTR) memcpy (output, input, copy_size);
Index: libiberty/xstrdup.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/xstrdup.c,v
retrieving revision 1.8
diff -p -r1.8 xstrdup.c
*** libiberty/xstrdup.c 25 Mar 2005 04:05:12 -0000 1.8
--- libiberty/xstrdup.c 27 Mar 2005 22:50:25 -0000
*************** obtain memory.
*** 28,35 ****
#include "libiberty.h"
char *
! xstrdup (s)
! const char *s;
{
register size_t len = strlen (s) + 1;
register char *ret = xmalloc (len);
--- 28,34 ----
#include "libiberty.h"
char *
! xstrdup (const char *s)
{
register size_t len = strlen (s) + 1;
register char *ret = xmalloc (len);
Index: libiberty/xstrerror.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/xstrerror.c,v
retrieving revision 1.5
diff -p -r1.5 xstrerror.c
*** libiberty/xstrerror.c 20 Nov 2004 02:44:34 -0000 1.5
--- libiberty/xstrerror.c 27 Mar 2005 22:50:25 -0000
*************** will never return a @code{NULL} pointer.
*** 21,33 ****
#ifdef VMS
#include <errno.h>
#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
! extern char *strerror PARAMS ((int,...));
#define DONT_DECLARE_STRERROR
#endif
#endif /* VMS */
#ifndef DONT_DECLARE_STRERROR
! extern char *strerror PARAMS ((int));
#endif
/* If strerror returns NULL, we'll format the number into a static buffer. */
--- 21,33 ----
#ifdef VMS
#include <errno.h>
#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
! extern char *strerror (int,...);
#define DONT_DECLARE_STRERROR
#endif
#endif /* VMS */
#ifndef DONT_DECLARE_STRERROR
! extern char *strerror (int);
#endif
/* If strerror returns NULL, we'll format the number into a static buffer. */
*************** static char xstrerror_buf[sizeof ERRSTR_
*** 38,52 ****
/* Like strerror, but result is never a null pointer. */
char *
! xstrerror (errnum)
! int errnum;
{
char *errstr;
#ifdef VMS
! char *(*vmslib_strerror) PARAMS ((int,...));
/* Override any possibly-conflicting declaration from system header. */
! vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror;
/* Second argument matters iff first is EVMSERR, but it's simpler to
pass it unconditionally. `vaxc$errno' is declared in <errno.h>
and maintained by the run-time library in parallel to `errno'.
--- 38,51 ----
/* Like strerror, but result is never a null pointer. */
char *
! xstrerror (int errnum)
{
char *errstr;
#ifdef VMS
! char *(*vmslib_strerror) (int,...);
/* Override any possibly-conflicting declaration from system header. */
! vmslib_strerror = (char *(*) (int,...)) strerror;
/* Second argument matters iff first is EVMSERR, but it's simpler to
pass it unconditionally. `vaxc$errno' is declared in <errno.h>
and maintained by the run-time library in parallel to `errno'.
Index: libiberty/xstrndup.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/xstrndup.c,v
retrieving revision 1.1
diff -p -r1.1 xstrndup.c
*** libiberty/xstrndup.c 25 Mar 2005 04:41:38 -0000 1.1
--- libiberty/xstrndup.c 27 Mar 2005 22:50:25 -0000
*************** always NUL terminated.
*** 45,53 ****
#include "libiberty.h"
char *
! xstrndup (s, n)
! const char *s;
! size_t n;
{
char *result;
size_t len = strlen (s);
--- 45,51 ----
#include "libiberty.h"
char *
! xstrndup (const char *s, size_t n)
{
char *result;
size_t len = strlen (s);