plateform
stringclasses
1 value
repo_name
stringclasses
2 values
name
stringlengths
1
78
ext
stringclasses
2 values
path
stringlengths
15
1.11k
size
int64
1
8.55M
source_encoding
stringclasses
11 values
md5
stringlengths
32
32
text
stringlengths
0
8.49M
google
chromium
undefined1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/undefined1.C
205
utf_8
81ccb812ec92857cf80d860b4ffa0d31
// PR 17256 inline static void f1(void); // { dg-warning "used but never" } void g1(void) { if (0) { f1(); } } inline void f2(void); // { dg-warning "used but never" } void g2(void) { if (0) { f2(); } }
google
chromium
noeffect5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/noeffect5.C
208
utf_8
66a1048126ecd634e1e4f71263be239e
/* PR middle-end/13325 */ /* { dg-do compile } */ /* { dg-options "-Wall" } */ void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n); void f (void *dest, const void *src) { memcpy (dest, src, 0); }
google
chromium
Wstrict-aliasing-bogus-signed-unsigned
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C
243
utf_8
443205fcd20b9b14da1367b1b8e16bce
/* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */ int foo () { int i; unsigned int* pu = reinterpret_cast<unsigned int*> (&i); /* { dg-bogus "signed vs. unsigned" } */ *pu = 1000000; return i; }
google
chromium
Wunused-9
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wunused-9.C
779
utf_8
c028f96ef429d16acd56c46dd1ef7140
// PR c++/11224 // { dg-options "-Wunused" } struct someclass { bool isEmpty() const { return true; } }; int main() { bool bOk = false; someclass foo; bOk == foo.isEmpty(); // { dg-warning "not used" } return bOk; } int& f(); void g() { f() == 0; // { dg-warning "not used" } f() != 1; // { dg-warning "not used" } f() < 2; // { dg-warning "not used" } f() > 3; // { dg-warning "not used" } f() <= 4; // { dg-warning "not used" } f() >= 5; // { dg-warning "not used" } f() + 6; // { dg-warning "not used" } f() - 7; // { dg-warning "not used" } f() * 8; // { dg-warning "not used" } f() / 9; // { dg-warning "not used" } +f(); // { dg-warning "not used" } -f(); // { dg-warning "not used" } ++f(); --f(); f() = 10; f() <<= 11; }
google
chromium
Wparentheses-19
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-19.C
4,268
utf_8
2bf598d7e9ea9cfeb779a0d90d2be1d8
// { dg-do compile } // { dg-options "-Wparentheses" } // Template version of Wparentheses-10.C. int foo (int); template<class T> void bar (T a, T b, T c) { foo (a & b ^ c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) ^ c); foo (a & (b ^ c)); foo (1 & 2 ^ c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) ^ c); foo (1 & (2 ^ c)); foo (1 & 2 ^ 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) ^ 3); foo (1 & (2 ^ 3)); foo (a ^ b & c); // { dg-warning "parentheses" "correct warning" } foo ((a ^ b) & c); foo (a ^ (b & c)); foo (1 ^ 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) & c); foo (1 ^ (2 & c)); foo (1 ^ 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) & 3); foo (1 ^ (2 & 3)); foo (a + b ^ c); // { dg-warning "parentheses" "correct warning" } foo ((a + b) ^ c); foo (a + (b ^ c)); foo (1 + 2 ^ c); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) ^ c); foo (1 + (2 ^ c)); foo (1 + 2 ^ 3); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) ^ 3); foo (1 + (2 ^ 3)); foo (a ^ b + c); // { dg-warning "parentheses" "correct warning" } foo ((a ^ b) + c); foo (a ^ (b + c)); foo (1 ^ 2 + c); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) + c); foo (1 ^ (2 + c)); foo (1 ^ 2 + 3); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) + 3); foo (1 ^ (2 + 3)); foo (a - b ^ c); // { dg-warning "parentheses" "correct warning" } foo ((a - b) ^ c); foo (a - (b ^ c)); foo (1 - 2 ^ c); // { dg-warning "parentheses" "correct warning" } foo ((1 - 2) ^ c); foo (1 - (2 ^ c)); foo (1 - 2 ^ 3); // { dg-warning "parentheses" "correct warning" } foo ((1 - 2) ^ 3); foo (1 - (2 ^ 3)); foo (a ^ b - c); // { dg-warning "parentheses" "correct warning" } foo ((a ^ b) - c); foo (a ^ (b - c)); foo (1 ^ 2 - c); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) - c); foo (1 ^ (2 - c)); foo (1 ^ 2 - 3); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) - 3); foo (1 ^ (2 - 3)); foo (a >= b ^ c); // { dg-warning "parentheses" "correct warning" } foo ((a >= b) ^ c); foo (a >= (b ^ c)); foo (1 >= 2 ^ c); // { dg-warning "parentheses" "correct warning" } foo ((1 >= 2) ^ c); foo (1 >= (2 ^ c)); foo (1 >= 2 ^ 3); // { dg-warning "parentheses" "correct warning" } foo ((1 >= 2) ^ 3); foo (1 >= (2 ^ 3)); foo (a ^ b >= c); // { dg-warning "parentheses" "correct warning" } foo ((a ^ b) >= c); foo (a ^ (b >= c)); foo (1 ^ 2 >= c); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) >= c); foo (1 ^ (2 >= c)); foo (1 ^ 2 >= 3); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) >= 3); foo (1 ^ (2 >= 3)); foo (a == b ^ c); // { dg-warning "parentheses" "correct warning" } foo ((a == b) ^ c); foo (a == (b ^ c)); foo (1 == 2 ^ c); // { dg-warning "parentheses" "correct warning" } foo ((1 == 2) ^ c); foo (1 == (2 ^ c)); foo (1 == 2 ^ 3); // { dg-warning "parentheses" "correct warning" } foo ((1 == 2) ^ 3); foo (1 == (2 ^ 3)); foo (a ^ b == c); // { dg-warning "parentheses" "correct warning" } foo ((a ^ b) == c); foo (a ^ (b == c)); foo (1 ^ 2 == c); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) == c); foo (1 ^ (2 == c)); foo (1 ^ 2 == 3); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) == 3); foo (1 ^ (2 == 3)); foo (a < b ^ c); // { dg-warning "parentheses" "correct warning" } foo ((a < b) ^ c); foo (a < (b ^ c)); foo (1 < 2 ^ c); // { dg-warning "parentheses" "correct warning" } foo ((1 < 2) ^ c); foo (1 < (2 ^ c)); foo (1 < 2 ^ 3); // { dg-warning "parentheses" "correct warning" } foo ((1 < 2) ^ 3); foo (1 < (2 ^ 3)); foo (a ^ b < c); // { dg-warning "parentheses" "correct warning" } foo ((a ^ b) < c); foo (a ^ (b < c)); foo (1 ^ 2 < c); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) < c); foo (1 ^ (2 < c)); foo (1 ^ 2 < 3); // { dg-warning "parentheses" "correct warning" } foo ((1 ^ 2) < 3); foo (1 ^ (2 < 3)); } template void bar<int> (int, int, int); // { dg-message "instantiated" }
google
chromium
noreturn-3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/noreturn-3.C
276
utf_8
99162a062d0507c49cfdb62a0ec174e4
// { dg-do compile } // { dg-options "-Wall" } // PR c++/13106: No return warning when return type is a dependent type. template <typename T> T dummy() { } int main() { dummy<void>(); }
google
chromium
Wcast-qual1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wcast-qual1.C
150
utf_8
3667162d7aa037ab6197e7d3ffea1a6c
// PR c++/24667 // { dg-options "-Wcast-qual" } int main(int, char**) { const int foo[2] = {1,1}; ((int*)foo)[0] = 0; // { dg-warning "cast" } }
google
chromium
Wstrict-aliasing-bogus-base-derived
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-base-derived.C
286
utf_8
36c50018c4d8d64200e0e3bc6b163e6d
/* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */ class base { public: int x; }; class derived: public base { public: int y; }; base foo () { derived d; base* pb = &d; /* { dg-bogus "base vs. derived" } */ pb->x = 1; return d; }
google
chromium
pr30636
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr30636.C
409
utf_8
40f3a713eb0d35566b12333645fb0772
/* { dg-do compile } */ /* { dg-options "-O2 -Warray-bounds" } */ typedef char one_buffer[512]; static one_buffer emergency_buffer[4]; void free_exception (void *vptr) { char *base = (char *) &emergency_buffer[0][0]; char *ptr = (char *) vptr; if (ptr >= base && ptr < base + sizeof (emergency_buffer)) /* { dg-bogus "subscript" } */ { /* Do something. */ __builtin_exit (0); } }
google
chromium
pmf1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pmf1.C
258
utf_8
acd9eb52e3298cbde90941f636efb15f
// { dg-do compile } // PR c++/10496: Incorrect pointer to member function diagnostics // for constant member functions. struct a { int f() const; }; int a::f() const { int (a::* b)() const = &f; // { dg-error "&a::f" } }
google
chromium
Wswitch-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wswitch-1.C
1,302
utf_8
a6c41dcd4c09f3501aad8a911a32cbf2
/* PR c/4475, PR c++/3780 */ /* { dg-do compile } */ /* { dg-options "-Wswitch" } */ enum e { e1, e2 }; int foo (int i, int j, enum e ei, enum e ej, enum e ek, enum e el, enum e em, enum e en, enum e eo, enum e ep) { switch (i) { case 1: return 1; case 2: return 2; } switch (j) { case 3: return 4; case 4: return 3; default: break; } switch (ei) /* { dg-warning "enumeration value 'e1' not handled in switch" "enum e1" } */ { /* { dg-warning "enumeration value 'e2' not handled in switch" "enum e2" { target *-*-* } 22 } */ } switch (ej) { default: break; } switch (ek) /* { dg-warning "enumeration value 'e2' not handled in switch" "enum e2" } */ { case e1: return 1; } switch (el) { case e1: return 1; default: break; } switch (em) { case e1: return 1; case e2: return 2; } switch (en) { case e1: return 1; case e2: return 2; default: break; } switch (eo) { case e1: return 1; case e2: return 2; case 3: return 3; /* { dg-warning "exceeds maximum value" } */ } switch (ep) { case e1: return 1; case e2: return 2; case 3: return 3; /* { dg-warning "exceeds maximum value" } */ default: break; } return 0; }
google
chromium
write-strings
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/write-strings.C
134
utf_8
473862097a6bfdb68fff708f505e14db
// { dg-do compile } // { dg-options -Wwrite-strings } int main() { char* p = "Asgaard"; // { dg-warning "deprecated" } }
google
chromium
effc1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/effc1.C
358
utf_8
5e598309e0a011e0e37afcaf0b658c4f
// { dg-options -Weffc++ } // { dg-do compile } // Bug 5719 class A { public: A & operator+=( int ); A & operator+( int ); // { dg-warning ".* should return by value" "" } A operator+=( float ); A operator+( float ); };
google
chromium
Wuninitializable-member-no
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wuninitializable-member-no.C
393
utf_8
0101ac7bc499a86bdbc20c8ef3cfa386
// Test disabling // { dg-do compile } // { dg-options "-Wall -Wextra -Wno-uninitialized" } class X { int & flag;// { dg-bogus "non-static reference 'int& X::flag' in class without a constructor" } public: void f(){ flag++ ; } }; class Y { const int var;// { dg-bogus "non-static const member 'const int Y::var' in class without a constructor" } public: int g(){ return 2*var; } };
google
chromium
pr36999
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr36999.C
773
utf_8
b731b5d32c1f477ed23555d37dcf870a
/* PR36999: Erroneous "does not declare anything" warnings. */ /* { dg-do compile } */ class C1 { public: class C2 { }; }; void cf1 (class C1::C2, void*); // { dg-bogus "does not declare anything" } void cf2 (void*, class C1::C2); void cf3 (C1::C2, void*); namespace N { enum E1 { foo }; enum E2 { bar }; template <class X> class TC1 { }; template <class T, class U> class TC2 : public TC1<T> { }; } void tcf1 (N::TC2<enum N::E1, void*> *arg1, // { dg-bogus "does not declare anything" } N::TC2<void*, enum N::E1> *arg2, N::TC2<N::E1, void*> *arg3) { } void * tcf2 (void *x) { return (void *) (N::TC2<enum N::E1, void*> *) // { dg-bogus "does not declare anything" } (N::TC2<void*, enum N::E1> *) (N::TC2<N::E1, void*> *) x; }
google
chromium
implicit-typename3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/implicit-typename3.C
273
utf_8
5d559af51cd6e5fbe0dbb5a62a5d3366
// { dg-do compile } // PR c++/11039: Implicit typename warning in friend class declaration. template <typename T> struct X { struct Y { struct Z {}; }; template <typename U> friend struct Y::Z f(U); };
google
chromium
anonymous-namespace-3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C
285
utf_8
43f33b0230eba15de4dc68858b227d06
// Test for the warning of exposing types from an anonymous namespace // { dg-do compile } // #include <memory> #include "anonymous-namespace-3.h" struct B { std::auto_ptr<A> p; }; #line 10 "foo.C" struct C { // { dg-warning "uses the anonymous namespace" } std::auto_ptr<A> p; };
google
chromium
Winline-2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Winline-2.C
92
utf_8
0e30443ee25811cad88723354c525b24
// PR c++/10929 // { dg-options "-Winline -O3" } int foo (); int bar () { return foo (); }
google
chromium
overflow-warn-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/overflow-warn-1.C
4,021
utf_8
f0e61871be68e9802896258e55a239bf
/* { dg-do compile } */ /* { dg-options "" } */ #include <limits.h> enum e { E0 = INT_MAX, /* Unsigned overflow wraps around. */ E1 = UINT_MAX + 1, /* Overflow in an unevaluated part of an expression is OK (example in the standard). */ E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */ E3 = 1 / 0, /* { dg-warning "division by zero" } */ /* { dg-error "enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */ /* But as in DR#031, the 1/0 in an evaluated subexpression means the whole expression violates the constraints. */ E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ /* Again, overflow in evaluated subexpression. */ E6 = 0 * (INT_MAX + 1), /* { dg-warning "integer overflow in expression" } */ /* A cast does not constitute overflow in conversion. */ E7 = (char) INT_MAX }; struct s { int a; int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ }; void f (void) { /* This expression is not required to be a constant expression, so it should just involve undefined behavior at runtime. */ int c = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */ } /* This expression is neither required to be constant. */ static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */ // Test for overflow in null pointer constant. void *n = 0; /* The first two of these involve overflow, so are not null pointer constants. The third has the overflow in an unevaluated subexpression, so is a null pointer constant. */ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 51 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ /* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 53 } */ void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 55 } */ void g (int i) { switch (i) { case 0 * (1/0): /* { dg-warning "division by zero" } */ ; case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ ; } } int h (void) { return INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */ } int h1 (void) { return INT_MAX + 1 - INT_MAX; /* { dg-warning "integer overflow in expression" } */ } void fuc (unsigned char); void fsc (signed char); void h2 (void) { fsc (SCHAR_MAX + 1); fsc (SCHAR_MIN - 1); /* { dg-warning "overflow in implicit constant conversion" } */ fsc (UCHAR_MAX); fsc (UCHAR_MAX + 1); /* { dg-warning "overflow in implicit constant conversion" } */ fuc (-1); fuc (UCHAR_MAX + 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */ fuc (SCHAR_MIN); fuc (SCHAR_MIN - 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */ fuc (-UCHAR_MAX); /* { dg-warning "large integer implicitly truncated to unsigned type" } */ } void fui (unsigned int); void fsi (signed int); int si; unsigned ui; void h2i (int x) { /* For some reason, we only give certain warnings for implicit conversions among values of the same precision with -Wconversion, while we don't give others at all. */ fsi ((unsigned)INT_MAX + 1); si = (unsigned)INT_MAX + 1; si = x ? (unsigned)INT_MAX + 1 : 1; fsi ((unsigned)INT_MAX + 2); si = (unsigned)INT_MAX + 2; si = x ? (unsigned)INT_MAX + 2 : 1; fsi (UINT_MAX); si = UINT_MAX; fui (-1); ui = -1; ui = x ? -1 : 1U; fui (INT_MIN); ui = INT_MIN; ui = x ? INT_MIN : 1U; }
google
chromium
conv3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/conv3.C
66
utf_8
cc281c397d45da8c573eee459fc65fa7
// PR c++/19457 int i=-1; unsigned int j= ~0; // { dg-bogus "" }
google
chromium
Walways-true-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Walways-true-1.C
1,433
utf_8
31374840ed3137c47aa43f8aefc76125
// Test -Waddress for testing an address against NULL. // { dg-do compile} // { dg-options "-Waddress" } extern int foo (int); int i; void bar (int a) { lab: if (foo) // { dg-warning "always evaluate as" "correct warning" } foo (0); if (foo (1)) ; if (&i) // { dg-warning "always evaluate as" "correct warning" } foo (2); if (i) foo (3); if (&a) // { dg-warning "always evaluate as" "correct warning" } foo (4); if (a) foo (5); if (&&lab) // { dg-warning "always evaluate as" "correct warning" } foo (6); if (foo == 0) // { dg-warning "never be NULL" "correct warning" } foo (7); if (foo (1) == 0) foo (8); if (&i == 0) // { dg-warning "never be NULL" "correct warning" } foo (9); if (i == 0) foo (10); if (&a == 0) // { dg-warning "never be NULL" "correct warning" } foo (11); if (a == 0) foo (12); if (&&lab == 0) // { dg-warning "never be NULL" "correct warning" } foo (13); if (0 == foo) // { dg-warning "never be NULL" "correct warning" } foo (14); if (0 == foo (1)) foo (15); if (0 == &i) // { dg-warning "never be NULL" "correct warning" } foo (16); if (0 == i) foo (17); if (0 == &a) // { dg-warning "never be NULL" "correct warning" } foo (18); if (0 == a) foo (19); if (0 == &&lab) // { dg-warning "never be NULL" "correct warning" } foo (20); }
google
chromium
template-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/template-1.C
351
utf_8
6f90eb3a0f4a4e7f096197fba7797aff
//PR c++/11490 //Since N is know at instantiation time, there // should be no warning about comparision between // unsinged and signed interegers. // { dg-do compile } // { dg-options "-W" } template <int N> bool f() { unsigned int i=0; return i!=N; // { dg-bogus "signed and unsigned" } } template bool f<2> ();
google
chromium
pr23075
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr23075.C
176
utf_8
9f46d0be09249c34a6a9b97b99dcec35
// PR c/23075 // { dg-do compile } // { dg-options "-O2 -Wreturn-type" } int foo (void) { return; // { dg-error "with no value" } } // { dg-warning "no return statement" }
google
chromium
Wbraces2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wbraces2.C
715
utf_8
c2debf54ffb3d60acfddad10573c458f
// PR c++/20175 // { dg-options "-Wmissing-braces" } int a[2][2] = { 0, 1, 2, 3 }; // { dg-warning "missing braces" } int b[2][2] = { { 0, 1 }, { 2, 3 } }; int c[2][2] = { { { 0 }, 1 }, { 2, 3 } }; // { dg-error "braces around scalar" } struct S { char s[6]; int i; }; S d = { "hello", 1 }; S e = { { "hello" }, 1 }; S f = { { { "hello" } }, 1 }; // { dg-error "braces around scalar" } S g = { 'h', 'e', 'l', 'l', 'o', '\0', 1 }; // { dg-warning "missing braces" } struct T { wchar_t s[6]; int i; }; T i = { L"hello", 1 }; T j = { { L"hello" }, 1 }; T k = { { { L"hello" } }, 1 }; // { dg-error "braces around scalar" } T l = { L'h', L'e', L'l', L'l', L'o', L'\0', 1 };// { dg-warning "missing braces" }
google
chromium
null4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/null4.C
836
utf_8
5c5db225cc578c354ad113422ce184e6
// PR c++/24745 : warnings for NULL constant. // { dg-do compile } // { dg-options "-Wpointer-arith -Wconversion " } #include <cstddef> int foo (void) { if (NULL == 1) return -1; // { dg-warning "NULL used in arithmetic" } if (NULL > NULL) return -1; // { dg-warning "NULL used in arithmetic" } if (NULL < NULL) return -1; // { dg-warning "NULL used in arithmetic" } if (NULL >= 0) return -1; // { dg-warning "NULL used in arithmetic" } if (NULL <= 0) return -1; // { dg-warning "NULL used in arithmetic" } return 0; } int bar (void) { if (NULL) return -1; if (!NULL) return -1; if (!NULL == 1) return -1; if (NULL || NULL) return -1; if (!NULL && NULL) return -1; if (NULL == NULL) return -1; if (NULL != NULL) return -1; if (NULL == 0) return -1; if (NULL != 0) return -1; return 0; }
google
chromium
Wuninitialized-4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wuninitialized-4.C
303
utf_8
be5b47714ba41b25933660896d6c7427
// PR middle-end/39666 // { dg-do compile } // { dg-options "-O2 -Wuninitialized" } int foo (int i) { int j; switch (i) { case -__INT_MAX__ - 1 ... -1: j = 6; break; case 0: j = 5; break; case 1 ... __INT_MAX__: j = 4; break; } return j; }
google
chromium
Wshadow-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wshadow-1.C
1,059
utf_8
5f3bcedcf90b0a88ec7f6f5dc569ce69
/* { dg-do compile } */ /* { dg-options -Wshadow } */ /* Source: Neil Booth, 3 Nov 2001, and PR 16, 713. -Wshadow was giving a bunch of warnings we didn't want, and wasn't giving the location of the shadowed variable. */ struct status // { dg-bogus "shadowed declaration" } { int member; void foo2 (); inline static int foo3 (int member) // { dg-bogus "shadows" } { return member; } }; int decl1; // { dg-warning "shadowed declaration" } int decl2; // { dg-warning "shadowed declaration" } void foo (struct status &status,// { dg-bogus "shadows a global decl" } double decl1) // { dg-warning "shadows a global decl" } { } void foo1 (int d) { double d; // { dg-error "shadows a parameter" } } void status::foo2 () { int member; // { dg-warning "shadows a member" } int decl2; // { dg-warning "shadows a global decl" } int local; // { dg-warning "shadowed declaration" } { int local; // { dg-warning "shadows a previous local" } } }
google
chromium
Wparentheses-20
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-20.C
3,602
utf_8
bb97c3c25bd923a37712b522c7f1f614
// { dg-do compile } // { dg-options "-Wparentheses" } // Template version of Wparentheses-11.C. int foo (int); template<class T> void bar (T a, T b, T c) { foo (a + b & c); // { dg-warning "parentheses" "correct warning" } foo ((a + b) & c); foo (a + (b & c)); foo (1 + 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) & c); foo (1 + (2 & c)); foo (1 + 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) & 3); foo (1 + (2 & 3)); foo (a & b + c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) + c); foo (a & (b + c)); foo (1 & 2 + c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) + c); foo (1 & (2 + c)); foo (1 & 2 + 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) + 3); foo (1 & (2 + 3)); foo (a - b & c); // { dg-warning "parentheses" "correct warning" } foo ((a - b) & c); foo (a - (b & c)); foo (1 - 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 - 2) & c); foo (1 - (2 & c)); foo (1 - 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 - 2) & 3); foo (1 - (2 & 3)); foo (a & b - c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) - c); foo (a & (b - c)); foo (1 & 2 - c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) - c); foo (1 & (2 - c)); foo (1 & 2 - 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) - 3); foo (1 & (2 - 3)); foo (a < b & c); // { dg-warning "parentheses" "correct warning" } foo ((a < b) & c); foo (a < (b & c)); foo (1 < 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 < 2) & c); foo (1 < (2 & c)); foo (1 < 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 < 2) & 3); foo (1 < (2 & 3)); foo (a & b < c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) < c); foo (a & (b < c)); foo (1 & 2 < c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) < c); foo (1 & (2 < c)); foo (1 & 2 < 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) < 3); foo (1 & (2 < 3)); foo (a == b & c); // { dg-warning "parentheses" "correct warning" } foo ((a == b) & c); foo (a == (b & c)); foo (1 == 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 == 2) & c); foo (1 == (2 & c)); foo (1 == 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 == 2) & 3); foo (1 == (2 & 3)); foo (a & b == c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) == c); foo (a & (b == c)); foo (1 & 2 == c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) == c); foo (1 & (2 == c)); foo (1 & 2 == 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) == 3); foo (1 & (2 == 3)); foo (a != b & c); // { dg-warning "parentheses" "correct warning" } foo ((a != b) & c); foo (a != (b & c)); foo (1 != 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 != 2) & c); foo (1 != (2 & c)); foo (1 != 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 != 2) & 3); foo (1 != (2 & 3)); foo (a & b != c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) != c); foo (a & (b != c)); foo (1 & 2 != c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) != c); foo (1 & (2 != c)); foo (1 & 2 != 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) != 3); foo (1 & (2 != 3)); } template void bar<int> (int, int, int); // { dg-message "instantiated" }
google
chromium
Wreturn-type-6
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wreturn-type-6.C
396
utf_8
e54502fc6abef190bf580b1fbcf501ac
/* PR c++/40749 */ /* { dg-do "compile" } */ /* { dg-options "-Wreturn-type" } */ struct A {}; const A a() {} /* { dg-warning "no return statement" } */ const A& b() {} /* { dg-warning "no return statement" } */ const int c() {} /* { dg-warning "no return statement" } */ template<class T> const int foo(T t) {} /* { dg-warning "no return statement" } */ int d = foo<int>(0), e = foo<int>(1);
google
chromium
Wstrict-aliasing-8
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-8.C
372
utf_8
71435332433246858548fb92a3a29591
/* { dg-do compile } */ /* { dg-options "-Wstrict-aliasing=2 -O2 -Wall" } */ int a[2]; double *foo1(void) { return (double *)a; /* { dg-warning "strict-aliasing" } */ } double *foo2(void) { return (double *)&a[0]; /* { dg-warning "strict-aliasing" } */ } __complex__ double x; int *bar(void) { return (int *)&__imag__ x; /* { dg-warning "strict-aliasing" } */ }
google
chromium
pr33738
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr33738.C
398
utf_8
cb6fc0dc164cb69b0706664d0efc0ea1
// { dg-do run } // { dg-options "-O2 -Wtype-limits" } extern void link_error (void); enum Alpha { ZERO = 0, ONE, TWO, THREE }; Alpha a2; int m1 = -1; int GetM1() { return m1; } int main() { a2 = static_cast<Alpha>(GetM1()); if (a2 == -1) { // { dg-warning "always false due" } link_error (); } if (-1 == a2) { // { dg-warning "always false due" } link_error (); } return 0; }
google
chromium
Wfloat-equal-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C
430
utf_8
5eb7ea7761d111befc6050ff4baa1559
/* PR c/19999 */ /* { dg-do compile } */ /* { dg-options "-Wfloat-equal" } */ double a, b; _Complex double c, d; int f(void) { return a == b; } /* { dg-warning "comparing floating point" } */ int g(void) { return c == d; } /* { dg-warning "comparing floating point" } */ int h(void) { return a != b; } /* { dg-warning "comparing floating point" } */ int i(void) { return c != d; } /* { dg-warning "comparing floating point" } */
google
chromium
Wparentheses-14
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-14.C
586
utf_8
e151ff9706ff8f8d25eb870b6f099bc2
// { dg-do compile } // { dg-options "-Wparentheses" } // Template version of Wparentheses-2.C. int foo (int); int a, b, c; bool d; template<class T> void bar (T) { if (a += b) foo (0); if (a -= a) foo (1); if (b *= c) foo (2); else foo (3); if (b /= b) foo (4); else foo (5); while (c %= b) foo (6); while (c <<= c) foo (7); do foo (8); while (a >>= b); do foo (9); while (a &= a); for (;c ^= b;) foo (10); for (;c |= c;) foo (11); d = a += b; foo (12); d = a -= a; foo (13); } template void bar<int> (int);
google
chromium
Wstrict-aliasing-float-ref-int-obj
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C
336
utf_8
4e99d85b0010de275209c6759c92557e
/* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */ int foo() { int x; float& q = reinterpret_cast<float&> (x); /* { dg-message "initialized" } */ q = 1.0; /* { dg-warning "does break strict-aliasing" } */ return x; } /* { dg-message "dereferencing type-punned" "" { target *-*-* } 7 } */
google
chromium
pr8715
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr8715.C
192
utf_8
a6a330b9948ca9b7ebe194a6edd63903
/* { dg-do compile } */ /* { dg-options "-Wsign-compare" } */ int foo() { unsigned char b = '1'; bool x = ~b; /* { dg-warning "promoted ~unsigned is always non-zero" } */ return 0; }
google
chromium
pr30551
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr30551.C
315
utf_8
8cfb784bce12acc66c8663f55f1f3481
// PR 30551 -Wmain is enabled by default. // { dg-do compile } // { dg-options "" } // { dg-skip-if "-Wmain not enabled on SPU" { spu-*-* } } int main(char a) {} /* { dg-warning "first argument of .*main.* should be .int." } */ /* { dg-warning "main.* takes only zero or two arguments" "" { target *-*-* } 5 } */
google
chromium
pointer-integer-comparison
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C
790
utf_8
f8f2c98db3d6299492ead2d45e4b5e37
// { dg-do compile } // { dg-options "-fsyntax-only -fpermissive" } int foo (int i, void *p) { if (i == p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } return 0; else if (i != p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } return 1; } int bar (int i, void *p) { if (i < p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } return 0; else if (i >= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } return 1; } int baz (int i, void *p) { if (i <= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } return 0; else if (i > p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" } return 1; }
google
chromium
Wparentheses-11
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-11.C
3,515
utf_8
3be49cd413635d5c6d8228545da74c15
// { dg-do compile } // { dg-options "-Wparentheses" } // C++ version of gcc.dg/Wparentheses-8.c int foo (int); int bar (int a, int b, int c) { foo (a + b & c); // { dg-warning "parentheses" "correct warning" } foo ((a + b) & c); foo (a + (b & c)); foo (1 + 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) & c); foo (1 + (2 & c)); foo (1 + 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) & 3); foo (1 + (2 & 3)); foo (a & b + c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) + c); foo (a & (b + c)); foo (1 & 2 + c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) + c); foo (1 & (2 + c)); foo (1 & 2 + 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) + 3); foo (1 & (2 + 3)); foo (a - b & c); // { dg-warning "parentheses" "correct warning" } foo ((a - b) & c); foo (a - (b & c)); foo (1 - 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 - 2) & c); foo (1 - (2 & c)); foo (1 - 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 - 2) & 3); foo (1 - (2 & 3)); foo (a & b - c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) - c); foo (a & (b - c)); foo (1 & 2 - c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) - c); foo (1 & (2 - c)); foo (1 & 2 - 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) - 3); foo (1 & (2 - 3)); foo (a < b & c); // { dg-warning "parentheses" "correct warning" } foo ((a < b) & c); foo (a < (b & c)); foo (1 < 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 < 2) & c); foo (1 < (2 & c)); foo (1 < 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 < 2) & 3); foo (1 < (2 & 3)); foo (a & b < c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) < c); foo (a & (b < c)); foo (1 & 2 < c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) < c); foo (1 & (2 < c)); foo (1 & 2 < 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) < 3); foo (1 & (2 < 3)); foo (a == b & c); // { dg-warning "parentheses" "correct warning" } foo ((a == b) & c); foo (a == (b & c)); foo (1 == 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 == 2) & c); foo (1 == (2 & c)); foo (1 == 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 == 2) & 3); foo (1 == (2 & 3)); foo (a & b == c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) == c); foo (a & (b == c)); foo (1 & 2 == c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) == c); foo (1 & (2 == c)); foo (1 & 2 == 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) == 3); foo (1 & (2 == 3)); foo (a != b & c); // { dg-warning "parentheses" "correct warning" } foo ((a != b) & c); foo (a != (b & c)); foo (1 != 2 & c); // { dg-warning "parentheses" "correct warning" } foo ((1 != 2) & c); foo (1 != (2 & c)); foo (1 != 2 & 3); // { dg-warning "parentheses" "correct warning" } foo ((1 != 2) & 3); foo (1 != (2 & 3)); foo (a & b != c); // { dg-warning "parentheses" "correct warning" } foo ((a & b) != c); foo (a & (b != c)); foo (1 & 2 != c); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) != c); foo (1 & (2 != c)); foo (1 & 2 != 3); // { dg-warning "parentheses" "correct warning" } foo ((1 & 2) != 3); foo (1 & (2 != 3)); }
google
chromium
ignored_typedef
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/ignored_typedef.C
830
utf_8
8ab4f00d5edff6f6c7baa38049347237
// PR c++/23689 // Test that malformed typedef's produce a compiler warning. typedef char valid_0; typedef int valid_1; typedef long valid_2; typedef float valid_3; typedef double valid_4; typedef unsigned valid_5; typedef int *valid_6; typedef struct valid_7 {} valid_8; typedef struct {} valid_9; typedef int temp_0; typedef temp_0 valid_10; struct temp_1 {}; typedef temp_1 valid_11; union temp_2 {}; typedef temp_2 valid_12; typedef void (*valid_13) (int); typedef struct invalid_0 {}; // { dg-warning "'typedef' was ignored" } typedef class invalid_1 {}; // { dg-warning "'typedef' was ignored" } typedef enum invalid_2 { INVALID_2 }; // { dg-warning "'typedef' was ignored" } typedef enum { INVALID_3 }; // { dg-warning "'typedef' was ignored" } typedef union invalid_4 {}; // { dg-warning "'typedef' was ignored" }
google
chromium
pragma-system_header3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pragma-system_header3.C
110
utf_8
731cdbbff9a041d6f86a91b8596ae256
// PR c++/32368 // { dg-options "-Wall -O" } #include "pragma-system_header3.h" int main() { return f(); }
google
chromium
Wparentheses-8
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-8.C
851
utf_8
1440e102f955e4e422a63b32d881465f
// { dg-do compile } // { dg-options "-Wparentheses" } // C++ version of gcc.dg/Wparentheses-5.c int foo (int); int bar (int a, int b, int c) { foo (a && b || c); // { dg-warning "parentheses" "correct warning" } foo ((a && b) || c); foo (a && (b || c)); foo (1 && 2 || c); // { dg-warning "parentheses" "correct warning" } foo ((1 && 2) || c); foo (1 && (2 || c)); foo (1 && 2 || 3); // { dg-warning "parentheses" "correct warning" } foo ((1 && 2) || 3); foo (1 && (2 || 3)); foo (a || b && c); // { dg-warning "parentheses" "correct warning" } foo ((a || b) && c); foo (a || (b && c)); foo (1 || 2 && c); // { dg-warning "parentheses" "correct warning" } foo ((1 || 2) && c); foo (1 || (2 && c)); foo (1 || 2 && 3); // { dg-warning "parentheses" "correct warning" } foo ((1 || 2) && 3); foo (1 || (2 && 3)); }
google
chromium
noeffect6
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/noeffect6.C
239
utf_8
58c48dbaffba495d57fb0bf370f50060
// { dg-options "-Wall" } // PR c++/15083 extern "C" int printf(const char*,...); struct Counter { Counter(){printf("Hello World.\n");} }; template< typename T > void resetData() { new Counter(); } int main() { resetData<int>(); }
google
chromium
pragma-system_header4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pragma-system_header4.C
93
utf_8
1fdb0226c11f07a183a891197a82305b
// PR c++/32256 // { dg-options "-Wall" } #include "pragma-system_header4.h" void ok() { }
google
chromium
Wreturn-type-3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C
142
utf_8
0877959d4ff69bc477955ce1ceadb231
// PR middle-end/19583 // { dg-options "-Wreturn-type -O" } struct E{}; inline int bar() throw(E) { return 0; } void foo () { bar(); }
google
chromium
Wunused-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wunused-1.C
288
utf_8
d08f8f4d2f55349741193b20c16afa1a
// Test whether -Wunused handles empty classes the same as non-empty. // { dg-do compile } // { dg-options "-Wunused" } struct A {}; struct B { char c; }; void foo () { struct A a0, a1; struct B b0, b1 = { 25 }; a0 = a1; // { dg-bogus "value computed is not used" } b0 = b1; }
google
chromium
Wdiv-by-zero
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wdiv-by-zero.C
156
utf_8
c71f5fb3792e0ba57c0a4e43cd39038f
// test that division by zero warnings are enabled by default int breakme() { int x = 0; x /= 0; // { dg-warning "division by" } return x; }
google
chromium
Wlogical-op-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wlogical-op-1.C
1,078
utf_8
a841cc2e2aef864cd61c9ccd3df0f003
// { dg-do compile} // { dg-options "-Wlogical-op" } enum { a, b1, b2 }; enum testenum { t1, t2}; extern int c; extern bool bool_a, bool_b; template<typename Enum> class QFlags { public: typedef void **Zero; int i; inline QFlags(Enum f) : i(f) {} inline operator int() const { return i;} }; QFlags<testenum> f(t2); extern void do_something(int); extern testenum testa(); void foo() { if ( f && b2 ) // { dg-warning "always evaluate as" } do_something(1); if ( c && b2 ) // { dg-warning "always evaluate as" } do_something(2); if ( b2 && c == a ) // { dg-bogus "always evaluate as" } do_something(101); if ( 1 && c ) do_something(102); // { dg-bogus "always evaluate as" } if ( t2 && b2 ) // { dg-bogus "always evaluate as" } do_something(103); if ( true && c == a ) // { dg-bogus "always evaluate as" } do_something(104); if ( b2 && true ) // { dg-bogus "always evaluate as" } do_something(105); }
google
chromium
Warray-bounds
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Warray-bounds.C
2,453
utf_8
f5eb6c2422098ba976ee77f44b4ca93c
/* { dg-do compile } */ /* { dg-options "-O2 -Warray-bounds" } */ int a[10]; static inline int n(void) { __SIZE_TYPE__ strlen(const char *s); return strlen("12345"); } void g(int *p); void h(int p); int* f(void) { int b[10]; int i; struct { int c[10]; } c; a[-1] = 0; /* { dg-warning "array subscript" } */ a[ 0] = 0; a[ 1] = 0; a[ 9] = 0; a[10] = 0; /* { dg-warning "array subscript" } */ a[11] = 0; /* { dg-warning "array subscript" } */ a[2 * n() - 11] = 0; /* { dg-warning "array subscript" } */ a[2 * n() - 10] = 0; a[2 * n() - 1] = 0; a[2 * n() - 0] = 0; /* { dg-warning "array subscript" } */ b[-1] = 0; /* { dg-warning "array subscript" } */ b[ 0] = 0; b[ 1] = 0; b[ 9] = 0; b[10] = 0; /* { dg-warning "array subscript" } */ b[11] = 0; /* { dg-warning "array subscript" } */ b[2 * n() - 11] = 0; /* { dg-warning "array subscript" } */ b[2 * n() - 10] = 0; b[2 * n() - 1] = 0; b[2 * n() - 0] = 0; /* { dg-warning "array subscript" } */ c.c[-1] = 0; /* { dg-warning "array subscript" } */ c.c[ 0] = 0; c.c[ 1] = 0; c.c[ 9] = 0; c.c[10] = 0; /* { dg-warning "array subscript" } */ c.c[11] = 0; /* { dg-warning "array subscript" } */ c.c[2 * n() - 11] = 0; /* { dg-warning "array subscript" } */ c.c[2 * n() - 10] = 0; c.c[2 * n() - 1] = 0; c.c[2 * n() - 0] = 0; /* { dg-warning "array subscript" } */ g(&a[8]); g(&a[9]); g(&a[10]); g(&a[11]); /* { dg-warning "array subscript" } */ g(&a[-30]+10); /* { dg-warning "array subscript" } */ g(&a[-30]+30); g(&b[10]); g(&c.c[10]); g(&a[11]); /* { dg-warning "array subscript" } */ g(&b[11]); /* { dg-warning "array subscript" } */ g(&c.c[11]); /* { dg-warning "array subscript" } */ g(&a[0]); g(&b[0]); g(&c.c[0]); g(&a[-1]); /* { dg-warning "array subscript" } */ g(&b[-1]); /* { dg-warning "array subscript" } */ h(sizeof a[-1]); h(sizeof a[10]); h(sizeof b[-1]); h(sizeof b[10]); h(sizeof c.c[-1]); h(sizeof c.c[10]); if (10 < 10) a[10] = 0; if (10 < 10) b[10] = 0; if (-1 >= 0) c.c[-1] = 0; return a; }
google
chromium
Wparentheses-23
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-23.C
2,377
utf_8
3f7e8bba62a8857d7cdee73ed7c315b7
// { dg-do compile } // { dg-options "-Wparentheses" } // Template version of Wparentheses-22.C. int foo (int); class C { public: C() : b(0) { } // Use default assignment constructor. // Provide conversion to bool so that an instance of this class will // work as a condition. operator bool() const { return b != 0; } private: int b; }; C a, b, c; bool d; template<class T> void bar (T) { if (a = b) // { dg-warning "assignment" "correct warning" } foo (0); if ((a = b)) foo (1); if (a = a) // { dg-warning "assignment" "correct warning" } foo (2); if ((a = a)) foo (3); if (b = c) // { dg-warning "assignment" "correct warning" } foo (4); else foo (5); if ((b = c)) foo (6); else foo (7); if (b = b) // { dg-warning "assignment" "correct warning" } foo (8); else foo (9); if ((b = b)) foo (10); else foo (11); while (c = b) // { dg-warning "assignment" "correct warning" } foo (12); while ((c = b)) foo (13); while (c = c) // { dg-warning "assignment" "correct warning" } foo (14); while ((c = c)) foo (15); do foo (16); while (a = b); // { dg-warning "assignment" "correct warning" } do foo (17); while ((a = b)); do foo (18); while (a = a); // { dg-warning "assignment" "correct warning" } do foo (19); while ((a = a)); for (;c = b;) // { dg-warning "assignment" "correct warning" } foo (20); for (;(c = b);) foo (21); for (;c = c;) // { dg-warning "assignment" "correct warning" } foo (22); for (;(c = c);) foo (23); d = a = b; // { dg-warning "assignment" "correct warning" } foo (24); d = (a = b); foo (25); d = a = a; // { dg-warning "assignment" "correct warning" } foo (26); d = (a = a); foo (27); if (C(a)) foo (28); } template<class T> bool bar1 (T) { return a = b; // { dg-warning "assignment" "correct warning" } } template<class T> bool bar2 (T) { return (a = b); } template<class T> bool bar3 (T) { return a = a; // { dg-warning "assignment" "correct warning" } } template<class T> bool bar4 (T) { return (a = a); } template void bar<int> (int); // { dg-message "instantiated" } template bool bar1<int> (int); // { dg-message "instantiated" } template bool bar2<int> (int); template bool bar3<int> (int); // { dg-message "instantiated" } template bool bar4<int> (int);
google
chromium
Wparentheses-21
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-21.C
1,057
utf_8
f5f50acbe2a146e13079538cc1b650f3
// { dg-do compile } // { dg-options "-Wparentheses" } // Template version of Wparentheses-12.C. Note that we currently warn // when we initially parse the template, not when we are instantiating // it. That seems reasonable since the template parameters can not // affect the syntax parsing. int foo (int); int a, b, c; template<class T> void bar (T) { if (a) foo (0); if (b) foo (1); else foo (2); foo (8); else foo (9); else foo (10); if (a) if (b) foo (15); else foo (16); else foo (17); } } template void bar<int> (int);
google
chromium
implicit-typename1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/implicit-typename1.C
422
utf_8
d75c242679a546679f0392d6a34e741e
// The -pedantic option must be omitted to trigger the crash. // { dg-do compile } // { dg-options "" } // PR c++/7982: Crash warning about implicit typename. // The base class refers to another typename, while the // name lookup finds a template. template <typename T> struct X {}; template <typename T> struct C { typedef typename T::X X; }; template <typename T> struct A : public C<T> { typedef ::X<int> X; };
google
chromium
oldcast1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/oldcast1.C
384
utf_8
33e37856b8391737e80c51371895ce7d
// { dg-do compile } // { dg-options "-ansi -pedantic-errors -Wold-style-cast" } // PR 5089. old style cast to void should be permitted (think assert) void foo () { int i; float f = (float)i; // { dg-warning "use of old-style cast" "" } (void)i; }
google
chromium
conv2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/conv2.C
106
utf_8
8cdb559ffcb9d887ccbede485723468a
// PR c++/13932 // { dg-options "-Wconversion" } int i = 1.; int j = 1.1; // { dg-warning "conversion" }
google
chromium
Wunused-6
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wunused-6.C
205
utf_8
716f99b28cebbf385c168497daeff7ae
/* PR middle-end/14203 */ /* { dg-do compile } */ /* { dg-options "-Wall" } */ void foo() { if (false) if (int i=0) // { dg-warning "unused" "" } int j=0; // { dg-warning "unused" "" } }
google
chromium
pr36921
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr36921.C
1,008
utf_8
fb0ed1392cbdeb787735900d17b8c33a
/* PR 36921: comparison operator can be overloaded. Do not emit warnings in such case. { dg-do compile } { dg-options "-Wparentheses" } */ struct A {}; A operator<(A, A) { return A(); } A operator>(A, A) { return A(); } A operator<=(A, A) { return A(); } A operator>=(A, A) { return A(); } A operator==(A, A) { return A(); } A operator!=(A, A) { return A(); } int main() { A() < A() < A(); // should not emit warning 1 < 2 < 3; // { dg-warning "mathematical meaning" "parentheses" } A() > A() > A(); // should not emit warning 1 > 2 > 3; // { dg-warning "mathematical meaning" "parentheses" } A() <= A() <= A(); // should not emit warning 1 <= 2 <= 3; // { dg-warning "mathematical meaning" "parentheses" } A() >= A() >= A(); // should not emit warning 1 >= 2 >= 3; // { dg-warning "mathematical meaning" "parentheses" } A() == A() < A (); // { dg-warning "suggest parentheses" "parentheses" } A() < A() != A (); // { dg-warning "suggest parentheses" "parentheses" } return 0; }
google
chromium
format2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/format2.C
1,489
utf_8
77cfd7b8f34afd97ff68bc102b6c6fc6
// Test for format attributes: test applying them to types in C++. // { dg-do compile } // { dg-options "-Wformat" } __attribute__((format(printf, 1, 2))) void (*tformatprintf0) (const char *, ...); void (*tformatprintf1) (const char *, ...) __attribute__((format(printf, 1, 2))); void (__attribute__((format(printf, 1, 2))) *tformatprintf2) (const char *, ...); void (__attribute__((format(printf, 1, 2))) ****tformatprintf3) (const char *, ...); char * (__attribute__((format_arg(1))) *tformat_arg) (const char *); void baz (int i) { (*tformatprintf0) ("%d", i); (*tformatprintf0) ((*tformat_arg) ("%d"), i); (*tformatprintf0) ("%"); // { dg-warning "format" "prefix" } (*tformatprintf0) ((*tformat_arg) ("%")); // { dg-warning "format" "prefix" } (*tformatprintf1) ("%d", i); (*tformatprintf1) ((*tformat_arg) ("%d"), i); (*tformatprintf1) ("%"); // { dg-warning "format" "postfix" } (*tformatprintf1) ((*tformat_arg) ("%")); // { dg-warning "format" "postfix" } (*tformatprintf2) ("%d", i); (*tformatprintf2) ((*tformat_arg) ("%d"), i); (*tformatprintf2) ("%"); // { dg-warning "format" "nested" } (*tformatprintf2) ((*tformat_arg) ("%")); // { dg-warning "format" "nested" } (****tformatprintf3) ("%d", i); (****tformatprintf3) ((*tformat_arg) ("%d"), i); (****tformatprintf3) ("%"); // { dg-warning "format" "nested 2" } (****tformatprintf3) ((*tformat_arg) ("%")); // { dg-warning "format" "nested 2" } }
google
chromium
Wparentheses-16
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-16.C
2,971
utf_8
d87dd62f86bc0dc77c7e9fcdd2d600a9
// { dg-do compile } // { dg-options "-Wparentheses" } // Template version of Wparentheses-7.C. int foo (int); template<class T> void bar (T a, T b, T c) { foo (a + b << c); // { dg-warning "parentheses" "correct warning" } foo ((a + b) << c); foo (a + (b << c)); foo (1 + 2 << c); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) << c); foo (1 + (2 << c)); foo (1 + 2 << 3); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) << 3); foo (1 + (2 << 3)); foo (a << b + c); // { dg-warning "parentheses" "correct warning" } foo ((a << b) + c); foo (a << (b + c)); foo (1 << 2 + c); // { dg-warning "parentheses" "correct warning" } foo ((1 << 2) + c); foo (1 << (2 + c)); foo (1 << 2 + 3); // { dg-warning "parentheses" "correct warning" } foo ((1 << 2) + 3); foo (1 << (2 + 3)); foo (a + b >> c); // { dg-warning "parentheses" "correct warning" } foo ((a + b) >> c); foo (a + (b >> c)); foo (1 + 2 >> c); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) >> c); foo (1 + (2 >> c)); foo (1 + 2 >> 3); // { dg-warning "parentheses" "correct warning" } foo ((1 + 2) >> 3); foo (1 + (2 >> 3)); foo (a >> b + c); // { dg-warning "parentheses" "correct warning" } foo ((a >> b) + c); foo (a >> (b + c)); foo (1 >> 2 + c); // { dg-warning "parentheses" "correct warning" } foo ((1 >> 2) + c); foo (1 >> (2 + c)); foo (1 >> 2 + 3); // { dg-warning "parentheses" "correct warning" } foo ((1 >> 2) + 3); foo (1 >> (2 + 3)); foo (a - b << c); // { dg-warning "parentheses" "correct warning" } foo ((a - b) << c); foo (a - (b << c)); foo (6 - 5 << c); // { dg-warning "parentheses" "correct warning" } foo ((6 - 5) << c); foo (6 - (5 << c)); foo (6 - 5 << 4); // { dg-warning "parentheses" "correct warning" } foo ((6 - 5) << 4); foo (6 - (5 << 4)); foo (a << b - c); // { dg-warning "parentheses" "correct warning" } foo ((a << b) - c); foo (a << (b - c)); foo (6 << 5 - c); // { dg-warning "parentheses" "correct warning" } foo ((6 << 5) - c); foo (6 << (5 - c)); foo (6 << 5 - 4); // { dg-warning "parentheses" "correct warning" } foo ((6 << 5) - 4); foo (6 << (5 - 4)); foo (a - b >> c); // { dg-warning "parentheses" "correct warning" } foo ((a - b) >> c); foo (a - (b >> c)); foo (6 - 5 >> c); // { dg-warning "parentheses" "correct warning" } foo ((6 - 5) >> c); foo (6 - (5 >> c)); foo (6 - 5 >> 4); // { dg-warning "parentheses" "correct warning" } foo ((6 - 5) >> 4); foo (6 - (5 >> 4)); foo (a >> b - c); // { dg-warning "parentheses" "correct warning" } foo ((a >> b) - c); foo (a >> (b - c)); foo (6 >> 5 - c); // { dg-warning "parentheses" "correct warning" } foo ((6 >> 5) - c); foo (6 >> (5 - c)); foo (6 >> 5 - 4); // { dg-warning "parentheses" "correct warning" } foo ((6 >> 5) - 4); foo (6 >> (5 - 4)); } template void bar<int> (int, int, int); // { dg-message "instantiated" }
google
chromium
Wconversion-real-integer
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wconversion-real-integer.C
3,022
utf_8
778d5f6c7ca820866b90899853dc4fa7
/* Test for diagnostics for Wconversion between floating-point and integers. C++ equivalent of gcc/testsuite/gcc.dg/Wconversion-real-integer.c */ /* { dg-do compile } /* { dg-options "-Wconversion" } */ /* { dg-require-effective-target int32plus } */ #include <limits.h> void fsi (signed int x); void fui (unsigned int x); void ffloat (float x); void fdouble (double x); float vfloat; double vdouble; void h (void) { unsigned int ui = 3; int si = 3; unsigned char uc = 3; signed char sc = 3; float f = 3; double d = 3; fsi (3.1f); /* { dg-warning "conversion" } */ si = 3.1f; /* { dg-warning "conversion" } */ fsi (3.1); /* { dg-warning "conversion" } */ si = 3.1; /* { dg-warning "conversion" } */ fsi (d); /* { dg-warning "conversion" } */ si = d; /* { dg-warning "conversion" } */ fui (-1.0); /* { dg-warning "overflow" } */ ui = -1.0; /* { dg-warning "overflow" } */ ffloat (INT_MAX); /* { dg-warning "conversion" } */ vfloat = INT_MAX; /* { dg-warning "conversion" } */ ffloat (16777217); /* { dg-warning "conversion" } */ vfloat = 16777217; /* { dg-warning "conversion" } */ ffloat (si); /* { dg-warning "conversion" } */ vfloat = si; /* { dg-warning "conversion" } */ ffloat (ui); /* { dg-warning "conversion" } */ vfloat = ui; /* { dg-warning "conversion" } */ fsi (3); si = 3; fsi (3.0f); si = 3.0f; fsi (3.0); si = 3.0; fsi (16777217.0f); si = 16777217.0f; fsi ((int) 3.1); si = (int) 3.1; ffloat (3U); vfloat = 3U; ffloat (3); vfloat = 3; ffloat (INT_MIN); vfloat = INT_MIN; ffloat (uc); vfloat = uc; ffloat (sc); vfloat = sc; fdouble (UINT_MAX); vdouble = UINT_MAX; fdouble (ui); vdouble = ui; fdouble (si); vdouble = si; } void fss (signed short x); void fus (unsigned short x); void fsc (signed char x); void fuc (unsigned char x); void h2 (void) { unsigned short int us; short int ss; unsigned char uc; signed char sc; fss (4294967294.0); /* { dg-warning "conversion" } */ ss = 4294967294.0; /* { dg-warning "conversion" } */ fss (-4294967294.0); /* { dg-warning "conversion" } */ ss = -4294967294.0; /* { dg-warning "conversion" } */ fus (4294967294.0); /* { dg-warning "conversion" } */ us = 4294967294.0; /* { dg-warning "conversion" } */ fus (-4294967294.0); /* { dg-warning "conversion" } */ us = -4294967294.0; /* { dg-warning "conversion" } */ fsc (500.0); /* { dg-warning "conversion" } */ sc = 500.0; /* { dg-warning "conversion" } */ fsc (-500.0); /* { dg-warning "conversion" } */ sc = -500.0; /* { dg-warning "conversion" } */ fuc (500.0); /* { dg-warning "conversion" } */ uc = 500.0; /* { dg-warning "conversion" } */ fuc (-500.0); /* { dg-warning "conversion" } */ uc = -500.0; /* { dg-warning "conversion" } */ fss (500.0); ss = 500.0; fss (-500.0); ss = -500.0; fus (500.0); us = 500.0; fus (-500.0); /* { dg-warning "conversion" } */ us = -500.0; /* { dg-warning "conversion" } */ }
google
chromium
Wstrict-aliasing-bogus-escape-2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C
221
utf_8
7d718e1471f9c88db63a362d36027ca2
/* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-aliasing" } */ #include<list> struct A { virtual ~A(); }; A* foo(); void bar(std::list<int> x) { std::list<int> y = x; if (*y.rbegin()) delete foo(); }
google
chromium
incomplete2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/incomplete2.C
225
utf_8
49b98998b847037288aea7d208c298d7
// PR c++/33501 // { dg-do compile } class A; // { dg-error "forward declaration" } int f (A); const A &make (); int main () { return f (make ()); // { dg-error "invalid use of incomplete type|initializing argument" } }
google
chromium
Wstrict-aliasing-bogus-char-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-char-1.C
204
utf_8
d4573ac3640698442e2e693aacce94bb
/* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */ int foo () { int i; char* c= reinterpret_cast<char*>(&i); /* { dg-bogus "char" } */ c[1] = 1; return i; }
google
chromium
sequence-pt-pr17880
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/sequence-pt-pr17880.C
2,561
utf_8
df6eec31c99dfed294a6e4192dd69f3f
// PR 17880 // { dg-do compile } // { dg-options "-Wsequence-point" } int foo (int x) { unsigned int a; int b; b = (a += 5) > a; // { dg-warning "undefined" "sequence point warning" } b = (a += 5) + a == 10; // { dg-warning "undefined" "sequence point warning" } b = (a -= 5) > a; // { dg-warning "undefined" "sequence point warning" } b = (a -= 5) + a == 10; // { dg-warning "undefined" "sequence point warning" } b = a-- > a; // { dg-warning "undefined" "sequence point warning" } b = a-- + a == 10; // { dg-warning "undefined" "sequence point warning" } b = ++a > a; // { dg-warning "undefined" "sequence point warning" } b = ++a + a == 10; // { dg-warning "undefined" "sequence point warning" } if ((a += 5) > a) return -1; // { dg-warning "undefined" "sequence point warning" } if ((a += 5) + a == 10) return -1; // { dg-warning "undefined" "sequence point warning" } if ((a -= 5) > a) return -1; // { dg-warning "undefined" "sequence point warning" } if ((a -= 5) + a == 10) return -1; // { dg-warning "undefined" "sequence point warning" } if (a-- > a) return -1; // { dg-warning "undefined" "sequence point warning" } if (a-- + a == 10) return -1; // { dg-warning "undefined" "sequence point warning" } if (++a > a) return -1; // { dg-warning "undefined" "sequence point warning" } if (++a + a == 10) return -1; // { dg-warning "undefined" "sequence point warning" } do {} while ((a += 5) > a); // { dg-warning "undefined" "sequence point warning" } while ((a += 5) > a); // { dg-warning "undefined" "sequence point warning" } for ((a += 5) > a;;); // { dg-warning "undefined" "sequence point warning" } for (b = (a += 5) > a;;); // { dg-warning "undefined" "sequence point warning" } for (; (a += 5) > a;); // { dg-warning "undefined" "sequence point warning" } for (;; b = (a += 5) > a); // { dg-warning "undefined" "sequence point warning" } for (;; a++ + a++); // { dg-warning "undefined" "sequence point warning" } if (a) a++ - a--; // { dg-warning "undefined" "sequence point warning" } ((a +=5) > a) ? a : b; // { dg-warning "undefined" "sequence point warning" } return (a++ - a--); // { dg-warning "undefined" "sequence point warning" } } void bar (int i) { int a = i++ - i++; // { dg-warning "undefined" "sequence point warning" } } void baz (int i) { switch (i++ + i++) // { dg-warning "undefined" "sequence point warning" } { case 1: i++ - i++; // { dg-warning "undefined" "sequence point warning" } case 2: break; } }
google
chromium
no-write-strings
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/no-write-strings.C
98
utf_8
941aec727045c0f85cb4623dd4ce20f1
// { dg-do compile } // { dg-options -Wno-write-strings } int main() { char* p = "Asgaard"; }
google
chromium
pr26785
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr26785.C
166
utf_8
fb38f2b2dda09170136a0c3ac84bcb3a
// PR 26785 // { dg-do compile } // { dg-options "-fshow-column" } class foo { foo::foo // { dg-error "3:extra qualification" } (int a, int b, int c); };
google
chromium
multiple-overflow-warn-3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/multiple-overflow-warn-3.C
301
utf_8
2979544e46142cf2eb10573c7d884767
/* PR 30465 : Test for duplicated warnings in a conversion. */ /* { dg-do compile } */ /* { dg-options "-Woverflow" } */ short int g (void) { short int wc = ((short int)1 << 31) - 1; /* { dg-bogus "overflow .* overflow" } */ /* { dg-warning "overflow" "" { target *-*-* } 8 } */ return wc; }
google
chromium
Wunused-12
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wunused-12.C
132
utf_8
ed6fbf0a414b22ad6579cf9a3fbe6c2f
// PR c++/24302 // { dg-options "-Wunused" } static union { unsigned char FLT4ARR[4]; float FLT4; }; // { dg-warning "used" }
google
chromium
if-empty-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/if-empty-1.C
484
utf_8
450618a497d9ab1567d9bc1ed188ded4
/* { dg-do compile } */ /* { dg-options "-Wempty-body" } */ void f (int x) { if (x) ; /* { dg-warning "suggest braces around empty body in an" } */ if (x) ; /* By design we don't warn in this case. */ else (void)0; if (x) (void)0; else ; /* { dg-warning "suggest braces around empty body in an" } */ if (x) (void)0; else (void)0; }
google
chromium
pragma-system_header1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pragma-system_header1.C
123
utf_8
4cf78b7f61fb98cbc6e1ef39bf3dc758
// PR c++/30500 // { dg-options "-Wconversion" } #include "pragma-system_header1.h" void f() { g<int>(); h<int>(); }
google
chromium
effc2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/effc2.C
701
utf_8
ea529389c86d5a43c531a82630dfde8b
// { dg-do compile } // { dg-options "-Weffc++" } // Contributed by Benjamin Kosnik <bkoz at redhat dot com> // PR c++/16169 : Improve -Weffc++ rule 15 struct A { const A& foo(); const A& operator=(int) { return foo(); } }; struct B { B& foo(); B& operator=(int) { return foo(); } }; struct C { C& operator=(int) { return *this; } }; struct D { D operator=(int) { return *this; } // { dg-warning "should return a reference" } }; struct E { E& foo(); E operator=(int) { return foo(); } // { dg-warning "should return a reference" } }; struct F { operator float(); float operator=(int) { return *this; } // { dg-warning "should return a reference" } };
google
chromium
vector3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector3.C
128
utf_8
06e44a4208434952189cfd9cd55ae2d8
/* { dg-do compile } */ /* { dg-options "" } */ // PR c++/28302 int __attribute__((vector_size(8))) x; void foo() { ~x; }
google
chromium
attrib15
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib15.C
84
utf_8
39e052366a96099f26b671796340eb37
// PR c++/15317 struct A { A(char); }; A::A(__attribute__((unused)) char i2) {}
google
chromium
has_nothrow_assign_odr
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C
260
utf_8
f6720c770e2fb1754a72d71b0c26db42
// PR c++/36870 // { dg-do "run" } #include <cassert> struct S { const S& operator= (const S&); }; bool f (); int main () { assert (__has_nothrow_assign (S) == f ()); } const S& S::operator= (const S&) { } bool f () { return __has_nothrow_assign (S); }
google
chromium
has_nothrow_copy-3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/has_nothrow_copy-3.C
193
utf_8
c20d3d9a8fa209a83bd3468ab940233e
// PR c++/36871 // { dg-do "run" } #include <cassert> struct F { F (const F&) throw () { } template <class T> F (T) throw () { } }; int main () { assert (__has_nothrow_copy (F)); }
google
chromium
tmplattr3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/tmplattr3.C
942
utf_8
ff67a3df89d9e5bed9e2259c840fd1c3
// PR c++/17743 template<typename T> struct X { typedef char layout_type[sizeof(T)] __attribute ((aligned(__alignof(double)))); layout_type data; }; template<typename T> struct Y { typedef char layout_type[sizeof(T)] __attribute ((aligned(__alignof(T)))); layout_type data; }; template<typename T> struct Z { typedef char layout_type[sizeof(T)] __attribute ((aligned(__alignof(T)))); struct Z2 { layout_type data; } in; }; template<typename T> struct A; template <typename T> struct A<T*> { typedef char layout_type[sizeof(T)] __attribute ((aligned(__alignof(T)))); layout_type data; }; template<bool> struct StaticAssert; template<> struct StaticAssert<true> {}; StaticAssert<__alignof(X<double>) == __alignof(double)> d1; StaticAssert<__alignof(Y<double>) == __alignof(double)> d2; StaticAssert<__alignof(Z<double>) == __alignof(double)> d3; StaticAssert<__alignof(A<double*>) == __alignof(double)> d4;
google
chromium
oper1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/oper1.C
449
utf_8
8f3e3432664712c939fe6dea74deb533
// { dg-do run } // Make sure the GNU extension of accepting dropping cv-qualifiers for // the implicit this argument does not kick in when taking the address // of an object, since this extension would change the meaning of a // well-defined program. struct A { A* operator&() { return 0; } }; int main () { const A a = {}; return (&a == 0); }
google
chromium
array1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/array1.C
159
utf_8
691a47a228a5fa12f281a771f2c53825
// PR c++/13574 // { dg-options "" } class A { public: A() : argc(0), argv() { }; private: int argc; char* argv[]; }; int main() { A y; }
google
chromium
utf32-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/utf32-1.C
947
utf_8
372b29c6fdb5613760a00a19b01a0604
/* Test the support for char32_t character constants. */ /* { dg-do run } */ /* { dg-options "-std=c++0x -Wall -Werror" } */ extern "C" void abort (void); const static char32_t c0 = U'a'; const static char32_t c1 = U'\0'; const static char32_t c2 = U'\u0024'; const static char32_t c3 = U'\u2029'; const static char32_t c4 = U'\U00064321'; #define A 0x00000061 #define D 0x00000024 #define X 0x00002029 #define Y 0x00064321 int main () { if (sizeof (U'a') != sizeof (char32_t)) abort (); if (sizeof (U'\0') != sizeof (char32_t)) abort (); if (sizeof (U'\u0024') != sizeof (char32_t)) abort (); if (sizeof (U'\u2029') != sizeof (char32_t)) abort (); if (sizeof (U'\U00064321') != sizeof (char32_t)) abort (); if (c0 != A) abort (); if (c1 != 0x0000) abort (); if (c2 != D) abort (); if (c3 != X) abort (); if (c4 != Y) abort (); }
google
chromium
dllimport7
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/dllimport7.C
892
utf_8
23d15ef27e094ea705f3ac33ec67560b
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} } // Report errors on definition of dllimport'd static data member . struct Baz { Baz(int a_ =0) : a(a_) {} int a; }; class __declspec(dllimport) Bar { public: enum {one = 1}; static const int two = 2; static const int three; static const Baz null_baz; }; const int Bar::three = 3; // { dg-warning "redeclared without dllimport" } // { dg-error "definition of static data" "C++ specific error" { target i?86-*-cygwin* i?86-*-mingw* } 21 } const Baz Bar::null_baz; // { dg-warning "redeclared without dllimport" } // { dg-error "definition of static data" "C++ specific error" { target i?86-*-cygwin* i?86-*-mingw* } 24 } int foo() { Bar foobar; const int* baz = &Bar::two; int a = foobar.two; int b = foobar.three; int c = foobar.null_baz.a; return (a + b + c + *baz); }
google
chromium
cleanup-6
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/cleanup-6.C
286
utf_8
d9e45b781a97ee5ac71b788011eae52c
/* { dg-do compile } */ /* { dg-options "-O" } */ /* Verify that a cleanup marked "inline" gets inlined. */ static inline void xyzzy(void *p __attribute__((unused))) { } void doit(void) { int x __attribute__((cleanup (xyzzy))); } /* { dg-final { scan-assembler-not "xyzzy" } } */
google
chromium
pragmaweak1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/pragmaweak1.C
138
utf_8
ad117686eb16e680b29f2f5e45ebe0df
// PR c++/25999 // { dg-final { scan-assembler-not "_Z3Foov" } } extern "C" { void Foo(); } #pragma weak Random_Symbol void Foo() { }
google
chromium
case-range2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/case-range2.C
643
utf_8
6d2f84a379ba22c5f6c546f90bbda615
// { dg-do compile } // Tests if case ranges (a GNU extension) correctly emit messages // about overlapping ranges. // { dg-options "" } const int low = -2; const int high = 15; template <typename T> T f2 (T i) { switch (i) { case low ... high : return i + 1; // { dg-error "previously" } case 5 : return i + 2; // { dg-error "duplicate" } default : return 0; } } int f (int i) { switch (i) { case 1 ... 10: return i + 1; // { dg-error "first entry" } case 3 ... 5 : return i + 3; // { dg-error "duplicate" } default: return f2 (i); // { dg-message "instantiated" } } }
google
chromium
vector2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector2.C
334
utf_8
3f2ba0450158ad5c221f98dd0e641cbf
// PR c++/23337; caused an ICE in component_ref_field_offset // { dg-options "" } // { dg-options "-mmmx" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ typedef int vec __attribute__ ((vector_size (8))); extern int bar (vec); int foo (int i) { vec a[] = { (vec) { 0, i }, (vec) { 4, 5 } }; return bar (a[0]) + bar (a[1]); }
google
chromium
altivec-cell-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-cell-1.C
1,476
utf_8
dd9c52efe2c8d9b6297333f40984600a
/* { dg-do compile { target powerpc*-*-* } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-maltivec" } */ /* Basic test for the new VMX intrinsics. */ #include <altivec.h> int f(vector int a, int b) { return vec_extract (a, b); } short f1(vector short a, int b) { return vec_extract (a, b); } vector short f2(vector short a, int b) { return vec_insert (b, a, b); } vector float f3(vector float a, int b) { return vec_insert (b, a, b); } float g(void); vector float f4(float b, int t) { return vec_promote (g(), t); } vector float f5(float b) { return vec_splats (g()); } template <int> int tf(vector int a, int b) { return vec_extract (a, b); } template <int> short tf1(vector short a, int b) { return vec_extract (a, b); } template <int> vector short tf2(vector short a, int b) { return vec_insert (b, a, b); } template <int> vector float tf3(vector float a, int b) { return vec_insert (b, a, b); } template <int> vector float tf4(float b, int t) { return vec_promote (g(), t); } template <int> vector float tf5(float b) { return vec_splats (g()); } int t(vector int a, int b) { return tf<1>(a, b); } short t1(vector short a, int b) { return tf1<1>(a, b); } vector short t2(vector short a, int b) { return tf2<1>(a, b); } vector float t3(vector float a, int b) { return tf3<1>(a, b); } vector float t4(float b, int t) { return tf4<1>(b, t); } vector float t5(float b) { return tf5<1>(b); }
google
chromium
cleanup-4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/cleanup-4.C
573
utf_8
95a700f1b361b8b7247dd036428905d7
/* { dg-do run } */ /* { dg-options "" } */ /* Verify cleanup execution on non-trivial exit from a block. */ extern "C" void exit(int); extern "C" void abort(void); static int counter; static void handler(int *p) { counter += *p; } static void __attribute__((noinline)) bar(void) { } static void doit(int n, int n2) { int i; for (i = 0; i < n; ++i) { int dummy __attribute__((cleanup (handler))) = i; if (i == n2) break; bar(); } } int main() { doit (10, 6); if (counter != 0 + 1 + 2 + 3 + 4 + 5 + 6) abort (); return 0; }
google
chromium
attrib27
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib27.C
167
utf_8
2c1f177fcc72b3e947f945d29d8570e6
//PR c++/29980 struct A { typedef int X; }; // { dg-error "previous declaration" } struct __attribute__((unused)) A::X; // { dg-error "typedef-name" }
google
chromium
altivec-16
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-16.C
378
utf_8
1f347fa1c57370132e750e4fb8b77f9d
// PR c++/36662 // { dg-do compile { target powerpc*-*-* } } // { dg-require-effective-target powerpc_altivec_ok } // { dg-options "-maltivec" } #define vector __attribute__((altivec (vector__))) template <typename c> struct S {}; template <> struct S<vector float> { static vector float zero; }; template <int> void g (void) { vector float t = S<vector float>::zero; }
google
chromium
attrib12
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib12.C
222
utf_8
c460ffd02f4c4ad800649b58a60f30e1
// PR c++/13791 template <typename T> struct O { struct __attribute__((packed)) I { int i; char c; }; I* foo(); }; template <typename T> typename O<T>::I* O<T>::foo() { return 0; } template class O<int>;
google
chromium
is_pod
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/is_pod.C
1,121
utf_8
a7f24c72c3a372a243466cb833a3b8e0
// { dg-do "run" } #include <cassert> struct A { double a; double b; }; struct B { B() { } }; struct C : public A { }; template<typename T> bool f() { return __is_pod(T); } template<typename T> class My { public: bool f() { return !!__is_pod(T); } }; template<typename T> class My2 { public: static const bool trait = __is_pod(T); }; template<typename T> const bool My2<T>::trait; template<typename T, bool b = __is_pod(T)> struct My3_help { static const bool trait = b; }; template<typename T, bool b> const bool My3_help<T, b>::trait; template<typename T> class My3 { public: bool f() { return My3_help<T>::trait; } }; #define PTEST(T) (__is_pod(T) && f<T>() \ && My<T>().f() && My2<T>::trait && My3<T>().f()) #define NTEST(T) (!__is_pod(T) && !f<T>() \ && !My<T>().f() && !My2<T>::trait && !My3<T>().f()) int main() { assert (PTEST (int)); assert (NTEST (void)); assert (PTEST (A)); assert (PTEST (A[])); assert (NTEST (B)); assert (NTEST (C[])); return 0; }
google
chromium
complex4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/complex4.C
199
utf_8
35b7aa6c0d6fc7e40536c9546a810234
// { dg-do compile } // This code used to be rejected as there was no conversion from int to float __complex__ #include <vector> typedef float __complex__ fcomplex; std::vector<fcomplex> vfc(10);
google
chromium
asmspecInvalid
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/asmspecInvalid.C
534
utf_8
81d7f5132402c3b9c67ba05f4d092697
// tests that the asm directive is correctly handled for static fields // in structures and classes. This only applies to C++; such // directives generate errors in C. Assembler directives for local // variables should be tested by the C test suite. // // { dg-do compile } struct Foo { // This should reference a variable called bar int i __asm__("bar"); /* { dg-error "specifiers are not permitted" } */ }; int main (void ) { int j = 0; return j; }
google
chromium
packed8
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/packed8.C
535
utf_8
9cc672b535d8f71fe730d74c00807d76
// PR c++/18378 // NOTE: This test assumes packed structure layout differs from unpacked // structure layout. This isn't true, e.g., with the default // arm-none-elf options. // { dg-options "-mstructure-size-boundary=8" { target arm-*-* } } class A { public: int i; A() {} A(const A& a) { i = a.i; } }; class B { A a __attribute__((packed)); // { dg-warning "attribute ignored" "" { target default_packed } } public: B() {} A GetA() { return a; } // { dg-error "" "" { target { ! default_packed } } } };
google
chromium
align2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/align2.C
251
utf_8
9b72806f0ff8dd6bff6e2ef84f0ce102
// PR c++/10179 struct __attribute((aligned(__alignof(double)))) A { /* empty */ }; struct T : public A { char c; }; template<bool> struct StaticAssert; template<> struct StaticAssert<true> {}; StaticAssert<__alignof(T) == __alignof(double)> d;
google
chromium
altivec-cell-5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-cell-5.C
1,368
utf_8
29cab7a77633102be8f79fea8bd692b1
/* { dg-do compile { target powerpc*-*-* } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-maltivec" } */ /* Basic test for the new VMX intrinsics and error messages. */ #include <altivec.h> int main(int argc, char **argv) { vector float t; vec_promote(); /* { dg-error "vec_promote only accepts 2" } */ vec_promote(1.0f); /* { dg-error "vec_promote only accepts 2" } */ vec_promote(1.0f, 2, 3); /* { dg-error "vec_promote only accepts 2" } */ vec_extract (); /* { dg-error "vec_extract only accepts 2" } */ vec_extract (t); /* { dg-error "vec_extract only accepts 2" } */ vec_extract (t, 2); vec_extract (t, 2, 5, 6); /* { dg-error "vec_extract only accepts 2" } */ vec_splats (); /* { dg-error "vec_splats only accepts 1" } */ vec_splats (t, 3); /* { dg-error "vec_splats only accepts 1" } */ vec_insert (); /* { dg-error "vec_insert only accepts 3" } */ vec_insert (t); /* { dg-error "vec_insert only accepts 3" } */ vec_insert (t, 3); /* { dg-error "vec_insert only accepts 3" } */ vec_insert (t, 3, 2, 4, 6, 6); /* { dg-error "vec_insert only accepts 3" } */ return 0; }
google
chromium
utf-badconcat
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/utf-badconcat.C
921
utf_8
3e8f2dc091110c881df8e144f0891477
/* Test unsupported concatenation of char16_t/char32_t* string literals. */ /* { dg-do compile } */ /* { dg-options "-std=c++0x" } */ const void *s0 = u"a" "b"; const void *s1 = "a" u"b"; const void *s2 = u"a" U"b"; /* { dg-error "non-standard concatenation" } */ const void *s3 = U"a" u"b"; /* { dg-error "non-standard concatenation" } */ const void *s4 = u"a" L"b"; /* { dg-error "non-standard concatenation" } */ const void *s5 = L"a" u"b"; /* { dg-error "non-standard concatenation" } */ const void *s6 = u"a" u"b"; const void *s7 = U"a" "b"; const void *s8 = "a" U"b"; const void *s9 = U"a" L"b"; /* { dg-error "non-standard concatenation" } */ const void *sa = L"a" U"b"; /* { dg-error "non-standard concatenation" } */ const void *sb = U"a" U"b"; const void *sc = L"a" "b"; const void *sd = "a" L"b"; const void *se = L"a" L"b"; int main () {}
google
chromium
altivec-cell-3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-cell-3.C
841
utf_8
141d17972ddb9632037c663fb3999e80
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */ /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-maltivec" } */ /* Test the vec_splats and vec_promote VMX intrinsics. */ #include <altivec.h> extern "C" void abort (void); vector int a = {0, 0, 0, 0}; int main1(int t) __attribute__((noinline)); int main1(int t) { int i; vector int b = vec_splats(0); if (__builtin_memcmp (&a, &b, sizeof(vector int))) abort (); b = vec_splats(t); if (__builtin_memcmp (&a, &b, sizeof(vector int))) abort (); b = vec_promote(0, 1); if (vec_extract (b, 1) != 0) abort (); b = vec_promote(t, t); if (vec_extract (b, t) != 0) abort (); return 0; } int main(void) { return main1 (0); }
google
chromium
has_trivial_destructor-2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C
83
utf_8
a24f991beb2c5296f2e8144630b7bb1a
// PR c++/36855 typedef char assert_0 [__has_trivial_destructor (int&) ? 1 : -1];
google
chromium
has_trivial_constructor
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/has_trivial_constructor.C
1,428
utf_8
cb205a1f764db064e154ba0edc92d4d4
// { dg-do "run" } #include <cassert> struct A { double a; double b; }; union U { double a; double b; }; struct B { B() { } }; struct C : public B { }; struct D : public A { }; struct E { A a; }; struct F { B b; }; template<typename T> bool f() { return __has_trivial_constructor(T); } template<typename T> class My { public: bool f() { return !!__has_trivial_constructor(T); } }; template<typename T> class My2 { public: static const bool trait = __has_trivial_constructor(T); }; template<typename T> const bool My2<T>::trait; template<typename T, bool b = __has_trivial_constructor(T)> struct My3_help { static const bool trait = b; }; template<typename T, bool b> const bool My3_help<T, b>::trait; template<typename T> class My3 { public: bool f() { return My3_help<T>::trait; } }; #define PTEST(T) (__has_trivial_constructor(T) && f<T>() \ && My<T>().f() && My2<T>::trait && My3<T>().f()) #define NTEST(T) (!__has_trivial_constructor(T) && !f<T>() \ && !My<T>().f() && !My2<T>::trait && !My3<T>().f()) int main() { assert (PTEST (int)); assert (NTEST (int (int))); assert (NTEST (void)); assert (PTEST (A)); assert (PTEST (U)); assert (NTEST (B)); assert (PTEST (D)); assert (PTEST (D[])); assert (PTEST (E)); assert (NTEST (F)); return 0; }
google
chromium
no-asm-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/no-asm-1.C
309
utf_8
d8aab6d07f244c4b9f78c15a01c07e27
// { dg-do compile } // { dg-options "" } // Verify that asm and the GNU extension typeof are recognized as // keywords. int asm; // { dg-error "before .asm." } int typeof; // { dg-error "expected" } // { dg-error "multiple types" "" { target *-*-* } 8 } // { dg-error "declaration" "" { target *-*-* } 8 }
google
chromium
interface1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/interface1.C
161
utf_8
3a16bb49d1e751989bc6c5980e68cc41
// PR c++/22252 // { dg-do link } // { dg-additional-sources "interface1a.cc" } // { dg-options "-fno-inline" } #pragma implementation #include "interface1.h"
google
chromium
altivec-types-4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-types-4.C
488
utf_8
0ba4e5317a039c3cdd18f9724f001f46
/* { dg-do compile { target powerpc*-*-linux* } } */ /* { dg-require-effective-target ilp32 } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-maltivec -mno-warn-altivec-long" } */ /* These should not get warnings for 32-bit code when the warning is disabled. */ __vector long vl; __vector unsigned long vul; __vector signed long vsl; __vector __bool long int vbli; __vector long int vli; __vector unsigned long int vuli; __vector signed long int vsli;