diff mbox

PATCH RFA: Fix --enable-build-with-cxx

Message ID 20101116021054.GA12899@bromo.med.uc.edu
State New
Headers show

Commit Message

Jack Howarth Nov. 16, 2010, 2:10 a.m. UTC
On Fri, Nov 12, 2010 at 10:18:44AM -0800, Ian Lance Taylor wrote:
> The only current problem with the default languages with
> --enable-build-with-cxx is in libcpp.  Back in 2009-07-17
> libcpp/configure.ac picked up a test which switches AC_LANG based on
> --enable-build-with-cxx.  That seems superficially desirable but
> autoconf does not actually support conditionally changing AC_LANG.  With
> a small bit of care, changing AC_LANG is unnecessary when switching
> between C and C++.  Note in particular that gcc/configure.ac does not do
> it.
> 
> This patch removes the switch of AC_LANG in libcpp/configure.ac, and
> adds AC_USE_SYSTEM_EXTENSIONS which eliminates some relevant differences
> between the C and C++ header files when using glibc.  This fixes
> --enable-build-with-cxx.
> 
> Bootstrapped on x86_64-unknown-linux-gnu with and without
> --enable-build-with-cxx.  OK for mainline?
> 
> Ian

Ian,
   This issue was previously reported on x86_64-apple-darwin10 as PR45538.
With this patch and the additional change of...


x86_64-apple-darwin10 successfully bootstraps with --enable-build-with-cxx.
             Jack

> 
> 
> 2010-11-12  Ian Lance Taylor  <iant@google.com>
> 
> 	* configure.ac: Use AC_USE_SYSTEM_EXTENSIONS.  Remove switch of
> 	AC_LANG based on ENABLE_BUILD_WITH_CXX.
> 
> 

Content-Description: cxx
> Index: configure.ac
> ===================================================================
> --- configure.ac	(revision 166441)
> +++ configure.ac	(working copy)
> @@ -14,6 +14,7 @@ AC_PROG_CC
>  AC_PROG_CXX
>  AC_PROG_RANLIB
>  
> +AC_USE_SYSTEM_EXTENSIONS
>  AC_SYS_LARGEFILE
>  
>  # See if we are building gcc with C++.
> @@ -58,18 +59,8 @@ fi
>  AC_HEADER_TIME
>  ACX_HEADER_STRING
>  
> -# AC_CHECK_HEADERS is repeated to work around apparent autoconf 2.59 bug.  If
> -# AC_CHECK_HEADERS comes after the if clause, the last AC_LANG call gets used,
> -# no matter which branch is taken.
> -if test "$ENABLE_BUILD_WITH_CXX" = "no"; then
> -   AC_LANG(C)
> -   AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
> +AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
>  	stdlib.h strings.h string.h sys/file.h unistd.h)
> -else
> -   AC_LANG(C++)
> -   AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
> -	stdlib.h strings.h string.h sys/stat.h sys/file.h unistd.h)
> -fi
>  
>  # Checks for typedefs, structures, and compiler characteristics.
>  AC_C_BIGENDIAN

Comments

Ian Lance Taylor Nov. 16, 2010, 5:56 a.m. UTC | #1
Jack Howarth <howarth@bromo.med.uc.edu> writes:

> With this patch and the additional change of...
>
> Index: gcc/config/darwin-protos.h
> ===================================================================
> --- gcc/config/darwin-protos.h	(revision 166790)
> +++ gcc/config/darwin-protos.h	(working copy)
> @@ -18,6 +18,8 @@
>  along with GCC; see the file COPYING3.  If not see
>  <http://www.gnu.org/licenses/>.  */
>  
> +#include "c-family/c-format.h"
> +
>  extern void darwin_init_sections (void);
>  extern int name_needs_quotes (const char *);
>  
> @@ -101,6 +103,7 @@
>  extern void darwin_check_cfstring_format_arg (tree, tree);
>  extern tree darwin_build_constant_cfstring (tree);
>  extern void darwin_enter_string_into_cfstring_table (tree);
> +extern const format_kind_info darwin_additional_format_types[];
>  
>  extern void darwin_asm_output_anchor (rtx symbol);
>  extern bool darwin_kextabi_p (void);
>
> x86_64-apple-darwin10 successfully bootstraps with --enable-build-with-cxx.

Thanks.  That's actually not the right fix.  The right fix is to leave
darwin-protos.h unchanged, and to change this line in darwin-c.c:

const format_kind_info darwin_additional_format_types[] = {

It needs to be

EXPORTED_CONST format_kind_info darwin_additional_format_types[] = {

I can't really test that change, but if it works for you I'll preapprove
it.  Thanks.

Ian
diff mbox

Patch

Index: gcc/config/darwin-protos.h
===================================================================
--- gcc/config/darwin-protos.h	(revision 166790)
+++ gcc/config/darwin-protos.h	(working copy)
@@ -18,6 +18,8 @@ 
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#include "c-family/c-format.h"
+
 extern void darwin_init_sections (void);
 extern int name_needs_quotes (const char *);
 
@@ -101,6 +103,7 @@ 
 extern void darwin_check_cfstring_format_arg (tree, tree);
 extern tree darwin_build_constant_cfstring (tree);
 extern void darwin_enter_string_into_cfstring_table (tree);
+extern const format_kind_info darwin_additional_format_types[];
 
 extern void darwin_asm_output_anchor (rtx symbol);
 extern bool darwin_kextabi_p (void);