re PR bootstrap/19818 (GCC 4.0 cannot bootstrap itself)

include:
2005-02-08  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/19818
	* ansidecl.h (PARAMS): Guard from redefinition.

libcpp:
2005-02-08  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.

From-SVN: r95003
This commit is contained in:
Paolo Bonzini 2005-02-14 08:52:24 +00:00 committed by Paolo Bonzini
parent 623049aa3c
commit be0f1e5478
9 changed files with 189 additions and 7 deletions

View File

@ -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

View File

@ -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)

View File

@ -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.

View File

@ -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

140
libcpp/configure vendored
View File

@ -5065,6 +5065,76 @@ else
_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
@ -5135,6 +5205,76 @@ else
_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

View File

@ -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.

View File

@ -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)
{

View File

@ -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 *) &macro->params[macro->paramc];

View File

@ -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;