aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2013-03-28 11:14:20 -0700
committerBen Cheng <bccheng@google.com>2013-03-28 12:40:33 -0700
commitaf0c51ac87ab2a87caa03fa108f0d164987a2764 (patch)
tree4b8b470f7c5b69642fdab8d0aa1fbc148d02196b /gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn
parentd87cae247d39ebf4f5a6bf25c932a14d2fdb9384 (diff)
downloadtoolchain_gcc-af0c51ac87ab2a87caa03fa108f0d164987a2764.tar.gz
toolchain_gcc-af0c51ac87ab2a87caa03fa108f0d164987a2764.tar.bz2
toolchain_gcc-af0c51ac87ab2a87caa03fa108f0d164987a2764.zip
[GCC 4.8] Initial check-in of GCC 4.8.0
Change-Id: I0719d8a6d0f69b367a6ab6f10eb75622dbf12771
Diffstat (limited to 'gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn')
-rw-r--r--gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C27
-rw-r--r--gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/flow1.C14
-rw-r--r--gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/impint.C56
-rw-r--r--gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/impint2.C69
-rw-r--r--gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/inline.C69
-rw-r--r--gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/iomanip.C13
-rw-r--r--gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/virt1.C10
7 files changed, 258 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C
new file mode 100644
index 000000000..43cecab23
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C
@@ -0,0 +1,27 @@
+// { dg-do assemble { target sparc-*-* } }
+// { dg-options "-ansi -pedantic-errors -Wcast-align" }
+
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 7 Dec 1999 <nathan@acm.org>
+
+// converting a T * to void * does not need a complete T, and doesn't
+// increase alignment requirements.
+
+struct X;
+struct Y;
+struct Z {double m;};
+
+void f3 (X *xp, Z *zp)
+{
+ (void *)xp;
+ (void *)zp;
+ (Y *)xp;
+ (Y *)zp;
+ (Z *)xp;
+}
+
+void f4 (char *ptr)
+{
+ (Z *)ptr; // { dg-warning "" } alignment
+}
diff --git a/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/flow1.C b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/flow1.C
new file mode 100644
index 000000000..61f6a5549
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/flow1.C
@@ -0,0 +1,14 @@
+// { dg-do assemble }
+// { dg-options "-Wreturn-type" }
+// Test that we don't get a warning about flowing off the end.
+
+struct A {
+ ~A ();
+};
+
+int f()
+{
+ A a1[2];
+ A a2[2];
+ return 1234567;
+}
diff --git a/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/impint.C b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/impint.C
new file mode 100644
index 000000000..7ccc73d1f
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/impint.C
@@ -0,0 +1,56 @@
+// { dg-do assemble }
+// { dg-options "-Wconversion" }
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 Feb 2000 <nathan@codesourcery.com>
+
+// derived from a bug report by Johan Kuipers <j.kuipers@chello.nl>
+// initialization to 'int' from to 'double' We expect consistent warnings
+// whenever a float is implicitly truncated to int
+
+struct X
+{
+ X (int);
+ X (int, int);
+};
+
+void foo (int);
+void wibble (int);
+void wibble (int, int);
+void punk (int = 3.5); // { dg-warning "" } double to int
+void rock ();
+void rock (int, int = 3.5); // { dg-warning "" } double to int
+
+void fn ()
+{
+ X x1(3.5); // { dg-warning "" } double to int
+ X x2(3.5f); // { dg-warning "" } float to int
+ X x3(1, 3.5); // { dg-warning "" } double to int
+ X x4(1, 3.5f); // { dg-warning "" } float to int
+ X x5(3.5, 1); // { dg-warning "" } double to int
+ X x6(3.5f, 1); // { dg-warning "" } float to int
+
+ X y1 = 3.5; // { dg-warning "" } double to int
+ X y2 = 3.5f; // { dg-warning "" } float to int
+
+ int j1 (3.5); // { dg-warning "" } double to int
+ int j2 (3.5f); // { dg-warning "" } float to int
+
+ int k1 = 3.5; // { dg-warning "" } double to int
+ int k2 = 3.5f; // { dg-warning "" } float to int
+
+ j1 = 3.5; // { dg-warning "" } double to int
+ j2 = 3.5f; // { dg-warning "" } float to int
+
+ foo (3.5); // { dg-warning "" } double to int
+ foo (3.5f); // { dg-warning "" } float to int
+
+ wibble (3.5); // { dg-warning "" } double to int
+ wibble (3.5f); // { dg-warning "" } float to int
+ wibble (1, 3.5); // { dg-warning "" } double to int
+ wibble (1, 3.5f); // { dg-warning "" } float to int
+ wibble (3.5, 1); // { dg-warning "" } double to int
+ wibble (3.5f, 1); // { dg-warning "" } float to int
+
+ punk (); // { dg-warning "" } double to int
+ rock (1); // { dg-warning "" } double to int
+}
diff --git a/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/impint2.C b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/impint2.C
new file mode 100644
index 000000000..d5fbc5554
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/impint2.C
@@ -0,0 +1,69 @@
+// { dg-do assemble }
+// { dg-options "-Wconversion" }
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Mar 2000 <nathan@codesourcery.com>
+
+// initialization to 'int' from to 'double' We expect consistent warnings
+// whenever a float is implicitly truncated to int, make sure references
+// don't confuse us, as Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> found out.
+
+struct X
+{
+ X (int const &);
+ X (int const &, int const &);
+};
+
+void foo (int const &);
+void wibble (int const &);
+void wibble (int const &, int const &);
+void punk (int const & = 3.5f); // { dg-warning "" } in passing
+void rock ();
+void rock (int const &, int const & = 3.5f); // { dg-warning "" } in passing
+
+void fn ()
+{
+ X x2(3.5f); // { dg-warning "" } float to int
+ X x4(1, 3.5f); // { dg-warning "" } float to int
+ X x6(3.5f, 1); // { dg-warning "" } float to int
+
+ X y2 = 3.5f; // { dg-warning "" } float to int
+
+ int j2 (3.5f); // { dg-warning "" } float to int
+
+ int k2 = 3.5f; // { dg-warning "" } float to int
+
+ j2 = 3.5f; // { dg-warning "" } float to int
+
+ foo (3.5f); // { dg-warning "" } float to int
+
+ wibble (3.5f); // { dg-warning "" } float to int
+ wibble (1, 3.5f); // { dg-warning "" } float to int
+ wibble (3.5f, 1); // { dg-warning "" } float to int
+
+ punk (); // { dg-warning "" } float to int
+ rock (1); // { dg-warning "" } float to int
+}
+
+// and make sure we really know when something's unsigned
+void foo ()
+{
+ X x2(-1);
+ X x4(1, -1);
+ X x6(-1, 1);
+
+ X y2 = -1;
+
+ int j2 (-1);
+
+ int k2 = -1;
+
+ j2 = -1;
+
+ foo (-1);
+
+ wibble (-1);
+ wibble (1, -1);
+ wibble (-1, 1);
+
+}
diff --git a/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/inline.C b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/inline.C
new file mode 100644
index 000000000..51fbabdc2
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/inline.C
@@ -0,0 +1,69 @@
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic-errors -Winline -O1" }
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 9 Mar 2000 <nathan@codesourcery.com>
+
+// derived from a bug report by Benjamin Kosnik <bkoz@cygnus.com>
+
+// __FUNCTION__ was erroneously causing us to issue a `cannot inline'
+// diagnostic, even though we'd (a) inlined it, (b) been forced to issue an
+// out of line body by taking it's address, (c) not used __FUNCTION__.
+
+inline void wibble ()
+{}
+
+inline void wobble ()
+{} // { dg-bogus "" } cannot inline
+
+void bar (void (*)());
+
+void bar1 ()
+{
+ wibble (); // can be inlined
+ void (*ptr) () = wobble; // force out of line issue
+
+ bar (ptr); // make sure we make use of it
+}
+
+struct B
+{
+ void mwibble ()
+ {}
+ void mwobble ()
+ {} // { dg-bogus "" } cannot inline
+
+ static void swibble ()
+ {}
+ static void swobble ()
+ {} // { dg-bogus "" } cannot inline
+};
+
+void bar (void (B::*)());
+
+void bar2 ()
+{
+ B::swibble (); // can be inlined
+ void (*ptr) () = &B::swobble; // force out of line issue
+
+ bar (ptr); // make sure we make use of it
+}
+
+void bar3 (B *b)
+{
+ b->mwibble (); // can be inlined
+ void (B::*ptr) () = &B::mwobble; // force out of line issue
+
+ bar (ptr); // make sure we make use of it
+}
+
+struct C
+{
+ virtual void vwobble ()
+ {} // { dg-bogus "" } cannot inline
+};
+
+void bar4 ()
+{
+ C c; // force issue of C's vtable etc
+}
diff --git a/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/iomanip.C b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/iomanip.C
new file mode 100644
index 000000000..c437b26db
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/iomanip.C
@@ -0,0 +1,13 @@
+// { dg-do assemble }
+// { dg-options "-O -Winline" }
+// Bug: g++ wouldn't inline op<< because it was an explicit instantiation.
+// Origin: Jason Merrill <jason@cygnus.com>
+
+#include <iomanip>
+#include <iostream>
+
+void
+f()
+{
+ std::cout << std::setw(3);
+}
diff --git a/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/virt1.C b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/virt1.C
new file mode 100644
index 000000000..4550dd5e0
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.old-deja/g++.warn/virt1.C
@@ -0,0 +1,10 @@
+// { dg-do assemble }
+// { dg-options "-Woverloaded-virtual" }
+
+struct A {
+ virtual void f(); // { dg-warning "" } hidden
+};
+
+struct B: public A {
+ void f(int); // { dg-warning "" } by this
+};