mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-05 23:26:51 +08:00
merge from gcc
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2001-09-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* asprintf.c: Don't define USE_STDARG. Use VPARAMS, VA_OPEN,
|
||||||
|
VA_FIXEDARG & VA_CLOSE.
|
||||||
|
|
||||||
|
* vasprintf.c: Check HAVE_STRING_H when including string.h.
|
||||||
|
(checkit): Delete redundant prototype. Add ATTRIBUTE_PRINTF_1.
|
||||||
|
Use VA_OPEN, VA_FIXEDARG & VA_CLOSE. Free allocated string.
|
||||||
|
|
||||||
2001-08-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
2001-08-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* concat.c (concat): Use VPARAMS, VA_OPEN, VA_FIXEDARG & VA_CLOSE.
|
* concat.c (concat): Use VPARAMS, VA_OPEN, VA_FIXEDARG & VA_CLOSE.
|
||||||
|
@ -22,36 +22,20 @@ Boston, MA 02111-1307, USA. */
|
|||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
#if defined (ANSI_PROTOTYPES) || defined (ALMOST_STDC)
|
#ifdef ANSI_PROTOTYPES
|
||||||
#define USE_STDARG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_STDARG
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
#else
|
||||||
#include <varargs.h>
|
#include <varargs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* VARARGS */
|
|
||||||
#ifdef USE_STDARG
|
|
||||||
int
|
int
|
||||||
asprintf (char **buf, const char *fmt, ...)
|
asprintf VPARAMS ((char **buf, const char *fmt, ...))
|
||||||
#else
|
|
||||||
int
|
|
||||||
asprintf (buf, fmt, va_alist)
|
|
||||||
char **buf;
|
|
||||||
const char *fmt;
|
|
||||||
va_dcl
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
va_list ap;
|
VA_OPEN (ap, fmt);
|
||||||
#ifdef USE_STDARG
|
VA_FIXEDARG (ap, char **, buf);
|
||||||
va_start (ap, fmt);
|
VA_FIXEDARG (ap, const char *, fmt);
|
||||||
#else
|
|
||||||
va_start (ap);
|
|
||||||
#endif
|
|
||||||
status = vasprintf (buf, fmt, ap);
|
status = vasprintf (buf, fmt, ap);
|
||||||
va_end (ap);
|
VA_CLOSE (ap);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,9 @@ Boston, MA 02111-1307, USA. */
|
|||||||
#include <varargs.h>
|
#include <varargs.h>
|
||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
@ -142,29 +144,22 @@ vasprintf (result, format, args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
static void checkit PARAMS ((const char *, ...));
|
static void ATTRIBUTE_PRINTF_1
|
||||||
|
checkit VPARAMS ((const char *format, ...))
|
||||||
static void
|
|
||||||
checkit VPARAMS ((const char* format, ...))
|
|
||||||
{
|
{
|
||||||
va_list args;
|
|
||||||
char *result;
|
char *result;
|
||||||
#ifndef ANSI_PROTOTYPES
|
VA_OPEN (args, format);
|
||||||
const char *format;
|
VA_FIXEDARG (args, const char *, format);
|
||||||
#endif
|
|
||||||
|
|
||||||
VA_START (args, format);
|
|
||||||
|
|
||||||
#ifndef ANSI_PROTOTYPES
|
|
||||||
format = va_arg (args, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vasprintf (&result, format, args);
|
vasprintf (&result, format, args);
|
||||||
|
VA_CLOSE (args);
|
||||||
|
|
||||||
if (strlen (result) < (size_t) 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);
|
||||||
|
|
||||||
|
free (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int main PARAMS ((void));
|
extern int main PARAMS ((void));
|
||||||
|
Reference in New Issue
Block a user