Running tclint on the test-cases in gdb.fortran shows a few problems.
Fix these.
Tested on x86_64-linux.
"gdb/testsuite/gdb.btrace",
"gdb/testsuite/gdb.cp",
"gdb/testsuite/gdb.dwarf2",
-"gdb/testsuite/gdb.fortran",
"gdb/testsuite/gdb.mi",
"gdb/testsuite/gdb.python",
"gdb/testsuite/gdb.threads",
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
# GCC outputs incorrect range debug info for -m32, gcc PR debug/54934.
set expect_xfail \
[expr \
- [test_compiler_info {gfortran-*} f90] \
- && [is_ilp32_target]]
+ {[test_compiler_info {gfortran-*} f90]
+ && [is_ilp32_target]}]
set re_ok [string_to_regexp (4294967296:4294967297)]
set re_xfail [string_to_regexp (0:1)]
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
# slice.
for { set j 1 } { $j < 6 } { incr j } {
for { set i 1 } { $i < 6 } { incr i } {
- set val [expr ((($i - 1) * 2) + (($j - 1) * 20)) + 1]
+ set val [expr {((($i - 1) * 2) + (($j - 1) * 20)) + 1}]
gdb_test "print ${varname} ($i,$j)" " = $val"
}
}
# existing value in memory.
gdb_test_no_output "set fortran repack-array-slices on"
set element_size [get_integer_valueof "sizeof (array (1,1))" "unknown"]
-set slice_size [expr $element_size * 4]
+set slice_size [expr {$element_size * 4}]
gdb_test_no_output "set max-value-size $slice_size"
gdb_test "print array (1:2, 1:2)" "= \\(\\(1, 2\\) \\(11, 12\\)\\)"
gdb_test "print array (2:3, 2:3)" "= \\(\\(12, 13\\) \\(22, 23\\)\\)"
clean_restart ${::testfile}
- if ![fortran_runto_main] {
+ if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
untested "could not run to main"
return -1
}
set some_func [find_mangled_name "some_func"]
set string_func [find_mangled_name "string_func"]
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program 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 program. If not, see <http://www.gnu.org/licenses/>.
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
gdb_test "p 6.0 / 3.0" " = 2" "real divided by real"
# Test exponentiation with various operands
-
+
gdb_test "p 2 ** 3" " = 8" "int powered by int"
gdb_test "p 2 ** 2 ** 3" " = 256" "combined exponentiation expression"
gdb_test "p (2 ** 2) ** 3" " = 64" "combined exponentiation expression in specified order"
standard_testfile .F90
-set max [expr 2 * 1024 * 1024]
+set max [expr {2 * 1024 * 1024}]
set min 16
set opts {}
lappend opts f90
set compilation_succeeded 0
-for { set size [expr $max] } { $size >= $min } { set size [expr $size / 2] } {
+for { set size [expr {$max}] } { $size >= $min } { set size [expr {$size / 2}] } {
set try_opts [concat $opts [list additional_flags=-DCRASH_GDB=$size]]
with_test_prefix CRASH_GDB=$size {
if { [build_executable $testfile.exp $testfile $srcfile $try_opts] == -1 } {
unsupported $test
} else {
# At 112 passes with and without the fix, so use 111.
- gdb_assert {$space_used < [expr 111 * 4 * $size] } $test
+ gdb_assert {$space_used < [expr {111 * 4 * $size}] } $test
}
}
gdb_test "info main" "simple" "info main prior to start"
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
untested "could not run to main"
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
# Finally, check that asking for a dimension above the valid
# range gives the expected error.
- set bad_dim [expr $upper_dim + 1]
+ set bad_dim [expr {$upper_dim + 1}]
gdb_test "p lbound ($array_name, $bad_dim)" \
"LBOUND dimension must be from 1 to $upper_dim" \
"check error message for lbound of dim = $bad_dim"
require allow_fortran_tests
-standard_testfile library-module-main.f90
+standard_testfile library-module-main.f90
set srclibfile ${testfile}-lib.f90
set libfile [standard_output_file ${testfile}-lib.so]
# Set the max-value-size so we can only print 50 elements.
set elements 50
set elem_size [get_valueof "/d" "sizeof(large_1d_array(1))" "*unknown*"]
-gdb_test_no_output "set max-value-size [expr $elem_size * $elements]"
+gdb_test_no_output "set max-value-size [expr {$elem_size * $elements}]"
with_test_prefix "with reduced max-value size" {
gdb_test "print large_4d_array" \
clean_restart ${::testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# Test automatic language detection before the inferior starts. It tests the
# effect of expected:
-# (gdb) show language
+# (gdb) show language
# The current source language is "auto; currently fortran".
gdb_test "p modmany::var_i" " = 14" "stopped language detection"
# gcc-4.4.2: The main program is always $fmain in .symtab so "runto" above
# works. But DWARF DW_TAG_subprogram contains the name specified by
# the "program" Fortran statement.
-if [gdb_breakpoint "module"] {
+if {[gdb_breakpoint "module"]} {
pass "setting breakpoint at module"
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return
}
# DW_TAG_namelist is supported starting gcc 4.9.
set supported [expr \
- [test_compiler_info {gfortran-*} f90] \
- && [gcc_major_version {gfortran-*} f90] >= 4.9]
+ {[test_compiler_info {gfortran-*} f90]
+ && [gcc_major_version {gfortran-*} f90] >= 4.9}]
if { $supported } {
gdb_test "ptype nml" \
"type = Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type nml"
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This testcase is supposed to test DWARF static link which is usually
-# used together with nested functions.
+# used together with nested functions.
require allow_fortran_tests
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
perror "could not run to main"
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
# a(x,y) .OR./.AND. a(a,b) correctly.
foreach_with_prefix truth_table_index {1 2 3 4} {
gdb_test "p truth_table($truth_table_index, 1) .OR. truth_table($truth_table_index, 2)" \
- "[expr $truth_table_index > 1 ? \".TRUE.\" : \".FALSE.\"]"
+ "[expr {$truth_table_index > 1 ? ".TRUE." : ".FALSE."}]"
}
foreach_with_prefix truth_table_index {1 2 3 4} {
gdb_test "p truth_table($truth_table_index, 1) .AND. truth_table($truth_table_index, 2)" \
- "[expr $truth_table_index > 3 ? \".TRUE.\" : \".FALSE.\"]"
+ "[expr {$truth_table_index > 3 ? ".TRUE." : ".FALSE."}]"
}
# Vary number of function arguments to skip.
gdb_test "p function_one_arg(.FALSE. .OR. function_no_arg())" \
" = .TRUE."
gdb_test "p calls" \
- " = \\\( function_no_arg_called = [expr $prime + 1], function_no_arg_false_called = $prime, function_one_arg_called = [expr $prime + 1], function_two_arg_called = $prime, function_array_called = $prime \\\)"
+ " = \\\( function_no_arg_called = [expr {$prime + 1}], function_no_arg_false_called = $prime, function_one_arg_called = [expr {$prime + 1}], function_two_arg_called = $prime, function_array_called = $prime \\\)"
}
with_test_prefix "nested call skipped" {
gdb_test "p function_one_arg(.TRUE. .OR. function_no_arg())" \
" = .TRUE."
gdb_test "p calls" \
- " = \\\( function_no_arg_called = [expr $prime + 1], function_no_arg_false_called = $prime, function_one_arg_called = [expr $prime + 2], function_two_arg_called = $prime, function_array_called = $prime \\\)"
+ " = \\\( function_no_arg_called = [expr {$prime + 1}], function_no_arg_false_called = $prime, function_one_arg_called = [expr {$prime + 2}], function_two_arg_called = $prime, function_array_called = $prime \\\)"
}
# Vary number of components in the expression to skip.
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
# Test various decimal values.
# Should be integer*4 probably.
- gdb_test "pt 123" "type = int"
+ gdb_test "pt 123" "type = int"
}
proc test_character_literal_types_accepted {} {
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
untested "could not run to main"
return -1
}
# GFortran emits DW_TAG_structure_type for strings and it has only
# DW_AT_declaration tag. This results in <incomplete type> in gdb.
-if [test_compiler_info "gfortran*" f90] { setup_xfail *-*-* gcc/101826 }
+if {[test_compiler_info "gfortran*" f90]} { setup_xfail *-*-* gcc/101826 }
gdb_test "print arr_vla1" \
" = \\\('vlaaryvlaary', 'vlaaryvlaary', 'vlaaryvlaary', 'vlaaryvlaary', 'vlaaryvlaary'\\\)" \
"print vla string array"
-if [test_compiler_info "gfortran*" f90] { setup_xfail *-*-* gcc/101826 }
+if {[test_compiler_info "gfortran*" f90]} { setup_xfail *-*-* gcc/101826 }
gdb_test "ptype arr_vla1" \
"type = character\\*12 \\(5\\)" \
"print variable length string array type"
# check that all fortran standard datatypes will be
# handled correctly when using as VLA's
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return
}