aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-07-16 22:35:16 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-07-16 22:35:16 +0200
commit8b26599cef479615c9b583d66596360f7842397c (patch)
tree2cb66858f66bfe83bdfa6c602f92ed8a4d9b2917
parent6a4825bda18b76ef8b0f979ef439e0007a440b8f (diff)
downloadgcc-8b26599cef479615c9b583d66596360f7842397c.zip
gcc-8b26599cef479615c9b583d66596360f7842397c.tar.gz
gcc-8b26599cef479615c9b583d66596360f7842397c.tar.bz2
guality.exp: Run also c-c++-common/guality/ tests.
* gcc.dg/guality/guality.exp: Run also c-c++-common/guality/ tests. * gcc.dg/guality/guality.h: Include unistd.h. Make the header usable in C++. (gualcvt): New overloaded inline. (GUALCVT): Use it for C++. * g++.dg/guality/guality.exp: New. * g++.dg/guality/guality.h: New. * g++.dg/guality/redeclaration1.C: New test. * g++.dg/dg.exp: Prune also guality/* tests. * gcc.dg/guality/pr43141.c: Moved to... * c-c++-common/guality/pr43141.c: ... here. From-SVN: r162266
-rw-r--r--gcc/testsuite/ChangeLog14
-rw-r--r--gcc/testsuite/c-c++-common/guality/pr43141.c (renamed from gcc/testsuite/gcc.dg/guality/pr43141.c)0
-rw-r--r--gcc/testsuite/g++.dg/dg.exp3
-rw-r--r--gcc/testsuite/g++.dg/guality/guality.exp53
-rw-r--r--gcc/testsuite/g++.dg/guality/guality.h1
-rw-r--r--gcc/testsuite/g++.dg/guality/redeclaration1.C26
-rw-r--r--gcc/testsuite/gcc.dg/guality/guality.exp1
-rw-r--r--gcc/testsuite/gcc.dg/guality/guality.h28
8 files changed, 124 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1333f3f..fa9f596 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2010-07-16 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/guality/guality.exp: Run also c-c++-common/guality/ tests.
+ * gcc.dg/guality/guality.h: Include unistd.h. Make the header usable
+ in C++.
+ (gualcvt): New overloaded inline.
+ (GUALCVT): Use it for C++.
+ * g++.dg/guality/guality.exp: New.
+ * g++.dg/guality/guality.h: New.
+ * g++.dg/guality/redeclaration1.C: New test.
+ * g++.dg/dg.exp: Prune also guality/* tests.
+ * gcc.dg/guality/pr43141.c: Moved to...
+ * c-c++-common/guality/pr43141.c: ... here.
+
2010-07-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/37077
diff --git a/gcc/testsuite/gcc.dg/guality/pr43141.c b/gcc/testsuite/c-c++-common/guality/pr43141.c
index e6fe79a..e6fe79a 100644
--- a/gcc/testsuite/gcc.dg/guality/pr43141.c
+++ b/gcc/testsuite/c-c++-common/guality/pr43141.c
diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp
index 5758218..5851dcc 100644
--- a/gcc/testsuite/g++.dg/dg.exp
+++ b/gcc/testsuite/g++.dg/dg.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2000, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2007, 2009, 2010 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,6 +47,7 @@ set tests [prune $tests $srcdir/$subdir/gomp/*]
set tests [prune $tests $srcdir/$subdir/tree-prof/*]
set tests [prune $tests $srcdir/$subdir/torture/*]
set tests [prune $tests $srcdir/$subdir/graphite/*]
+set tests [prune $tests $srcdir/$subdir/guality/*]
# Main loop.
dg-runtest $tests "" $DEFAULT_CXXFLAGS
diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
new file mode 100644
index 0000000..9a17850
--- /dev/null
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -0,0 +1,53 @@
+# This harness is for tests that should be run at all optimisation levels.
+
+load_lib g++-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 [g++_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]] ""
+}
+
+if [info exists guality_gdb_name] {
+ unsetenv GUALITY_GDB_NAME
+}
+
+dg-finish
diff --git a/gcc/testsuite/g++.dg/guality/guality.h b/gcc/testsuite/g++.dg/guality/guality.h
new file mode 100644
index 0000000..dd858d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/guality/guality.h
@@ -0,0 +1 @@
+#include "../../gcc.dg/guality/guality.h"
diff --git a/gcc/testsuite/g++.dg/guality/redeclaration1.C b/gcc/testsuite/g++.dg/guality/redeclaration1.C
new file mode 100644
index 0000000..16f2f0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/guality/redeclaration1.C
@@ -0,0 +1,26 @@
+// { dg-do run }
+// { dg-options "-g" }
+
+volatile int l;
+
+namespace S
+{
+ int i = 24;
+ void __attribute__((noinline))
+ f()
+ {
+ int i = 42;
+ l = i; // { dg-final { gdb-test 13 "i" "42" } }
+ {
+ extern int i;
+ l = i; // { dg-final { gdb-test 16 "i" "24" } }
+ }
+ }
+}
+
+int
+main (void)
+{
+ S::f ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index d4ee686..49e2ac5 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -43,6 +43,7 @@ if {[check_guality "
}
"]} {
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] {
diff --git a/gcc/testsuite/gcc.dg/guality/guality.h b/gcc/testsuite/gcc.dg/guality/guality.h
index e744d0d..f6c662c 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.h
+++ b/gcc/testsuite/gcc.dg/guality/guality.h
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
+#include <unistd.h>
/* This is a first cut at checking that debug information matches
run-time. The idea is to annotate programs with GUALCHK* macros
@@ -61,6 +62,7 @@ typedef intmax_t gualchk_t;
/* Convert a pointer or integral type to the widest integral type,
as expected by guality_check. */
+#ifndef __cplusplus
#define GUALCVT(val) \
((gualchk_t)__builtin_choose_expr \
(__builtin_types_compatible_p (__typeof (val), gualchk_t), \
@@ -69,6 +71,30 @@ typedef intmax_t gualchk_t;
(__builtin_classify_type (val) \
== __builtin_classify_type (&guality_skip), \
(uintptr_t)(val),(intptr_t)(val))))
+#else
+template <typename T>
+inline __attribute__((always_inline)) gualchk_t
+gualcvt (T *val)
+{
+ return (uintptr_t) val;
+}
+
+template <typename T>
+inline __attribute__((always_inline)) gualchk_t
+gualcvt (T val)
+{
+ return (intptr_t) val;
+}
+
+template <>
+inline __attribute__((always_inline)) gualchk_t
+gualcvt<gualchk_t> (gualchk_t val)
+{
+ return val;
+}
+
+#define GUALCVT(val) gualcvt (val)
+#endif
/* Attach a debugger to the current process and verify that the string
EXPR, evaluated by the debugger, yields the gualchk_t number VAL.
@@ -195,7 +221,7 @@ main (int argc, char *argv[])
else
{
int len = strlen (guality_gdb_command) + sizeof (GUALITY_GDB_ARGS);
- char *buf = __builtin_alloca (len);
+ char *buf = (char *) __builtin_alloca (len);
strcpy (buf, guality_gdb_command);
strcat (buf, GUALITY_GDB_ARGS);
guality_gdb_command = buf;