libiberty.h (ASTRDUP): New macro.
include: * libiberty.h (ASTRDUP): New macro. libiberty_optr, libiberty_nptr, libiberty_len): Declare. libiberty: * alloca.c (libiberty_optr, libiberty_nptr, libiberty_len): Define. gcc: * c-aux-info.c (affix_data_type): Use ASTRDUP in lieu of alloca/strcpy. From-SVN: r45657
This commit is contained in:
parent
14baae01f6
commit
c1d49704bc
6 changed files with 35 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* c-aux-info.c (affix_data_type): Use ASTRDUP in lieu of
|
||||
alloca/strcpy.
|
||||
|
||||
2001-09-17 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* cpphash.h (_cpp_lex_direct): New.
|
||||
|
|
|
@ -64,13 +64,11 @@ static char *
|
|||
affix_data_type (param)
|
||||
const char *param;
|
||||
{
|
||||
char *type_or_decl = (char *) alloca (strlen (param) + 1);
|
||||
char *const type_or_decl = ASTRDUP (param);
|
||||
char *p = type_or_decl;
|
||||
char *qualifiers_then_data_type;
|
||||
char saved;
|
||||
|
||||
strcpy (type_or_decl, param);
|
||||
|
||||
/* Skip as many leading const's or volatile's as there are. */
|
||||
|
||||
for (;;)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* libiberty.h (ASTRDUP): New macro.
|
||||
libiberty_optr, libiberty_nptr, libiberty_len): Declare.
|
||||
|
||||
2001-08-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* ansidecl.h: Update comments reflecting previous change.
|
||||
|
|
|
@ -246,12 +246,25 @@ extern PTR C_alloca PARAMS((size_t));
|
|||
#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
|
||||
# define alloca(x) __builtin_alloca(x)
|
||||
# undef C_ALLOCA
|
||||
# define ASTRDUP(X) \
|
||||
(__extension__ ({ const char *const libiberty_optr = (X); \
|
||||
const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \
|
||||
char *const libiberty_nptr = alloca (libiberty_len); \
|
||||
(char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); }))
|
||||
#else
|
||||
# define alloca(x) C_alloca(x)
|
||||
# undef USE_C_ALLOCA
|
||||
# define USE_C_ALLOCA 1
|
||||
# undef C_ALLOCA
|
||||
# define C_ALLOCA 1
|
||||
extern const char *libiberty_optr;
|
||||
extern char *libiberty_nptr;
|
||||
extern unsigned long libiberty_len;
|
||||
# define ASTRDUP(X) \
|
||||
(libiberty_optr = (X), \
|
||||
libiberty_len = strlen (libiberty_optr) + 1, \
|
||||
libiberty_nptr = alloca (libiberty_len), \
|
||||
(char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* alloca.c (libiberty_optr, libiberty_nptr, libiberty_len):
|
||||
Define.
|
||||
|
||||
2001-09-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* asprintf.c: Don't define USE_STDARG. Use VPARAMS, VA_OPEN,
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* These variables are used by the ASTRDUP implementation that relies
|
||||
on C_alloca. */
|
||||
const char *libiberty_optr;
|
||||
char *libiberty_nptr;
|
||||
unsigned long libiberty_len;
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue