diff options
-rw-r--r-- | include/ChangeLog | 5 | ||||
-rw-r--r-- | include/ansidecl.h | 5 | ||||
-rw-r--r-- | libcpp/ChangeLog | 11 | ||||
-rw-r--r-- | libcpp/config.in | 8 | ||||
-rwxr-xr-x | libcpp/configure | 140 | ||||
-rw-r--r-- | libcpp/configure.ac | 2 | ||||
-rw-r--r-- | libcpp/internal.h | 9 | ||||
-rw-r--r-- | libcpp/macro.c | 14 | ||||
-rw-r--r-- | libcpp/pch.c | 2 |
9 files changed, 189 insertions, 7 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index 0a8c601..da3aaa2 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2005-02-14 Paolo Bonzini <bonzini@gnu.org> + + PR bootstrap/19818 + * ansidecl.h (PARAMS): Guard from redefinition. + 2004-12-11 Ben Elliston <bje@au.ibm.com> * fibheap.h (struct fibnode): Only use unsigned long bitfields diff --git a/include/ansidecl.h b/include/ansidecl.h index 04c3a30..2eeccf2 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -149,7 +149,12 @@ So instead we use the macro below and test it against specific values. */ #define PTRCONST void *const #define LONG_DOUBLE long double +/* PARAMS is often defined elsewhere (e.g. by libintl.h), so wrap it in + a #ifndef. */ +#ifndef PARAMS #define PARAMS(ARGS) ARGS +#endif + #define VPARAMS(ARGS) ARGS #define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 35e5369..e1f9d1d 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,14 @@ +2005-02-14 Paolo Bonzini <bonzini@gnu.org> + + PR bootstrap/19818 + * configure.ac: Check for declaration of basename and getopt. + * config.in: Regenerate. + * configure: Regenerate. + * internal.h (ustrcspn): New. + * macro.c (create_iso_definition): Fix allocation of memory. + (padding_token): Add cast to remove const-ness. + * pch.c (cpp_read_state): Use ustrcspn. + 2005-02-08 Mike Stump <mrs@apple.com> * files.c (pchf_adder): Remove. diff --git a/libcpp/config.in b/libcpp/config.in index 8cf8ceb..d7f67a6 100644 --- a/libcpp/config.in +++ b/libcpp/config.in @@ -26,6 +26,10 @@ */ #undef HAVE_DECL_ABORT +/* Define to 1 if you have the declaration of `basename', and to 0 if you + don't. */ +#undef HAVE_DECL_BASENAME + /* Define to 1 if you have the declaration of `errno', and to 0 if you don't. */ #undef HAVE_DECL_ERRNO @@ -46,6 +50,10 @@ you don't. */ #undef HAVE_DECL_FWRITE_UNLOCKED +/* Define to 1 if you have the declaration of `getopt', and to 0 if you don't. + */ +#undef HAVE_DECL_GETOPT + /* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_PUTC_UNLOCKED diff --git a/libcpp/configure b/libcpp/configure index 604ed84..b8c2c5a 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -5066,6 +5066,76 @@ _ACEOF fi +echo "$as_me:$LINENO: checking whether basename is declared" >&5 +echo $ECHO_N "checking whether basename is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_basename+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef basename + char *p = (char *) basename; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_basename=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_basename=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_basename" >&5 +echo "${ECHO_T}$ac_cv_have_decl_basename" >&6 +if test $ac_cv_have_decl_basename = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 0 +_ACEOF + + +fi echo "$as_me:$LINENO: checking whether errno is declared" >&5 echo $ECHO_N "checking whether errno is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_errno+set}" = set; then @@ -5136,6 +5206,76 @@ _ACEOF fi +echo "$as_me:$LINENO: checking whether getopt is declared" >&5 +echo $ECHO_N "checking whether getopt is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getopt + char *p = (char *) getopt; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_getopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_getopt=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getopt" >&6 +if test $ac_cv_have_decl_getopt = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETOPT 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETOPT 0 +_ACEOF + + +fi echo "$as_me:$LINENO: checking whether putc_unlocked is declared" >&5 echo $ECHO_N "checking whether putc_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_putc_unlocked+set}" = set; then diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 8a9a449..b268d8d 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -46,7 +46,7 @@ AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_FUNCS(putc_unlocked fputc_unlocked fputs_unlocked \ fwrite_unlocked fprintf_unlocked) -AC_CHECK_DECLS([abort, errno, putc_unlocked, fputc_unlocked, +AC_CHECK_DECLS([abort, basename, errno, getopt, putc_unlocked, fputc_unlocked, fputs_unlocked, fwrite_unlocked, fprintf_unlocked]) # Checks for library functions. diff --git a/libcpp/internal.h b/libcpp/internal.h index 9f39b21..74ae6c6 100644 --- a/libcpp/internal.h +++ b/libcpp/internal.h @@ -585,6 +585,9 @@ static inline unsigned char *uxstrdup (const unsigned char *); static inline unsigned char *ustrchr (const unsigned char *, int); static inline int ufputs (const unsigned char *, FILE *); +/* Use a const char for the second parameter since it is usually a literal. */ +static inline int ustrcspn (const unsigned char *, const char *); + static inline int ustrcmp (const unsigned char *s1, const unsigned char *s2) { @@ -597,6 +600,12 @@ ustrncmp (const unsigned char *s1, const unsigned char *s2, size_t n) return strncmp ((const char *)s1, (const char *)s2, n); } +static inline int +ustrcspn (const unsigned char *s1, const char *s2) +{ + return strcspn ((const char *)s1, s2); +} + static inline size_t ustrlen (const unsigned char *s1) { diff --git a/libcpp/macro.c b/libcpp/macro.c index e3824cb..e118a5c 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -910,7 +910,10 @@ padding_token (cpp_reader *pfile, const cpp_token *source) cpp_token *result = _cpp_temp_token (pfile); result->type = CPP_PADDING; - result->val.source = source; + + /* Data in GCed data structures cannot be made const so far, so we + need a cast here. */ + result->val.source = (cpp_token *) source; result->flags = 0; return result; } @@ -1416,10 +1419,11 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro) /* Success. Commit or allocate the parameter array. */ if (pfile->hash_table->alloc_subobject) { - cpp_token *tokns = pfile->hash_table->alloc_subobject - (sizeof (cpp_token) * macro->paramc); - memcpy (tokns, macro->params, sizeof (cpp_token) * macro->paramc); - macro->params = tokns; + cpp_hashnode **params = pfile->hash_table->alloc_subobject + (sizeof (cpp_hashnode *) * macro->paramc); + memcpy (params, macro->params, + sizeof (cpp_hashnode *) * macro->paramc); + macro->params = params; } else BUFF_FRONT (pfile->a_buff) = (uchar *) ¯o->params[macro->paramc]; diff --git a/libcpp/pch.c b/libcpp/pch.c index 2921321..8de5c01 100644 --- a/libcpp/pch.c +++ b/libcpp/pch.c @@ -653,7 +653,7 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, size_t namelen; uchar *defn; - namelen = strcspn (data->defns[i], "( \n"); + namelen = ustrcspn (data->defns[i], "( \n"); h = cpp_lookup (r, data->defns[i], namelen); defn = data->defns[i] + namelen; |