Attached patch applied.
2011-04-21 François Dumont
* testsuite/lib/libstdc++.exp (check_v3_target_time): Discard
unused compilation result thanks to /dev/null.
* testsuite/lib/libstdc++.exp (check_v3_target_debug_mode
check_v3_target_profile_mode check_v3_target_normal_mode
check_v3_target_cstdint check_v3_target_cmath
check_v3_target_atomic_builtins check_v3_target_gthreads
check_v3_target_nanosleep check_v3_target_sched_yield
check_v3_target_string_conversions check_v3_target_swprintf
check_v3_target_binary_io): Use simple preprocessing rather than
compilation. Discard unused preprocessing result thanks to
/dev/null.
I kept check_v3_target_time execution target for the moment, I check
that it is used within tests. Do not hesitate to signal an issue Ralf.
Regards
On 04/22/2011 05:06 PM, Paolo Carlini wrote:
Hi,
Here is the patch I submitted some months ago before 4.6.0 release.
My only concern regarding this patch is on the portability of
/dev/null.
I would say it's Ok: in acinclude.m4 we have quite a few of /dev/null
and nobody complained so far. I'm adding Ralf in CC, I trust his
opinion about portability issues (in particular ;)
I also wonder if check_v3_target_time could not simply use the object
or even assembly target rather than executable, what do you think ?
Can you figure out when / why it has been added? Because that function
is C89 and should be unconditionally available. If we have the test,
likely it's because of some target I'm not familiar with, which can
well declare time it in and then end up not providing it in
the library, thus the failure happens at *link* time... (would not be
the fist time we have to live with this kind of annoying situation)
Paolo.
Index: testsuite/lib/libstdc++.exp
===
--- testsuite/lib/libstdc++.exp (revision 172870)
+++ testsuite/lib/libstdc++.exp (working copy)
@@ -824,7 +824,6 @@
# Set up and compile a C++ test program that tries to use
# the time function
set src time[pid].cc
- set exe time[pid].x
set f [open $src "w"]
puts $f "#include "
@@ -835,13 +834,12 @@
puts $f "}"
close $f
- set lines [v3_target_compile $src $exe executable ""]
+ set lines [v3_target_compile $src /dev/null executable ""]
file delete $src
if [string match "" $lines] {
# No error message, compilation succeeded.
verbose "check_v3_target_time: compilation succeeded" 2
- remote_file build delete $exe
set et_time_saved 1
} else {
verbose "check_v3_target_time: compilation failed" 2
@@ -927,25 +925,21 @@
} else {
set et_debug_mode 0
- # Set up and compile a C++ test program that depends
+ # Set up and preprocess a C++ test program that depends
# on debug mode activated.
set src debug_mode[pid].cc
- set exe debug_mode[pid].exe
set f [open $src "w"]
puts $f "#ifndef _GLIBCXX_DEBUG"
puts $f "# error No debug mode"
puts $f "#endif"
- puts $f "int main()"
- puts $f "{ return 0; }"
close $f
- set lines [v3_target_compile $src $exe executable ""]
+ set lines [v3_target_compile $src /dev/null preprocess ""]
file delete $src
if [string match "" $lines] {
- # No error message, compilation succeeded.
- remote_file build delete $exe
+ # No error message, preprocessing succeeded.
set et_debug_mode 1
}
}
@@ -977,25 +971,21 @@
} else {
set et_profile_mode 0
- # Set up and compile a C++ test program that depends
+ # Set up and preprocess a C++ test program that depends
# on profile mode activated.
set src profile_mode[pid].cc
- set exe profile_mode[pid].exe
set f [open $src "w"]
puts $f "#ifndef _GLIBCXX_PROFILE"
puts $f "# error No profile mode"
puts $f "#endif"
- puts $f "int main()"
- puts $f "{ return 0; }"
close $f
- set lines [v3_target_compile $src $exe executable ""]
+ set lines [v3_target_compile $src /dev/null preprocess ""]
file delete $src
if [string match "" $lines] {
- # No error message, compilation succeeded.
- remote_file build delete $exe
+ # No error message, preprocessing succeeded.
set et_profile_mode 1
}
}
@@ -1030,17 +1020,14 @@
# Set up and compile a C++ test program that depends
# on normal mode activated.
set src normal_mode[pid].cc
- set exe normal_mode[pid].exe
set f [open $src "w"]
puts $f "#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE) || defined(_GLIBCXX_PARALLEL)"
puts $f "# error No normal mode"
puts $f "#endif"
- puts $f "int main()"
- puts $f "{ return 0; }"
close $f
- set lines [v3_target_compile $src $exe executable ""]
+ set lines [v3_target_compile $src /dev/null preprocess ""]
file delete $src
if [string match "" $lines] {
@@ -1115,28 +1102,26 @@
} else {
set et_cstdint 0
- # Set up and compile a C++0x test program that depends
+ # Set up and preprocess a C++0x test progra