From 5b6d595bd778d9737f12c79118ce5cc9410f421b Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Fri, 22 Jul 2011 08:58:25 +0000 Subject: [PATCH] re PR bootstrap/49794 (Solaris 10/x86 bootstrap broken by C++ build) 2011-07-20 Rainer Orth Ralf Wildenhues gcc: PR bootstrap/49794 * configure.ac: Test AM_ICONV with CXX. * configure: Regenerate. * config/sol2-c.c (solaris_format_types): Use EXPORTED_CONST. gcc/ada: PR bootstrap/49794 * init.c [sun && __SVR4 && !__vxworks] (__gnat_install_handler): Assign to act.sa_sigaction. * tracebak.c [USE_GENERIC_UNWINDER] (__gnat_backtrace): Cast current->return_address to char * before arithmetic. libcpp: PR bootstrap/49794 * configure.ac: Test AM_ICONV with CXX. * configure: Regenerate. * system.h (HAVE_DESIGNATED_INITIALIZERS): Never define for C++. Co-Authored-By: Ralf Wildenhues From-SVN: r176620 --- gcc/ChangeLog | 8 ++ gcc/ada/ChangeLog | 8 ++ gcc/ada/init.c | 2 +- gcc/ada/tracebak.c | 4 +- gcc/config/sol2-c.c | 5 +- gcc/configure | 177 ++++++++++++++++++++++++++++++++++- gcc/configure.ac | 9 +- libcpp/ChangeLog | 8 ++ libcpp/configure | 218 ++++++++++++++++++++++++++++++++++++++++++++ libcpp/configure.ac | 8 +- libcpp/system.h | 6 +- 11 files changed, 441 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35fdce7a800..dfba411ffe3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-07-22 Rainer Orth + Ralf Wildenhues + + PR bootstrap/49794 + * configure.ac: Test AM_ICONV with CXX. + * configure: Regenerate. + * config/sol2-c.c (solaris_format_types): Use EXPORTED_CONST. + 2011-07-22 Rainer Orth PR bootstrap/49797 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 27f41698572..8ba499bfd24 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2011-07-22 Rainer Orth + + PR bootstrap/49794 + * init.c [sun && __SVR4 && !__vxworks] (__gnat_install_handler): + Assign to act.sa_sigaction. + * tracebak.c [USE_GENERIC_UNWINDER] (__gnat_backtrace): Cast + current->return_address to char * before arithmetic. + 2011-07-22 Rainer Orth * init.c [sgi] (__gnat_error_handler): Update sigaction(2) citation. diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 2dc4aa5f8ae..b46cafdbbc8 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -1046,7 +1046,7 @@ __gnat_install_handler (void) exceptions. Make sure that the handler isn't interrupted by another signal that might cause a scheduling event! */ - act.sa_handler = __gnat_error_handler; + act.sa_sigaction = __gnat_error_handler; act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO; sigemptyset (&act.sa_mask); diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c index 6764cd42755..23fc5c79858 100644 --- a/gcc/ada/tracebak.c +++ b/gcc/ada/tracebak.c @@ -482,12 +482,12 @@ __gnat_backtrace (void **array, while (cnt < size) { if (STOP_FRAME (current, top_stack) || - !VALID_STACK_FRAME((char *)(current->return_address + PC_ADJUST))) + !VALID_STACK_FRAME(((char *) current->return_address) + PC_ADJUST)) break; if (current->return_address < exclude_min || current->return_address > exclude_max) - array[cnt++] = current->return_address + PC_ADJUST; + array[cnt++] = ((char *) current->return_address) + PC_ADJUST; current = (struct layout *) ((size_t) current->next + FRAME_OFFSET (1)); } diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c index ff42c38952d..0076be741ce 100644 --- a/gcc/config/sol2-c.c +++ b/gcc/config/sol2-c.c @@ -1,5 +1,6 @@ /* Solaris support needed only by C/C++ frontends. - Copyright (C) 2004, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007, 2009, 2010, 2011 + Free Software Foundation, Inc. Contributed by CodeSourcery, LLC. This file is part of GCC. @@ -68,7 +69,7 @@ static const format_char_info cmn_err_char_table[] = { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } }; -const format_kind_info solaris_format_types[] = { +EXPORTED_CONST format_kind_info solaris_format_types[] = { { "cmn_err", cmn_err_length_specs, cmn_err_char_table, "", NULL, cmn_err_flag_specs, cmn_err_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK, diff --git a/gcc/configure b/gcc/configure index 0295fc67dfe..e33fc1bfd4b 100755 --- a/gcc/configure +++ b/gcc/configure @@ -9294,6 +9294,8 @@ $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi +# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different +# iconv() prototype. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" @@ -9835,6 +9837,175 @@ fi fi +if test "$ENABLE_BUILD_WITH_CXX" = "yes"; then : + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if test "${am_cv_func_iconv+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + +$as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 +$as_echo_n "checking for iconv declaration... " >&6; } + if test "${am_cv_proto_iconv+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + am_cv_proto_iconv_arg1="" +else + am_cv_proto_iconv_arg1="const" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" +fi + + am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_t:- + }$am_cv_proto_iconv" >&5 +$as_echo "${ac_t:- + }$am_cv_proto_iconv" >&6; } + +cat >>confdefs.h <<_ACEOF +#define ICONV_CONST $am_cv_proto_iconv_arg1 +_ACEOF + + fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else @@ -9990,6 +10161,8 @@ _ACEOF fi +fi + # Until we have in-tree GNU iconv: LIBICONV_DEP= @@ -17628,7 +17801,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17631 "configure" +#line 17804 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17734,7 +17907,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17737 "configure" +#line 17910 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 54b6c9d88cd..fb243272c79 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1041,7 +1041,14 @@ case "${host}" in esac AC_FUNC_FORK -AM_ICONV +# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different +# iconv() prototype. +AS_IF([test "$ENABLE_BUILD_WITH_CXX" = "yes"], + [AC_LANG_PUSH([C++]) + AM_ICONV + AC_LANG_POP([C++])], + [AM_ICONV]) + # Until we have in-tree GNU iconv: LIBICONV_DEP= AC_SUBST(LIBICONV_DEP) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 9a9c71fa3ec..e500332dd27 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2011-07-22 Rainer Orth + Ralf Wildenhues + + PR bootstrap/49794 + * configure.ac: Test AM_ICONV with CXX. + * configure: Regenerate. + * system.h (HAVE_DESIGNATED_INITIALIZERS): Never define for C++. + 2011-07-15 Dodji Seketeli * directives.c (struct if_stack): Use source_location as type diff --git a/libcpp/configure b/libcpp/configure index d261f2a09f6..b453a7b349b 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -2104,6 +2104,52 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_decl + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_cxx_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -6344,6 +6390,8 @@ $as_echo "#define HAVE_UCHAR 1" >>confdefs.h fi +# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different +# iconv() prototype. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" @@ -6885,6 +6933,175 @@ fi fi +if test "$ENABLE_BUILD_WITH_CXX" = "yes"; then : + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if test "${am_cv_func_iconv+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + +$as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 +$as_echo_n "checking for iconv declaration... " >&6; } + if test "${am_cv_proto_iconv+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + am_cv_proto_iconv_arg1="" +else + am_cv_proto_iconv_arg1="const" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" +fi + + am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_t:- + }$am_cv_proto_iconv" >&5 +$as_echo "${ac_t:- + }$am_cv_proto_iconv" >&6; } + +cat >>confdefs.h <<_ACEOF +#define ICONV_CONST $am_cv_proto_iconv_arg1 +_ACEOF + + fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else @@ -7040,6 +7257,7 @@ _ACEOF fi +fi # More defines and substitutions. PACKAGE="$PACKAGE_TARNAME" diff --git a/libcpp/configure.ac b/libcpp/configure.ac index ce8cae61bf0..170932cbc9f 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -102,7 +102,13 @@ if test $ac_cv_type_uchar = yes; then [Define if defines \`uchar'.]) fi -AM_ICONV +# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different +# iconv() prototype. +AS_IF([test "$ENABLE_BUILD_WITH_CXX" = "yes"], + [AC_LANG_PUSH([C++]) + AM_ICONV + AC_LANG_POP([C++])], + [AM_ICONV]) # More defines and substitutions. PACKAGE="$PACKAGE_TARNAME" diff --git a/libcpp/system.h b/libcpp/system.h index aa458fca39b..d1fb87ed348 100644 --- a/libcpp/system.h +++ b/libcpp/system.h @@ -1,6 +1,6 @@ /* Get common system includes and various definitions and declarations based on autoconf macros. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -353,8 +353,8 @@ extern void abort (void); compilers, including G++. -- gdr, 2005-05-18 */ #if !defined(HAVE_DESIGNATED_INITIALIZERS) #define HAVE_DESIGNATED_INITIALIZERS \ - ((!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ - || (__STDC_VERSION__ >= 199901L)) + (!defined(__cplusplus) \ + && ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))) #endif #ifndef offsetof -- 2.30.2