summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/guality/guality.exp
blob: 49e2ac5a5500ec543893c669eb8b6eb14016f79d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# This harness is for tests that should be run at all optimisation levels.

load_lib gcc-dg.exp
load_lib gcc-gdb-test.exp

# Disable on darwin until radr://7264615 is resolved.
if { [istarget *-*-darwin*] } {
  return
}

proc check_guality {args} {
    set result [eval check_compile guality_check executable $args "-g -O0"]
    set lines [lindex $result 0]
    set output [lindex $result 1]
    set ret 0
    if {[string match "" $lines]} {
      set execout [gcc_load "./$output"]
      set ret [string match "*1 PASS, 0 FAIL, 0 UNRESOLVED*" $execout]
    }
    remote_file build delete $output
    return $ret
}

dg-init

global GDB
if ![info exists ::env(GUALITY_GDB_NAME)] {
    if [info exists GDB] {
	set guality_gdb_name "$GDB"
    } else {
	set guality_gdb_name "[transform gdb]"
    }
    setenv GUALITY_GDB_NAME "$guality_gdb_name"
}

if {[check_guality "
  #include \"$srcdir/$subdir/guality.h\"
  volatile long int varl = 6;
  int main (int argc, char *argv\[\])
  {
    GUALCHKVAL (varl);
    return 0;
  }
"]} {
  gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] ""
  gcc-dg-runtest [lsort [glob $srcdir/c-c++-common/guality/*.c]] "-Wc++-compat"
}

if [info exists guality_gdb_name] {
    unsetenv GUALITY_GDB_NAME
}

dg-finish