re PR libstdc++/29095 (cxxabi.h __cxa_cdtor_type not declared when included from "C")

2006-10-09  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/29095
	* libsupc++/cxxabi.h (__cxa_cdtor_type): Explicit "C" linkage.
	* config/cpu/arm/cxxabi_tweaks.h: Same.
	* config/cpu/generic/cxxabi_tweaks.h: Same.
	* testsuite/abi: Add.
	* testsuite/abi/header_cxxabi.cc: New.
	* testsuite/demangle: Move...
	* testsuite/abi/demangle: ...here.
	* testsuite/libstdc++-dg/conformance.exp: Adjust testsuite file
	calculation.
	* scripts/create_testsuite_files: Same.
	* testsuite/lib/libstdc++.exp (v3_target_compile_as_c): New.
	(libstdc++-dg-test): Use it.

From-SVN: r117589
This commit is contained in:
Benjamin Kosnik 2006-10-09 23:53:35 +00:00 committed by Benjamin Kosnik
parent 175ff22958
commit 3c6430a314
81 changed files with 93 additions and 22 deletions

View File

@ -1,3 +1,19 @@
2006-10-09 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/29095
* libsupc++/cxxabi.h (__cxa_cdtor_type): Explicit "C" linkage.
* config/cpu/arm/cxxabi_tweaks.h: Same.
* config/cpu/generic/cxxabi_tweaks.h: Same.
* testsuite/abi: Add.
* testsuite/abi/header_cxxabi.cc: New.
* testsuite/demangle: Move...
* testsuite/abi/demangle: ...here.
* testsuite/libstdc++-dg/conformance.exp: Adjust testsuite file
calculation.
* scripts/create_testsuite_files: Same.
* testsuite/lib/libstdc++.exp (v3_target_compile_as_c): New.
(libstdc++-dg-test): Use it.
2006-10-09 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28277 (partial: __add_grouping)

View File

@ -1,6 +1,6 @@
// Control various target specific ABI tweaks. ARM version.
// Copyright (C) 2004 Free Software Foundation, Inc.
// Copyright (C) 2004, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -33,6 +33,8 @@
#ifdef __cplusplus
namespace __cxxabiv1
{
extern "C"
{
#endif
#ifdef __ARM_EABI__
@ -67,7 +69,8 @@ namespace __cxxabiv1
#endif //!__ARM_EABI__
#ifdef __cplusplus
}
} // namespace __cxxabiv1
#endif
#endif // __cxxabiv1
#endif

View File

@ -1,6 +1,6 @@
// Control various target specific ABI tweaks. Generic version.
// Copyright (C) 2004 Free Software Foundation, Inc.
// Copyright (C) 2004, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -33,6 +33,8 @@
#ifdef __cplusplus
namespace __cxxabiv1
{
extern "C"
{
#endif
// The generic ABI uses the first byte of a 64-bit guard variable.
@ -47,7 +49,8 @@ namespace __cxxabiv1
typedef void __cxa_cdtor_return_type;
#ifdef __cplusplus
}
} // namespace __cxxabiv1
#endif
#endif // __cxxabiv1
#endif

View File

@ -1,6 +1,6 @@
// new abi support -*- C++ -*-
// Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
// Copyright (C) 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@ -54,12 +54,12 @@
#ifdef __cplusplus
namespace __cxxabiv1
{
typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *);
extern "C"
{
#endif
typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *);
// Allocate array.
void*
__cxa_vec_new(size_t __element_count, size_t __element_size,

View File

@ -32,7 +32,7 @@ cd $srcdir
# This is the ugly version of "everything but the current directory". It's
# what has to happen when find(1) doesn't support -mindepth, or -xtype.
dlist=`echo [0-9][0-9]*`
dlist="$dlist backward demangle ext performance thread tr1"
dlist="$dlist abi backward ext performance thread tr1"
find $dlist "(" -type f -o -type l ")" -name "*.cc" -print > $tmp.01
find $dlist "(" -type f -o -type l ")" -name "*.c" -print > $tmp.02
cat $tmp.01 $tmp.02 | sort > $tmp.1

View File

@ -0,0 +1,22 @@
// { dg-do compile }
// { dg-options "-x c" }
// Copyright (C) 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// Must be compilable as "C"
#include <cxxabi.h>

View File

@ -272,6 +272,7 @@ proc libstdc++-dg-test { prog do_what extra_tool_flags } {
}
}
set select_compile "v3_target_compile"
set options ""
if { $extra_tool_flags != "" } {
verbose -log "extra_tool_flags are:"
@ -279,16 +280,17 @@ proc libstdc++-dg-test { prog do_what extra_tool_flags } {
if { [string first "-x c" $extra_tool_flags ] != -1 } {
# Short-circut a bunch of complicated goo here for the
# special case of compiling a test file as a "C" file, not
# as C++: just use target_compile, instead of the usual
# gimmicks.
# as C++. Why? So -nostdc++ doesn't trip us up. So all the
# extra object files don't trip us up. So automatically
# linking in libstdc++ doesn't happen. So CXXFLAGS don't
# error.
verbose -log "compiling and executing as C, not C++"
set compile_type "executable"
set output_file "./[file rootname [file tail $prog]].exe"
remote_file build delete $output_file;
lappend options "additional_flags=$extra_tool_flags"
set comp_output [target_compile "$prog" "$output_file" "$compile_type" $options];
set comp_output [ prune_g++_output $comp_output ];
return [list $comp_output $output_file]
set edit_tool_flags $extra_tool_flags
regsub -all ".x c" $edit_tool_flags "" edit_tool_flags
lappend options "additional_flags=$edit_tool_flags"
set select_compile "v3_target_compile_as_c"
} else {
lappend options "additional_flags=$extra_tool_flags"
}
@ -296,7 +298,7 @@ proc libstdc++-dg-test { prog do_what extra_tool_flags } {
# There is a libstdc++_compile made for us by default (via the tool-
# and-target file), but the defaults are lacking in goodness.
set comp_output [v3_target_compile "$prog" "$output_file" "$compile_type" $options];
set comp_output [$select_compile "$prog" "$output_file" "$compile_type" $options];
set comp_output [ prune_g++_output $comp_output ];
return [list $comp_output $output_file]
@ -323,7 +325,6 @@ proc v3_target_compile { source dest type options } {
global cxxflags
global cxxldflags
global includes
global blddir
global v3-test_objs
if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
@ -340,8 +341,9 @@ proc v3_target_compile { source dest type options } {
# Flag setting based on type argument.
if { $type == "executable" } {
# Link the support objects into executables.
set cxx_final [concat $cxx_final ${v3-test_objs}]
set cxx_final [concat $cxx_final $cxxldflags]
# lappend options "additional_flags=./libtestc++.a"
set cxx_final [concat $cxx_final ${v3-test_objs}]
} else {
if { $type == "sharedlib" } {
# Don't link in anything.
@ -356,6 +358,31 @@ proc v3_target_compile { source dest type options } {
}
# Called from libstdc++-dg-test above, but only for "C" compilation.
# Calls back into system's target_compile to actually do the work.
proc v3_target_compile_as_c { source dest type options } {
global gluefile
global wrap_flags
global includes
if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
lappend options "libs=${gluefile}"
lappend options "ldflags=${wrap_flags}"
}
set tname [target_info name]
set cc_final [board_info $tname compiler]
set cxxlibglossflags [libgloss_link_flags]
set cc_final [concat $cc_final $cxxlibglossflags]
set cc_final [concat $cc_final $includes]
regsub -all ".nostdinc.." $cc_final "" cc_final
lappend options "compiler=$cc_final"
lappend options "timeout=600"
return [target_compile $source $dest $type $options]
}
# Build the support objects linked in with the libstdc++ tests. In
# addition, set v3-wchar_t, v3-threads, v3-test_objs, and v3-symver
# appropriately.

View File

@ -53,12 +53,12 @@ if {[info exists tests_file] && [file exists $tests_file]} {
} else {
# Find directories that might have tests.
set subdirs [glob "$srcdir/\[0-9\]\[0-9\]*"]
lappend subdirs "$srcdir/abi"
lappend subdirs "$srcdir/backward"
lappend subdirs "$srcdir/demangle"
lappend subdirs "$srcdir/ext"
lappend subdirs "$srcdir/performance"
lappend subdirs "$srcdir/tr1"
lappend subdirs "$srcdir/thread"
lappend subdirs "$srcdir/tr1"
verbose "subdirs are $subdirs"
# Find all the tests.