2005-02-26 James A. Morrison <phython@gcc.gnu.org>
authorphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Feb 2005 14:12:05 +0000 (14:12 +0000)
committerphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Feb 2005 14:12:05 +0000 (14:12 +0000)
        * compile/extrafunc.tree, compile/extravar.tree: New tests.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95581 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/treelang/ChangeLog
gcc/testsuite/treelang/compile/extrafunc.tree [new file with mode: 0644]
gcc/testsuite/treelang/compile/extravar.tree [new file with mode: 0644]

index 878f541..db4d022 100644 (file)
@@ -1,5 +1,9 @@
 2005-02-26  James A. Morrison  <phython@gcc.gnu.org>
 
+       * compile/extrafunc.tree, compile/extravar.tree: New tests.
+
+2005-02-26  James A. Morrison  <phython@gcc.gnu.org>
+
        * compile/unsigned.tree: New test.
 
 2005-02-24  James A. Morrison  <phython@gcc.gnu.org>
diff --git a/gcc/testsuite/treelang/compile/extrafunc.tree b/gcc/testsuite/treelang/compile/extrafunc.tree
new file mode 100644 (file)
index 0000000..6682a11
--- /dev/null
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-optimized -Wunused-function" }
+// Check to see that unused functions get removed at -O2 and
+// above.
+static int foo (int bar);
+static int baz (int aaa);
+external_definition int ext (int bbb);
+
+foo
+{
+       return bar;
+}
+
+baz // { dg-warning "defined but not used" }
+{
+       return foo (aaa);
+}
+
+ext
+{
+       return foo (bbb);
+}
+
+// { dg-final { scan-tree-dump-not "baz" "optimized" } }
diff --git a/gcc/testsuite/treelang/compile/extravar.tree b/gcc/testsuite/treelang/compile/extravar.tree
new file mode 100644 (file)
index 0000000..5c6b586
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-fdump-tree-vars -O1 -Wunused-variable" }
+external_definition int bar (int aaa, int ddd);
+
+static int foo = -3;  // { dg-warning "defined but not used" }
+
+bar
+{
+       automatic int ccc;
+
+       return aaa + ddd + +3;
+}
+// { dg-final { scan-tree-dump-not "ccc" "vars" } }