Debian Codegraph @

gcc/testsuite/gcc.dg/params/params.exp

raw
1 # Copyright (C) 2016-2025 Free Software Foundation, Inc.
2 #
3 # This file is part of GCC.
4 #
5 # GCC is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3, or (at your option)
8 # any later version.
9 #
10 # GCC is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with GCC; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>.
18
19 # GCC testsuite that uses the `dg.exp' driver.
20
21 # Load support procs.
22 load_lib gcc-dg.exp
23
24 # Initialize `dg'.
25 dg-init
26
27 proc param_run_test { param_name param_value } {
28 global srcdir
29 global subdir
30
31 dg-runtest $srcdir/$subdir/blocksort-part.c "-O3 --param $param_name=$param_value" ""
32 }
33
34 set srcfname params-[pid].c
35 set fd [open $srcfname w]
36 puts $fd ""
37 close $fd
38 remote_download host $srcfname
39
40 set gcc_options "\{additional_flags=--help=params\}"
41 set text [gcc_target_compile $srcfname $srcfname.x executable $gcc_options]
42 remote_file build delete $srcfname $srcfname.x
43
44 # Main loop.
45 foreach params [split $text "\n"] {
46 set parts [split $params " =<>,"]
47 if { [llength $parts] >= 8 } {
48 set param [lindex $parts 2]
49 set name [lindex $parts 3]
50 set min [lindex $parts 5]
51 set max [lindex $parts 6]
52
53 if { [ string equal $param "--param" ] && [string is integer -strict $min] && [string is integer -strict $max] } {
54 if { $min != -1 } {
55 param_run_test $name $min
56 }
57 if { $max != $min && $max > 0 } {
58 param_run_test $name $max
59 }
60 }
61 }
62 }
63
64 # All done.
65 dg-finish