aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/callfuncs.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/callfuncs.exp')
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.exp26
1 files changed, 21 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 3651963..a537ebd 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -39,7 +39,7 @@ set skip_float_test [gdb_skip_float_test]
# specifies that the numeric value of a relational or logical expression
# (computed in the inferior) is 1 for true and 0 for false.
-proc do_function_calls {} {
+proc do_function_calls {prototypes} {
global gdb_prompt skip_float_test
# We need to up this because this can be really slow on some boards.
@@ -95,11 +95,25 @@ proc do_function_calls {} {
setup_xfail "mn10300-*-*"
if { [test_compiler_info "armcc-*"] } { setup_xfail "*-*-*" }
gdb_test "p t_float_values(float_val1,-2.3765)" " = 1"
+ # Same, via unprototyped function pointer (t_float_values is
+ # always unprototyped).
+ gdb_test "p ((int (*) ()) t_float_values)(float_val1,-2.3765)" " = 1"
# Test passing of arguments which might not be widened.
gdb_test "p t_float_values2(0.0,0.0)" " = 0"
+ # Same, via function pointer.
+ if {$prototypes} {
+ gdb_test "p ((int (*) (float, float)) t_float_values2)(0.0,0.0)" " = 0"
+ } else {
+ gdb_test "p ((int (*) ()) t_float_values2)(0.0,0.0)" " = 0"
+ }
gdb_test "p t_float_values2(3.14159,float_val2)" " = 1"
+ if {$prototypes} {
+ gdb_test "p ((int (*) (float, float)) t_float_values2)(3.14159,float_val2)" " = 1"
+ } else {
+ gdb_test "p ((int (*) ()) t_float_values2)(3.14159,float_val2)" " = 1"
+ }
gdb_test "p t_float_many_args (float_val1, float_val2, float_val3, float_val4, float_val5, float_val6, float_val7, float_val8, float_val9, float_val10, float_val11, float_val12, float_val13, float_val14, float_val15)" " = 1" "call function with many float arguments."
@@ -315,7 +329,7 @@ proc rerun_and_prepare {} {
"next to t_structs_c"
}
-proc perform_all_tests {} {
+proc perform_all_tests {prototypes} {
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
gdb_test_no_output "set width 0"
@@ -326,7 +340,7 @@ proc perform_all_tests {} {
set old_reg_content [fetch_all_registers "retrieve original register contents"]
# Perform function calls.
- do_function_calls
+ do_function_calls $prototypes
# Check if all registers still have the same value.
set new_reg_content [fetch_all_registers \
@@ -500,9 +514,11 @@ proc perform_all_tests {} {
# Perform all tests with and without function prototypes.
if { ![prepare_for_testing "failed to prepare" $testfile $srcfile "$compile_flags additional_flags=-DPROTOTYPES"] } {
- perform_all_tests
+ perform_all_tests 1
}
if { ![prepare_for_testing "failed to prepare" $testfile $srcfile "$compile_flags additional_flags=-DNO_PROTOTYPES"] } {
- with_test_prefix "noproto" perform_all_tests
+ with_test_prefix "noproto" {
+ perform_all_tests 0
+ }
}