Commit 838f8562 by Kaveh R. Ghazi Committed by Kaveh Ghazi

Warning fixes:

	* cp-demangle.c (cp_demangle_type): Wrap in IN_LIBGCC2.

	* setenv.c (setenv): Initialize variable `ep'.

	* sigsetmask.c (abort): Prototype.

	* vasprintf.c: Include config.h.  Check ANSI_PROTOTYPES, not
	__STDC__ for stdarg.h include.
	(int_vasprintf): Prototype.
	(checkit): Prototype.  Use VPARAMS/ANSI_PROTOTYPES/VA_START in
	definition.  Cast `global_total_width' in comparison.
	(main): Prototype.  Return a value.

	* vfork.c (fork): Prototype.

	* xexit.c: Include config.h.

From-SVN: r35178
parent 058ef853
2000-07-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cp-demangle.c (cp_demangle_type): Wrap in IN_LIBGCC2.
* setenv.c (setenv): Initialize variable `ep'.
* sigsetmask.c (abort): Prototype.
* vasprintf.c: Include config.h. Check ANSI_PROTOTYPES, not
__STDC__ for stdarg.h include.
(int_vasprintf): Prototype.
(checkit): Prototype. Use VPARAMS/ANSI_PROTOTYPES/VA_START in
definition. Cast `global_total_width' in comparison.
(main): Prototype. Return a value.
* vfork.c (fork): Prototype.
* xexit.c: Include config.h.
2000-07-20 Joseph S. Myers <jsm28@cam.ac.uk> 2000-07-20 Joseph S. Myers <jsm28@cam.ac.uk>
* cplus-dem.c (demangle_fund_type): Make 'dec' an unsigned int, * cplus-dem.c (demangle_fund_type): Make 'dec' an unsigned int,
......
...@@ -852,8 +852,10 @@ static status_t demangle_discriminator ...@@ -852,8 +852,10 @@ static status_t demangle_discriminator
PARAMS ((demangling_t, int)); PARAMS ((demangling_t, int));
static status_t cp_demangle static status_t cp_demangle
PARAMS ((const char *, dyn_string_t)); PARAMS ((const char *, dyn_string_t));
#ifdef IN_LIBGCC2
static status_t cp_demangle_type static status_t cp_demangle_type
PARAMS ((const char*, dyn_string_t)); PARAMS ((const char*, dyn_string_t));
#endif
/* When passed to demangle_bare_function_type, indicates that the /* When passed to demangle_bare_function_type, indicates that the
function's return type is not encoded before its parameter types. */ function's return type is not encoded before its parameter types. */
...@@ -3023,6 +3025,7 @@ cp_demangle (name, result) ...@@ -3023,6 +3025,7 @@ cp_demangle (name, result)
dyn_string_t. On success, returns STATUS_OK. On failiure, returns dyn_string_t. On success, returns STATUS_OK. On failiure, returns
an error message, and the contents of RESULT are unchanged. */ an error message, and the contents of RESULT are unchanged. */
#ifdef IN_LIBGCC2
static status_t static status_t
cp_demangle_type (type_name, result) cp_demangle_type (type_name, result)
const char* type_name; const char* type_name;
...@@ -3060,9 +3063,6 @@ cp_demangle_type (type_name, result) ...@@ -3060,9 +3063,6 @@ cp_demangle_type (type_name, result)
return status; return status;
} }
#ifdef IN_LIBGCC2
extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *)); extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *));
/* ABI-mandated entry point in the C++ runtime library for performing /* ABI-mandated entry point in the C++ runtime library for performing
......
...@@ -63,7 +63,7 @@ setenv (name, value, replace) ...@@ -63,7 +63,7 @@ setenv (name, value, replace)
const char *value; const char *value;
int replace; int replace;
{ {
register char **ep; register char **ep = 0;
register size_t size; register size_t size;
const size_t namelen = strlen (name); const size_t namelen = strlen (name);
const size_t vallen = strlen (value) + 1; const size_t vallen = strlen (value) + 1;
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <signal.h> #include <signal.h>
extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN;
#ifdef SIG_SETMASK #ifdef SIG_SETMASK
int int
DEFUN(sigsetmask,(set), DEFUN(sigsetmask,(set),
......
...@@ -18,21 +18,31 @@ License along with libiberty; see the file COPYING.LIB. If ...@@ -18,21 +18,31 @@ License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifdef __STDC__ #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <ansidecl.h>
#ifdef ANSI_PROTOTYPES
#include <stdarg.h> #include <stdarg.h>
#else #else
#include <varargs.h> #include <varargs.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ansidecl.h> #ifdef HAVE_STDLIB_H
#include <stdlib.h>
#else
extern unsigned long strtoul ();
extern PTR malloc ();
#endif
#include "libiberty.h"
#ifdef TEST #ifdef TEST
int global_total_width; int global_total_width;
#endif #endif
unsigned long strtoul ();
char *malloc (); static int int_vasprintf PARAMS ((char **, const char *, va_list *));
static int static int
int_vasprintf (result, format, args) int_vasprintf (result, format, args)
...@@ -60,7 +70,7 @@ int_vasprintf (result, format, args) ...@@ -60,7 +70,7 @@ int_vasprintf (result, format, args)
total_width += abs (va_arg (ap, int)); total_width += abs (va_arg (ap, int));
} }
else else
total_width += strtoul (p, &p, 10); total_width += strtoul (p, (char **) &p, 10);
if (*p == '.') if (*p == '.')
{ {
++p; ++p;
...@@ -70,7 +80,7 @@ int_vasprintf (result, format, args) ...@@ -70,7 +80,7 @@ int_vasprintf (result, format, args)
total_width += abs (va_arg (ap, int)); total_width += abs (va_arg (ap, int));
} }
else else
total_width += strtoul (p, &p, 10); total_width += strtoul (p, (char **) &p, 10);
} }
while (strchr ("hlL", *p)) while (strchr ("hlL", *p))
++p; ++p;
...@@ -132,33 +142,33 @@ vasprintf (result, format, args) ...@@ -132,33 +142,33 @@ vasprintf (result, format, args)
} }
#ifdef TEST #ifdef TEST
void static void checkit PARAMS ((const char *, ...));
checkit
#ifdef __STDC__ static void
(const char* format, ...) checkit VPARAMS ((const char* format, ...))
#else
(va_alist)
va_dcl
#endif
{ {
va_list args; va_list args;
char *result; char *result;
#ifndef ANSI_PROTOTYPES
const char *format;
#endif
#ifdef __STDC__ VA_START (args, format);
va_start (args, format);
#else #ifndef ANSI_PROTOTYPES
char *format; format = va_arg (args, const char *);
va_start (args);
format = va_arg (args, char *);
#endif #endif
vasprintf (&result, format, args); vasprintf (&result, format, args);
if (strlen (result) < global_total_width) if (strlen (result) < (size_t) global_total_width)
printf ("PASS: "); printf ("PASS: ");
else else
printf ("FAIL: "); printf ("FAIL: ");
printf ("%d %s\n", global_total_width, result); printf ("%d %s\n", global_total_width, result);
} }
extern int main PARAMS ((void));
int int
main () main ()
{ {
...@@ -169,5 +179,7 @@ main () ...@@ -169,5 +179,7 @@ main ()
checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\ checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
777777777777777777333333333333366666666666622222222222777777777777733333"); 777777777777777777333333333333366666666666622222222222777777777777733333");
checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"); checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
return 0;
} }
#endif /* TEST */ #endif /* TEST */
/* Emulate vfork using just plain fork, for systems without a real vfork. /* Emulate vfork using just plain fork, for systems without a real vfork.
This function is in the public domain. */ This function is in the public domain. */
#include "ansidecl.h"
extern int fork PARAMS ((void));
int int
vfork () vfork ()
{ {
......
...@@ -17,13 +17,15 @@ License along with libiberty; see the file COPYING.LIB. If not, write ...@@ -17,13 +17,15 @@ License along with libiberty; see the file COPYING.LIB. If not, write
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include "ansidecl.h" #ifdef HAVE_CONFIG_H
#include "libiberty.h" #include "config.h"
#endif
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include "libiberty.h"
/* This variable is set by xatexit if it is called. This way, xmalloc /* This variable is set by xatexit if it is called. This way, xmalloc
doesn't drag xatexit into the link. */ doesn't drag xatexit into the link. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment