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
|
spec32
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec32.C
| 118 |
utf_8
|
f2a0b8ac9757fbcaba8addb591bb1e06
|
//PR c++/28861
struct A
{
template<template<int> class B> struct B<0>; // { dg-error "name of class shadows" }
};
|
google
|
chromium
|
overload1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/overload1.C
| 456 |
utf_8
|
6cba2353f6c7917dd350506e390d9379
|
// { dg-options "-w" }
// PR c++/9420
// Bug: We were instantiating B<int> during overload resolution for E<0.
// This is wrong; the contents of B<int> are not relevant, since we can't
// use its constructors (because we'd already be using a constructor for
// C).
enum { E };
template <typename T> struct A {
static const int a = (E < 0);
};
template <typename T> class B {
A<int> b;
};
struct C {
C(B<int>);
};
int operator<(C, C);
A<int> c;
|
google
|
chromium
|
qualttp12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp12.C
| 348 |
utf_8
|
f5d74cc14dee1391fe409d4d0258396e
|
// { dg-do link }
struct A
{
template <class T> class B {};
};
template <template <class> class TT> void f()
{
TT<int> y;
}
template <class T> struct C
{
void g() { f<T::template B>(); }
};
int main()
{
C<A> c;
c.g();
}
|
google
|
chromium
|
anon4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/anon4.C
| 153 |
utf_8
|
66a2a8fd730ed0d9822656e2f45bc924
|
// PR c++/28407
// A declaration in the anonymous namespace still has external linkage.
template <int *P> class A { };
namespace
{
int i;
}
A<&i> a;
|
google
|
chromium
|
miss-format-5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/miss-format-5.C
| 1,043 |
utf_8
|
e8e1065301c5aeeb1cd383514614b891
|
/* { dg-do compile } */
/* { dg-options "-Wmissing-format-attribute" } */
/* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */
#include <stdarg.h>
typedef void (*noattr_t) (const char *, ...);
typedef noattr_t __attribute__ ((__format__(__printf__, 1, 2))) attr_t;
typedef void (*vnoattr_t) (const char *, va_list);
typedef vnoattr_t __attribute__ ((__format__(__printf__, 1, 0))) vattr_t;
noattr_t
foo1 (noattr_t na, attr_t a, int i)
{
if (i)
return na;
else
return a; /* { dg-warning "candidate" "return type warning" } */
}
attr_t
foo2 (noattr_t na, attr_t a, int i)
{
if (i)
return na;
else
return a;
}
vnoattr_t
foo3 (vnoattr_t vna, vattr_t va, int i)
{
if (i)
return vna;
else
return va; /* { dg-warning "candidate" "return type warning" } */
}
vattr_t
foo4 (vnoattr_t vna, vattr_t va, int i)
{
if (i)
return vna;
else
return va;
}
|
google
|
chromium
|
noeffect4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/noeffect4.C
| 1,664 |
utf_8
|
47abb50388371f2e04be3021b86e14cf
|
// { dg-do compile }
// { dg-options "-Wall" }
// PR 12037.
struct X
{
int operator+(int);
int operator-(int);
int operator*(int);
int operator/(int);
int operator%(int);
int operator>>(int);
int operator<<(int);
int operator&(int);
int operator|(int);
int operator^(int);
int operator&&(int);
int operator||(int);
int operator==(int);
int operator!=(int);
int operator<(int);
int operator<=(int);
int operator>(int);
int operator>=(int);
int operator*();
int operator!();
int operator~();
int operator++();
int operator--();
int operator++(int);
int operator--(int);
int operator()();
int operator,(int);
X *operator->();
operator int () const;
int m;
virtual ~X ();
X &Foo ();
};
struct Y : X
{
};
template<int I> void Foo (X &x)
{
x + I;
x - I;
x * I;
x / I;
x % I;
x >> I;
x << I;
x & I;
x | I;
x && I;
x || I;
x == I;
x != I;
x < I;
x <= I;
x > I;
x >= I;
*x;
!x;
~x;
x++;
x--;
++x;
--x;
x ();
x, I;
x->m;
static_cast<int> (x);
dynamic_cast<Y &> (x);
reinterpret_cast<int> (x.Foo ()); // { dg-error "invalid cast" }
const_cast<X &> (x.Foo ()); // { dg-warning "not used" }
reinterpret_cast<int *> (&x);// { dg-warning "no effect" "" }
const_cast<X &> (x); // { dg-warning "no effect" "" }
sizeof (x++); // { dg-warning "no effect" "" }
__alignof__ (x++); // { dg-warning "no effect" "" }
}
template void Foo<4> (X&); // { dg-message "instantiated" }
|
google
|
chromium
|
Wparentheses-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-2.C
| 734 |
utf_8
|
ea3c2716291fc812b8d00190b207f31b
|
// Test operation of -Wparentheses. Warnings for assignments used as
// truth-values shouldn't apply other than for plain assignment.
// Essentially the same as gcc.dg/Wparentheses-10.c.
// { dg-do compile }
// { dg-options "-Wparentheses" }
int foo (int);
int a, b, c;
bool d;
void
bar (void)
{
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);
}
|
google
|
chromium
|
Wuninitialized-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wuninitialized-2.C
| 1,134 |
utf_8
|
21fc5ac0f1ee255b648d071723254d87
|
/* { dg-do compile } */
/* { dg-options "-O -Wuninitialized" } */
struct S8 { template<typename T> S8(T) { } };
template<typename T> struct S10;
template<typename T> struct S10<T()> { typedef T S12; typedef S8 S1(); };
template<typename T> struct S3 { };
template<typename T> struct S11 { S11(S3<T>); };
struct S2
{
template<typename T> operator S11<T>() { return S11<T>(S5<T>()); }
template<typename T> struct S5:public S3<T>
{
virtual typename S10<T>::S12 S13() {
return 0;
}
};
};
template<typename T> S11<T> S6(S3<T>) { return S11<T>(S3<T>()); }
template<typename S12> struct S7 { typedef S12 S15(); };
struct S4
{
template<typename T> operator S11<T>()
{
struct S14:public S3<T>
{
S14(S2 x):S11_(x) { }
S11<typename S7<typename S10<T>::S12>::S15> S11_;
};
return S6(S14(S11_));
}
S2 S11_;
};
struct S9
{
template<typename F> operator S11<F>() { return S11<F>(S14<F>(S11_)); }
template<typename F> struct S14:public S3<F>
{
S14(S4 x):S11_(x) { }
S11<typename S10<F>::S1> S11_;
};
S4 S11_;
};
void S15(S11<void()>);
void S16() { S9 x; S15(x); }
|
google
|
chromium
|
pr12242
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr12242.C
| 1,443 |
utf_8
|
ce1abb041d2bb27e9f937c6116b0ee0b
|
// PR 12242: should warn about out-of-range int->enum conversions
// { dg-do compile }
// { dg-options "-Wconversion -fpermissive" }
enum X { A };
enum Y { B, C, D };
void example ()
{
int i = 5;
X x;
Y y;
x = 10; // { dg-warning "invalid conversion from .int. to .X." }
// { dg-warning "unspecified" "" { target *-*-* } 13 }
x = 1; // { dg-warning "invalid conversion from .int. to .X." }
x = C; // { dg-error "cannot convert .Y. to .X. in assignment" }
x = D; // { dg-error "cannot convert .Y. to .X. in assignment" }
y = A; // { dg-error "cannot convert .X. to .Y. in assignment" }
x = y; // { dg-error "cannot convert .Y. to .X. in assignment" }
x = i; // { dg-warning "invalid conversion from .int. to .X." }
}
void foo ()
{
X a = static_cast<X> (10); // { dg-warning "unspecified" }
X b = static_cast<X> (0);
X c = static_cast<X> (1);
X d = static_cast<X> (2); // { dg-warning "unspecified" }
X f = static_cast<X> ((int)A);
X g = static_cast<X> (B);
X e = static_cast<X> (D); // { dg-warning "unspecified" }
}
enum QEvent { x = 42 };
int bar()
{
QEvent x = ( QEvent ) 42000; // { dg-warning "unspecified" }
return ( int ) x;
}
enum W {a,b,c};
enum Z {d,e,f,g};
void bazz (int, int, int, int);
void baz() {
int three = 3;
int four = 4;
bazz (
W(three),
W(3),
Z(four),
Z(4) // { dg-warning "unspecified" }
);
}
|
google
|
chromium
|
Wstrict-aliasing-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-1.C
| 161 |
utf_8
|
44dc4b5572b60846a2322e12b0510783
|
/* { dg-do compile } */
/* { dg-options "-Wstrict-aliasing=2 -O2" } */
double x;
int *foo(void)
{
return (int *)&x; /* { dg-warning "strict-aliasing" } */
}
|
google
|
chromium
|
Wparentheses-13
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-13.C
| 1,597 |
utf_8
|
5ec4281a5ed051f3e732c3a823a04787
|
// { dg-do compile }
// { dg-options "-Wparentheses" }
// Template version of Wparentheses-1.C.
int foo (int);
int 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);
}
template void bar<int> (int); // { dg-message "instantiated" }
|
google
|
chromium
|
Wtype-limits
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wtype-limits.C
| 3,287 |
utf_8
|
22df2210e32160eed4b3f51bb9773e8b
|
/* { dg-do compile } */
/* { dg-options "-Wtype-limits" } */
extern void assert (int);
void a (unsigned char x)
{
if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
if (x <= 255) /* { dg-warning "comparison is always true due to limited range of data type" } */
return;
if (255 >= x) /* { dg-warning "comparison is always true due to limited range of data type" } */
return;
if ((int)x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 16 } */
return;
if (255 >= (unsigned char) 1)
return;
}
void b (unsigned short x)
{
if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
}
void c (unsigned int x)
{
if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
if (1U >= 0) return;
if (1U < 0) return;
if (0 <= 1U) return;
if (0 > 1U) return;
}
void d (unsigned long x)
{
if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
}
void e (unsigned long long x)
{
if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
}
int test (int x)
{
if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 61 } */
return 1;
else
return 0;
}
template <typename Int, Int D>
void f(Int x) {
assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
}
int ff(void) {
f<unsigned char, 2>(5);
f<signed char, 2>(5);
}
template <typename Int, Int D>
void g(void) {
assert(0 <= D);
}
int gg(void) {
g<unsigned char, 2>();
}
|
google
|
chromium
|
Wunused-10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wunused-10.C
| 142 |
utf_8
|
09723811a7331dcc7580068bdfe05710
|
// PR c++/19190
// { dg-options "-Wunused" }
struct breakme
{
void setAction( unsigned char a ) { act = a; }
unsigned int act:8;
};
|
google
|
chromium
|
deprecated-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/deprecated-3.C
| 307 |
utf_8
|
2fc2da2424134931e2b72759c1c0e59d
|
/* PR 17947 bad warning with implicit conversion and __attribute__((deprecated)) */
/* { dg-do compile } */
/* { dg-options "" } */
struct Foo
{
operator int() __attribute__((deprecated));
};
void g(void)
{
Foo f;
(int)f; // { dg-warning "'Foo::operator int\\(\\)' is deprecated \\(declared at" }
}
|
google
|
chromium
|
deprecated-4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/deprecated-4.C
| 159 |
utf_8
|
98c2c2dc0644115f45902f826dc56a04
|
// PR c++/15269
struct B {
virtual int foo() __attribute__((deprecated));
};
int main(void) {
((B*)0)->foo(); // { dg-warning "deprecated" }
}
|
google
|
chromium
|
ctor-init-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/ctor-init-1.C
| 148 |
utf_8
|
85dc72a0303b57c698ce2804c195f5b0
|
// PR c++/11554
// { dg-options "-Wall" }
struct Y {
Y ();
int i1, i2; // { dg-warning "" }
};
Y::Y () : i2(0), i1(0) {} // { dg-warning "" }
|
google
|
chromium
|
register-var-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/register-var-1.C
| 296 |
utf_8
|
91dd53b7d7d2954e6728c3851a3a75e9
|
/* PR/18160 */
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* This should yield an error even without -pedantic. */
/* { dg-options "-ansi" } */
void g(int *);
void f(void)
{
register int x __asm ("eax");
g(&x); /* { dg-error "address of explicit register variable" } */
}
|
google
|
chromium
|
Wstrict-aliasing-6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-6.C
| 166 |
utf_8
|
c92cdb0aebb5d139da6039eb73219857
|
/* { dg-do compile } */
/* { dg-options "-Wstrict-aliasing=2 -O2" } */
int foo ()
{
char buf[8];
return *((int *)buf); /* { dg-warning "strict-aliasing" } */
}
|
google
|
chromium
|
deprecated
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/deprecated.C
| 3,818 |
utf_8
|
966c33cf349322b3b99faf7895c5cca3
|
/* Test __attribute__ ((deprecated)) */
/* { dg-do compile } */
/* { dg-options "-Wdeprecated-declarations -fmessage-length=0" } */
#if 1
typedef int INT1 __attribute__((deprecated));
typedef INT1 INT2 __attribute__ ((__deprecated__));
typedef INT1 INT1a; /* { dg-warning "'INT1' is deprecated" "" } */
typedef INT1 INT1b __attribute__ ((deprecated));
INT1 should_be_unavailable; /* { dg-warning "'INT1' is deprecated" "" } */
INT1a should_not_be_deprecated;
INT1 f1(void) __attribute__ ((deprecated));
INT1 f2(void) { return 0; } /* { dg-warning "'INT1' is deprecated" "" } */
INT2 f3(void) __attribute__ ((__deprecated__));
INT2 f4(void) { return 0; } /* { dg-warning "'INT2' is deprecated" "" } */
int f5(INT2 x); /* { dg-warning "'INT2' is deprecated" "" } */
int f6(INT2 x) __attribute__ ((__deprecated__));
typedef enum Color {red, green, blue} Color __attribute__((deprecated));
int g1;
int g2 __attribute__ ((deprecated));
int g3 __attribute__ ((__deprecated__));
Color k; /* { dg-warning "'Color' is deprecated" "" } */
typedef struct {
int field1;
int field2 __attribute__ ((deprecated));
int field3;
int field4 __attribute__ ((__deprecated__));
union {
int field5;
int field6 __attribute__ ((deprecated));
} u1;
int field7:1;
int field8:1 __attribute__ ((deprecated));
union {
int field9;
int field10;
} u2 __attribute__ ((deprecated));
} S1;
int func1()
{
INT1 w; /* { dg-warning "'INT1' is deprecated" "" } */
int x __attribute__ ((deprecated));
int y __attribute__ ((__deprecated__));
int z;
int (*pf)() = f1; /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "" } */
z = w + x + y + g1 + g2 + g3; /* { dg-warning "'x' is deprecated" "" } */
/* { dg-warning "'y' is deprecated" "y" { target *-*-* } 55 } */
/* { dg-warning "'g2' is deprecated" "g2" { target *-*-* } 55 } */
/* { dg-warning "'g3' is deprecated" "g3" { target *-*-* } 55 } */
return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "f1" } */
}
int func2(S1 *p)
{
S1 lp;
if (p->field1)
return p->field2; /* { dg-warning "'S1::field2' is deprecated" "" } */
else if (lp.field4) /* { dg-warning "'S1::field4' is deprecated" "" } */
return p->field3;
p->u1.field5 = g1 + p->field7;
p->u2.field9; /* { dg-warning "'S1::u2' is deprecated" "" } */
return p->u1.field6 + p->field8; /* { dg-warning "'S1::<anonymous union>::field6' is deprecated" "" } */
/* { dg-warning "'S1::field8' is deprecated" "field8" { target *-*-* } 73 } */
}
struct SS1 {
int x;
INT1 y; /* { dg-warning "'INT1' is deprecated" "" } */
} __attribute__ ((deprecated));
struct SS1 *p1; /* { dg-warning "'SS1' is deprecated" "" } */
struct __attribute__ ((__deprecated__)) SS2 {
int x;
INT1 y; /* { dg-warning "'INT1' is deprecated" "" } */
};
struct SS2 *p2; /* { dg-warning "'SS2' is deprecated" "" } */
#endif
#ifdef __cplusplus
class T {
public:
void member1(int) __attribute__ ((deprecated));
void member2(INT1) __attribute__ ((__deprecated__)); /* { dg-warning "'INT1' is deprecated" "" } */
int member3(T *);
int x;
} __attribute__ ((deprecated));
T *p3; // { dg-warning "'T' is deprecated" }
inline void T::member1(int) {}
int T::member3(T *p) // { dg-warning "'T' is deprecated" }
{
p->member1(1); /* { dg-warning "'void T::member1\\(int\\)' is deprecated" "" } */
(*p).member1(2); /* { dg-warning "'void T::member1\\(int\\)' is deprecated" "" } */
p->member2(1); /* { dg-warning "'void T::member2\\(INT1\\)' is deprecated" "" } */
(*p).member2(2); /* { dg-warning "'void T::member2\\(INT1\\)' is deprecated" "" } */
p->member3(p);
(*p).member3(p);
return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "" } */
}
#endif
|
google
|
chromium
|
ctor1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/ctor1.C
| 165 |
utf_8
|
450b64494a8df8181368be08d23e5bf9
|
// PR c++/35734
// { dg-options "-W" }
struct A
{
A();
template<typename T> A(const T&);
};
struct B : A
{
B(const B&) {} // { dg-warning "base class" }
};
|
google
|
chromium
|
Wchar-subscripts
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wchar-subscripts.C
| 228 |
utf_8
|
405a43ec2fe3003f95668d54092d08b1
|
// { dg-do compile }
// { dg-options "-Wchar-subscripts" }
int main()
{
int ary[256] = { 0 };
return ary['a'];
}
|
google
|
chromium
|
conv4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/conv4.C
| 251 |
utf_8
|
e668b1c05f8d62f23aa769b40e21b385
|
// { dg-do compile }
// This file should compile cleanly by default and not warn on the conversions.
int func1(int i)
{
return i;
}
int main()
{
float f;
long l;
unsigned long ul;
f = 1.5f;
l = f;
ul = -1;
func1(f);
return 0;
}
|
google
|
chromium
|
Wreturn-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wreturn-1.C
| 171 |
utf_8
|
39d7f3f2b6a28c609038dedf0f24d03c
|
// { dg-options "-Wreturn-type" }
// PR c++/15742
extern void exit(int) __attribute__ ((noreturn));
template<typename T>
struct A {
int find_cmp(void) { exit(1); }
};
|
google
|
chromium
|
unused-result1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/unused-result1.C
| 246 |
utf_8
|
c3c7b4b0c968cb9b44b95aca9b7f230c
|
// PR c++/27371
class QByteArray {
public:
QByteArray(const QByteArray &);
};
class QString {
QByteArray toLocal8Bit() const __attribute__ ((warn_unused_result));
void fooWarnHere() const { toLocal8Bit(); } // { dg-warning "ignoring" }
};
|
google
|
chromium
|
Wtype-limits-Wextra
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
| 3,334 |
utf_8
|
633c61179699c1cca2e51dfaf2b48aa2
|
/* Test that -Wtype-limits is enabled by -Wextra. */
/* { dg-do compile } */
/* { dg-options "-Wextra" } */
extern void assert (int);
void a (unsigned char x)
{
if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
if (x <= 255) /* { dg-warning "comparison is always true due to limited range of data type" } */
return;
if (255 >= x) /* { dg-warning "comparison is always true due to limited range of data type" } */
return;
if ((int)x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 16 } */
return;
if (255 >= (unsigned char) 1)
return;
}
void b (unsigned short x)
{
if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
}
void c (unsigned int x)
{
if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
if (1U >= 0) return;
if (1U < 0) return;
if (0 <= 1U) return;
if (0 > 1U) return;
}
void d (unsigned long x)
{
if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
}
void e (unsigned long long x)
{
if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
}
int test (int x)
{
if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 61 } */
return 1;
else
return 0;
}
template <typename Int, Int D>
void f(Int x) {
assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
}
int ff(void) {
f<unsigned char, 2>(5);
f<signed char, 2>(5);
}
template <typename Int, Int D>
void g(void) {
assert(0 <= D);
}
int gg(void) {
g<unsigned char, 2>();
}
|
google
|
chromium
|
implicit-typename2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/implicit-typename2.C
| 246 |
utf_8
|
f69540cf16bb392d5bf1e5edfc8e067e
|
// { dg-do compile }
// PR c++/11039: Implicit typename warning in friend class declaration.
template <typename T> struct X {
struct Y {
struct Z {};
};
friend struct Y::Z;
};
|
google
|
chromium
|
miss-format-6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/miss-format-6.C
| 952 |
utf_8
|
aa07b1519cde34fc8f8e23f6aa2bb1ab
|
/* { dg-do compile } */
/* { dg-options "-Wmissing-format-attribute" } */
/* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */
#include <stdarg.h>
typedef void (*noattr_t) (const char *, ...);
typedef noattr_t __attribute__ ((__format__(__printf__, 1, 2))) attr_t;
typedef void (*vnoattr_t) (const char *, va_list);
typedef vnoattr_t __attribute__ ((__format__(__printf__, 1, 0))) vattr_t;
extern void foo1 (noattr_t);
extern void foo2 (attr_t);
extern void foo3 (vnoattr_t);
extern void foo4 (vattr_t);
void
foo (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va)
{
foo1 (na);
foo1 (a); /* { dg-warning "candidate" "parameter passing warning" } */
foo2 (na);
foo2 (a);
foo3 (vna);
foo3 (va); /* { dg-warning "candidate" "parameter passing warning" } */
foo4 (vna);
foo4 (va);
}
|
google
|
chromium
|
noreturn-4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/noreturn-4.C
| 196 |
utf_8
|
779a5460d67225b277c3918f1550c055
|
// PR c++/30988
// { dg-do compile }
// { dg-options "-O2 -Wall" }
void f (const char *) __attribute__ ((noreturn));
template <typename T> struct A
{
int g ()
{
f (__FUNCTION__);
}
};
|
google
|
chromium
|
Wstrict-aliasing-bogus-union
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union.C
| 241 |
utf_8
|
81024e5e796ea1637204d6a421f3c1bb
|
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */
union U {
int i;
float f;
};
float foo () {
union U u;
float* f = &u.f; /* { dg-bogus "unions are holy in GCC" } */
u.i = 2;
return *f;
}
|
google
|
chromium
|
main-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/main-3.C
| 130 |
utf_8
|
43a7ad018e2ced981acc916d2df8f96b
|
// PR c++/29735
// { dg-do compile }
int __attribute__ ((vector_size (8))) main () // { dg-error "must return" }
{
return 0;
}
|
google
|
chromium
|
Wshadow-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wshadow-2.C
| 166 |
utf_8
|
6a6527871d476c4275232fa53d041994
|
/* { dg-options "-Wshadow" } */
struct A {
void a1 () {
struct B { B() {} }; // There should be no warning here.
}
void a2 () {
struct B { };
}
};
|
google
|
chromium
|
Wbraces1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wbraces1.C
| 105 |
utf_8
|
d489a76c7b7ab5b0e165f2342a4e6974
|
// PR c++/19755
// { dg-options "-Wmissing-braces" }
int a[2][2] = { 0, 1 , 2, 3 }; // { dg-warning "" }
|
google
|
chromium
|
Wstrict-aliasing-bogus-escape
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape.C
| 330 |
utf_8
|
fd3e58149ce1fbe517a6bbeb205ae2d9
|
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-aliasing" } */
#include <string>
#include <list>
class A;
class B {
public:
void foo(A&);
std::string s;
};
class A {
public:
A& qaz() {
l.push_back( new A() );
return *l.back();
}
std::list<A*> l;
};
void bar()
{
A a;
B b;
b.foo(a.qaz());
}
|
google
|
chromium
|
format3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/format3.C
| 209 |
utf_8
|
449301e4fc095134d15ba50f081d6eb2
|
// PR c++/13070
// { dg-do compile }
// { dg-options "-Wformat" }
extern "C" int printf (const char*, ...);
int main()
{
printf("%d\n", 1, 1); // { dg-warning "too many" "printf warning" }
return 0;
}
|
google
|
chromium
|
noreturn-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/noreturn-1.C
| 835 |
utf_8
|
acf9323dc369473d47e1a02ca5461933
|
// Test that noreturn attributes are properly set.
// { dg-do compile }
// { dg-options "-Wall -O2" }
#include <cstdlib>
int foo1 (int i)
{
switch (i)
{
case 1:
case 2:
return i;
}
abort();
}
int foo2 (int i)
{
switch (i)
{
case 1:
case 2:
return i;
}
std::abort();
}
int foo3 (int i)
{
switch (i)
{
case 1:
case 2:
return i;
}
exit(1);
}
int foo4 (int i)
{
switch (i)
{
case 1:
case 2:
return i;
}
std::exit(1);
}
void __attribute__ ((__noreturn__)) foo5 ()
{
abort();
}
void __attribute__ ((__noreturn__)) foo6 ()
{
std::abort();
}
void __attribute__ ((__noreturn__)) foo7 ()
{
exit(1);
}
void __attribute__ ((__noreturn__)) foo8 ()
{
std::exit(1);
}
|
google
|
chromium
|
forward-inner
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/forward-inner.C
| 2,238 |
utf_8
|
1f0476e3269f2970342394b1b77e8639
|
// Check that the compiler warns about inner-style forward declarations in
// contexts where they're not actually illegal, but merely useless.
// Verify warnings for and within classes, and by extension, struct and union.
class C1;
class C1::C2; // { dg-error "does not name a type" }
class C1::C2::C3; // { dg-error "has not been declared" }
class C1 {
public:
class C2;
class C2::C3; // { dg-error "does not name a type" }
class C2 {
public:
class C3;
class C3 { };
class C3;
};
class C2;
class C2::C3; // { dg-warning "declaration 'class C1::C2::C3' does not declare anything" }
};
class C1;
class C1::C2; // { dg-warning "declaration 'class C1::C2' does not declare anything" }
class C1::C2::C3; // { dg-warning "declaration 'class C1::C2::C3' does not declare anything" }
// Verify warnings for namespace scopes.
class N1::C4; // { dg-error "has not been declared" }
class N1::N2::C5; // { dg-error "has not been declared" }
namespace N1 {
class C4;
class C4 { };
class C4;
class N2::C5; // { dg-error "has not been declared" }
namespace N2 {
class C5;
class C5 { };
class C5;
}
class N2::C5; // { dg-warning "declaration 'class N1::N2::C5' does not declare anything" }
}
class N1::C4; // { dg-warning "declaration 'class N1::C4' does not declare anything" }
class N1::N2::C5; // { dg-warning "declaration 'class N1::N2::C5' does not declare anything" }
// Verify that using declarations related to namespaces don't generate a
// warning.
using namespace N1;
using namespace N1::N2;
namespace N3 {
using N1::C4; // Valid using declaration, no warning
using N1::N2::C5; // Valid using declaration, no warning
}
// Verify that explicit template instantiations, easy to confuse with
// forward declarations, don't generate a warning.
template<class C>
class TC6 {
public:
class TC7 { };
};
template class TC6<int>::TC7; // Valid explicit instantiation, no warning
// Verify that friend declarations, also easy to confuse with forward
// declrations, are similarly not warned about.
class C8 {
public:
class C9 { };
};
class C10 {
public:
friend class C8::C9; // Valid friend declaration, no warning
};
|
google
|
chromium
|
Winline-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Winline-3.C
| 114 |
utf_8
|
e5e6d08567eb0a03fffadca1da754cde
|
// { dg-options "-Winline -O" }
#include <vector>
using namespace std;
int main(void)
{
vector<int> v(10);
}
|
google
|
chromium
|
Wparentheses-7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-7.C
| 2,882 |
utf_8
|
6123d47b0c90e76bcd5c6a33cbd024bd
|
// { dg-do compile }
// { dg-options "-Wparentheses" }
// C++ copy of gcc.dg/Wparentheses-4.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 (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));
}
|
google
|
chromium
|
Wuninitialized-5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wuninitialized-5.C
| 349 |
utf_8
|
b57532e54618b9d07b92a66d0300d597
|
// PR middle-end/39666
// { dg-do compile }
// { dg-options "-O2 -Wuninitialized" }
int
foo (int i)
{
int j; // { dg-warning "may be used uninitialized" }
switch (i)
{
case -__INT_MAX__ - 1 ... -1:
j = 6;
break;
case 0:
j = 5;
break;
case 2 ... __INT_MAX__:
j = 4;
break;
}
return j;
}
|
google
|
chromium
|
Winline-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Winline-1.C
| 139 |
utf_8
|
99a0635e430cefd28c2908b5aaf4a487
|
// { dg-options "-Winline -O2" }
static inline int foo(int x);
int main()
{
return(foo(17));
}
inline int foo(int x) { return(x); }
|
google
|
chromium
|
Wextra-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wextra-1.C
| 421 |
utf_8
|
d267dddcbfdc3e1208a643c82d1c0886
|
// { dg-options "-Wextra" }
struct T {
// If the implicitly-declared default constructor for "T" is
// required, an error will be issued because "i" cannot be
// initialized. And, this class is not an aggregate, so it cannot
// be brace-initialized. Thus, there is no way to create an object
// of this class. We issue a warning with -Wextra.
const int i; // { dg-warning "const" }
private:
int j;
};
|
google
|
chromium
|
ctor-dtor-privacy-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-1.C
| 180 |
utf_8
|
d5fcd483303360915cb089b93fa1cd74
|
// { dg-options "-Wctor-dtor-privacy" }
struct C { // { dg-warning "" }
static bool result;
private:
static bool check();
};
bool C::result = check();
|
google
|
chromium
|
Wvla-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wvla-2.C
| 171 |
utf_8
|
5efc219075389443353d3000bb084e7f
|
/* { dg-do compile } */
/* { dg-options "-pedantic-errors -Wvla" } */
void func (int i)
{
int array[i]; /* { dg-error "ISO C.* forbids variable.* array 'array'" } */
}
|
google
|
chromium
|
return-reference2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/return-reference2.C
| 208 |
utf_8
|
4c118508219f3e8fd47de507e2333e9c
|
// PR c++/26671
class A
{
public:
int first;
int second;
};
int &f()
{
A a; // { dg-warning "local" }
return a.second;
}
int &g()
{
int ar[42]; // { dg-warning "local" }
return ar[20];
}
|
google
|
chromium
|
overflow-warn-5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/overflow-warn-5.C
| 204 |
utf_8
|
5e58c6b8aa194d77a49a2b3f377f2bdd
|
/* PR c/27273 */
/* { dg-do compile } */
/* { dg-options "-Woverflow" } */
unsigned char rx_async(unsigned char p) {
return p & 512; /* { dg-warning "overflow in implicit constant conversion" } */
}
|
google
|
chromium
|
miss-format-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/miss-format-2.C
| 465 |
utf_8
|
16abc69e85d22f8f70a63462a1b1b3a7
|
/* Test for warnings for missing format attributes. Don't warn if no
/* { dg-do compile } */
/* { dg-options "-Wmissing-format-attribute" } */
#include <stdio.h>
#include <stdarg.h>
void
foo (int i, ...)
{
va_list ap;
va_start (ap, i);
vprintf ("Foo %s bar %s", ap); /* { dg-bogus "candidate" "bogus printf attribute warning" } */
va_end (ap);
}
|
google
|
chromium
|
Wreturn-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wreturn-3.C
| 234 |
utf_8
|
d0e225992bc2f0e5e2e51d846e21a8b4
|
// { dg-options "-Wreturn-type" }
// PR c++/20624
struct fpos {
fpos(int __pos) {}
};
struct g {
g();
~g();
};
fpos seekoff(int b, int c)
{
g __buf;
if (b != -1 && c >= 0)
return fpos(-1);
else
return fpos(-1);
}
|
google
|
chromium
|
Wconversion-pr34389
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wconversion-pr34389.C
| 1,074 |
utf_8
|
2c4607ce27b629a3ea583bebe9da3a48
|
/* PR 34389 */
/* { dg-do compile } */
/* { dg-options "-Wconversion -Wsign-conversion" } */
/* { dg-require-effective-target int32plus } */
short mask1(short x)
{
short y = 0x7fff;
return x & y; /* { dg-bogus "conversion" "bogus warning" } */
}
short mask2(short ssx)
{
short ssy;
short ssz;
ssz = ((int)ssx) & 0x7fff;
ssy = ((int)ssx) | 0x7fff;
ssz = ((int)ssx) ^ 0x7fff;
return ssx & 0x7fff;
}
short mask3(int si, unsigned int ui)
{
short ss;
unsigned short us;
ss = si & 0x7fff;
ss = si & 0xAAAA; /* { dg-warning "conversion" } */
ss = ui & 0x7fff;
ss = ui & 0xAAAA; /* { dg-warning "conversion" } */
us = si & 0x7fff;
us = si & 0xAAAA; /* { dg-warning "conversion" } */
us = ui & 0x7fff;
us = ui & 0xAAAA; /* 0xAAAA is zero-extended, thus it masks the
upper bits of 'ui' making it fit in 'us'. */
return ss;
}
short mask4(int x, int y)
{
return x & y; /* { dg-warning "conversion" } */
}
short mask5(int x)
{
return x & -1; /* { dg-warning "conversion" } */
}
short mask6(short x)
{
return x & -1;
}
|
google
|
chromium
|
conversion-function-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/conversion-function-1.C
| 183 |
utf_8
|
a13aaa30037789e1fbc1e83bdcbaff93
|
// { dg-options "-Wno-conversion" }
struct A {
operator A&();
};
|
google
|
chromium
|
Wreturn-type-4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wreturn-type-4.C
| 1,146 |
utf_8
|
c67eecc224709de2dbabbe0dfa18cef4
|
/* PR c++/18313 */
/* { dg-do compile } */
/* { dg-options "-Wignored-qualifiers" } */
volatile void bar(); /* { dg-warning "type qualifiers ignored" } */
struct A
{
const int bla(); /* { dg-warning "type qualifiers ignored" } */
static const A getA(); /* { dg-bogus "type qualifiers" } */
};
template<typename T> const T getfoo(const T def) /* { dg-bogus "type qualifiers ignored" } */
{ return def; }
template<typename T> class Pair
{
public:
T getLeft() const { return T(); } /* { dg-bogus "type qualifiers ignored" } */
const T getRight() const { return T(); } /* { dg-bogus "type qualifiers ignored" } */
};
template <typename T> struct S {
const int f(); /* { dg-warning "type qualifiers ignored" } */
const T g(); /* { dg-bogus "type qualifiers ignored" } */
T h();
};
int* testtemplate()
{
int i;
Pair<const int> a;
a.getLeft();
a.getRight();
S<bool> b;
b.h(); /* { dg-bogus "type qualifiers ignored" } */
b.g(); /* { dg-bogus "type qualifiers ignored" } */
return getfoo<int*>(&i);
}
|
google
|
chromium
|
sentinel
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/sentinel.C
| 348 |
utf_8
|
5e583edd642b46c07735de366c4d0f59
|
/* { dg-do compile } */
/* { dg-options "-Wall" } */
extern void ex (int i, ...) __attribute__ ((__sentinel__(0)));
void f()
{
ex (1, 0); /* { dg-warning "missing sentinel in function call" "" } */
ex (1, 0L); /* { dg-warning "missing sentinel in function call" "" } */
ex (1, (void *)0);
ex (1, __null); /* { dg-bogus "sentinel" } */
}
|
google
|
chromium
|
Wparentheses-12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-12.C
| 812 |
utf_8
|
c35ecaecfd511c9ca7d99d1d0c295518
|
// { dg-do compile }
// { dg-options "-Wparentheses" }
// C++ version of gcc.dg/Wparentheses-9.c
int foo (int);
int a, b, c;
int
bar (void)
{
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);
}
}
|
google
|
chromium
|
main-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/main-2.C
| 295 |
utf_8
|
c10ffa59cbc975e37cf002ed2e59ae32
|
// { dg-do compile }
// Make sure that the type of f1 does not change
// after the error of main about not returning
// int.
// PR c++/23229
void f1();
void
main() /* { dg-error "must return" } */
{
f1();
}
void f1()
{
}
|
google
|
chromium
|
weak1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/weak1.C
| 412 |
utf_8
|
ba589737ac3b06a0d9c482001bbcf422
|
// { dg-do run }
// { dg-require-weak "" }
// The PA HP-UX dynamic loader doesn't support unsatisfied weak symbols.
// { dg-skip-if "No unsat" { hppa*-*-hpux* } { "*" } { "" } }
// The darwin loader does, but they do need to exist at link time.
// { dg-skip-if "No link unsat" { *-*-darwin* } { "*" } { "" } }
extern void foo (void) __attribute__ ((weak));
int
main ()
{
if (&foo)
foo ();
return 0;
}
|
google
|
chromium
|
pr34985
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr34985.C
| 275 |
utf_8
|
78c676c6637b4d7cf784aaf33aaa6b18
|
/* PR34985: Warning "defined but not used" despite __attribute__((__used__)) */
/* { dg-do compile } */
/* { dg-options "-Wall -Wextra -O2" } */
static void xxyyzz (void);
static void __attribute__((__used__)) xxyyzz(void)
{
}
/* { dg-final { scan-assembler "xxyyzz" } } */
|
google
|
chromium
|
Wvla-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wvla-1.C
| 153 |
utf_8
|
88cbfbefd99299b6c8b18623d110b670
|
/* { dg-do compile } */
/* { dg-options "-Wvla" } */
void func (int i)
{
int array[i]; /* { dg-warning "variable length array 'array' is used" } */
}
|
google
|
chromium
|
Wparentheses-6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-6.C
| 2,202 |
utf_8
|
707ccbf6767343299198f33f687b6ec0
|
// { dg-do compile }
// { dg-options "-Wparentheses" }
// C++ version of gcc.dg/Wparentheses-2.c.
int foo (int);
int
bar (int a, int b, int c)
{
foo (a <= b <= c); // { dg-warning "comparison" "correct warning" }
foo ((a <= b) <= c);
foo (a <= (b <= c));
foo (1 <= 2 <= c); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) <= c);
foo (1 <= (2 <= c));
foo (1 <= 2 <= 3); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) <= 3);
foo (1 <= (2 <= 3));
foo (a > b > c); // { dg-warning "comparison" "correct warning" }
foo ((a > b) > c);
foo (a > (b > c));
foo (1 > 2 > c); // { dg-warning "comparison" "correct warning" }
foo ((1 > 2) > c);
foo (1 > (2 > c));
foo (1 > 2 > 3); // { dg-warning "comparison" "correct warning" }
foo ((1 > 2) > 3);
foo (1 > (2 > 3));
foo (a < b <= c); // { dg-warning "comparison" "correct warning" }
foo ((a < b) <= c);
foo (a < (b <= c));
foo (1 < 2 <= c); // { dg-warning "comparison" "correct warning" }
foo ((1 < 2) <= c);
foo (1 < (2 <= c));
foo (1 < 2 <= 3); // { dg-warning "comparison" "correct warning" }
foo ((1 < 2) <= 3);
foo (1 < (2 <= 3));
foo (a <= b > c); // { dg-warning "comparison" "correct warning" }
foo ((a <= b) > c);
foo (a <= (b > c));
foo (1 <= 2 > c); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) > c);
foo (1 <= (2 > c));
foo (1 <= 2 > 3); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) > 3);
foo (1 <= (2 > 3));
foo (a <= b == c); // { dg-warning "comparison" "correct warning" }
foo ((a <= b) == c);
foo (a <= (b == c));
foo (1 <= 2 == c); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) == c);
foo (1 <= (2 == c));
foo (1 <= 2 == 3); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) == 3);
foo (1 <= (2 == 3));
foo (a != b != c); // { dg-warning "comparison" "correct warning" }
foo ((a != b) != c);
foo (a != (b != c));
foo (1 != 2 != c); // { dg-warning "comparison" "correct warning" }
foo ((1 != 2) != c);
foo (1 != (2 != c));
foo (1 != 2 != 3); // { dg-warning "comparison" "correct warning" }
foo ((1 != 2) != 3);
foo (1 != (2 != 3));
}
|
google
|
chromium
|
Walways-true-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Walways-true-2.C
| 1,273 |
utf_8
|
72a7c932ad74d7d7a693d30ccd2d397c
|
// Make sure we don't assume that a weak symbol is always non-NULL.
// This is just like Walways-true-1.C, except that it uses a weak
// symbol.
// { dg-do compile}
// { dg-options "-Waddress" }
// { dg-require-weak "" }
extern int foo (int) __attribute__ ((weak));
int i __attribute__ ((weak));
void
bar (int a)
{
lab:
if (foo)
foo (0);
if (foo (1))
;
if (&i)
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)
foo (7);
if (foo (1) == 0)
foo (8);
if (&i == 0)
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)
foo (14);
if (0 == foo (1))
foo (15);
if (0 == &i)
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
|
Wunused-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wunused-3.C
| 158 |
utf_8
|
19f1d5b223a75e9107f8207c10aa080c
|
// { dg-do compile }
// { dg-options "-Wunused -O" }
void do_cleanups();
class Cleanup {
public:
~Cleanup() { do_cleanups();}
};
static Cleanup dummy;
|
google
|
chromium
|
inline1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/inline1.C
| 548 |
utf_8
|
0c33b46fd2f31938e2ff6fb7fc3f0b90
|
// { dg-do compile }
// PR 4803. Used inline functions must have a definition.
inline void Foo1 (); // { dg-warning "inline function" "" }
inline void Bar1 ();
template <typename T> inline void Foo2(T); // { dg-warning "inline function" "" }
template <typename T> inline void Bar2(T);
void Baz ()
{
Foo1 ();
Foo2 (1);
Bar1 ();
Bar2 (1);
}
inline void Bar1 () {}
template <typename T> inline void Bar2(T) {}
|
google
|
chromium
|
Wparentheses-10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-10.C
| 4,181 |
utf_8
|
8c1be4fe2c44958f9fdf70a20cd94fbe
|
// { dg-do compile }
// { dg-options "-Wparentheses" }
// C++ version of gcc.dg/Wparentheses-7.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));
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
|
inline2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/inline2.C
| 245 |
utf_8
|
7c84293b9be13f3fdd30d3803765a5c4
|
// PR c++/21627
template<typename T>
struct TPL
{
TPL (){}
~TPL (){}
void method () {}
};
template <> TPL<int>::TPL ();
template <> TPL<int>::~TPL ();
template <> void TPL<int>::method ();
void Foo ()
{
TPL<int> i;
i.method ();
}
|
google
|
chromium
|
Wuninitialized-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wuninitialized-1.C
| 246 |
utf_8
|
fe4c6303d7ec13423e71cfb150c05d00
|
/* { dg-options "-O2 -Wuninitialized" } */
struct Empty { Empty() {} }; /* { dg-bogus "uninitialized" } */
struct Other {
Other(const Empty& e_) : e(e_) {}
Empty e;
};
void bar(Other&);
void foo()
{
Empty e;
Other o(e);
bar(o);
}
|
google
|
chromium
|
conv1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/conv1.C
| 477 |
utf_8
|
85be959a24d4346758266af7cda69d72
|
// { dg-do compile }
// PR 10337, unneeded warning
class A {
public:
A() {}
};
class B : public A {
public:
B() {}
void operator=(const A& b) {}
void operator=(const B& b) {}
};
class C {
public:
C() {}
operator B &() { return _b; }
operator const B &() const { return _b; }
B _b;
};
int main() {
B b;
C c;
b = c;
}
|
google
|
chromium
|
Woverflow-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Woverflow-3.C
| 111 |
utf_8
|
c8cfeb1be8b9ab6b1a5bf044e67e73e2
|
/* { dg-do compile } */
/* { dg-options "-O2 -Wno-overflow" } */
#include <limits.h>
int foo = INT_MAX + 1;
|
google
|
chromium
|
Wstring-literal-comparison-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C
| 370 |
utf_8
|
c608f5d02a06d2e24d8ab0ca0d977f67
|
/* PR c/7776 */
/* { dg-do compile } */
/* { dg-options "-Wall" } */
int test1(char *ptr)
{
return ptr == "foo"; /* { dg-warning "comparison with string" } */
}
int test2()
{
return "foo" != (const char*)0;
}
int test3()
{
return "foo" == (const char*)0;
}
int test4()
{
return (const char*)0 != "foo";
}
int test5()
{
return (const char*)0 == "foo";
}
|
google
|
chromium
|
Wvla-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wvla-3.C
| 112 |
utf_8
|
43ab54c8c4c6f2ba5ea4192d282a669e
|
/* { dg-do compile } */
/* { dg-options "-pedantic-errors -Wno-vla" } */
void func (int i)
{
int array[i];
}
|
google
|
chromium
|
Wuninitialized-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wuninitialized-3.C
| 246 |
utf_8
|
ff7e55750a566580a7e5b746cf7dfa22
|
// PR C++/38908
// { dg-options "-Wuninitialized -O" }
struct empty {};
struct dfs_visitor {
dfs_visitor() { }
empty m_vis;
};
void bar(const dfs_visitor&);
void foo(void)
{
dfs_visitor vis;
dfs_visitor vis2 = vis;
bar (vis2);
}
|
google
|
chromium
|
deprecated-5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/deprecated-5.C
| 123 |
utf_8
|
9fb0087e50484de53d979d8e849be2eb
|
// PR c++/16370
struct Foo { int i; } __attribute__ ((deprecated));
void foo() { Foo f; } // { dg-warning "deprecated" }
|
google
|
chromium
|
multiple-overflow-warn-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/multiple-overflow-warn-1.C
| 357 |
utf_8
|
1843c11c874c72ec8512fdb7ee86990e
|
/* PR c/19978 : Test for duplicated warnings (unary operators). */
/* { dg-do compile } */
/* { dg-options "-Woverflow" } */
#include <limits.h>
int
g (void)
{
return - - - - -INT_MIN; /* { dg-bogus "integer overflow in expression.*integer overflow in expression" } */
/* { dg-warning "integer overflow in expression" "" { target *-*-* } 10 } */
}
|
google
|
chromium
|
Woverflow-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Woverflow-1.C
| 138 |
utf_8
|
7256cd2e505f10c051c8ac833ca88513
|
/* { dg-do compile } */
/* { dg-options "-O2" } */
#include <limits.h>
int foo = INT_MAX + 1; /* { dg-warning "integer overflow" } */
|
google
|
chromium
|
pedantic2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pedantic2.C
| 167 |
utf_8
|
4c8c625ae79211ff8d60b894c8b21b81
|
// { dg-options "-pedantic" }
class foo
{
foo() {};
void bar() {};
foo(int) {};; // { dg-warning "extra" }
void bar(int) {};; // { dg-warning "extra" }
};
|
google
|
chromium
|
Wshadow-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wshadow-3.C
| 110 |
utf_8
|
c6d10f027652eb4c20869c7eaeebb358
|
// PR c++/18530
// { dg-options "-Wshadow" }
struct A {
A();
~A();
void foo (int __ct, int __dt) {}
};
|
google
|
chromium
|
Wparentheses-17
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-17.C
| 937 |
utf_8
|
f7114375773644b335efb9f920f9b201
|
// { dg-do compile }
// { dg-options "-Wparentheses" }
// Template version of Wparentheses-8.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));
}
template void bar<int> (int, int, int); // { dg-message "instantiated" }
|
google
|
chromium
|
pr28943
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr28943.C
| 498 |
utf_8
|
a7158d5a1d0acfa018bf80fecfe8aa6e
|
// PR c++/28943 void and non-void in conditional expression
// { dg-do compile }
// { dg-options "" }
void debug (const char * string)
{
return;
}
int f()
{
( true == false ? 0 : debug ("Some string")); // { dg-error "third operand .* type 'void'.* second operand is neither a throw-expression nor of type 'void'" }
( true == false ? debug ("Some string") : 0 ); // { dg-error "second operand .* type 'void'.* third operand is neither a throw-expression nor of type 'void'" }
return 0;
}
|
google
|
chromium
|
Warray-bounds-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Warray-bounds-3.C
| 225 |
utf_8
|
de22eb15ae2420b77fbb90f3b584c785
|
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */
extern void function(void * x);
struct A {
long x;
char d[0];
};
void test(A * a) {
function((char *)a - 4); /* { dg-bogus "below array bounds" } */
}
|
google
|
chromium
|
miss-format-4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/miss-format-4.C
| 902 |
utf_8
|
ed4e1a2fb0bdeb0c706fbaea8bc05dfa
|
/* { dg-do compile } */
/* { dg-options "-Wmissing-format-attribute" } */
/* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */
#include <stdarg.h>
typedef void (*noattr_t) (const char *, ...);
typedef noattr_t __attribute__ ((__format__(__printf__, 1, 2))) attr_t;
typedef void (*vnoattr_t) (const char *, va_list);
typedef vnoattr_t __attribute__ ((__format__(__printf__, 1, 0))) vattr_t;
void
foo1 (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va)
{
noattr_t na1, na2;
attr_t a1, a2;
vnoattr_t vna1, vna2;
vattr_t va1, va2;
na1 = na;
na2 = a; /* { dg-warning "candidate" "assignment warning" } */
a1 = na;
a2 = a;
vna1 = vna;
vna2 = va; /* { dg-warning "candidate" "assignment warning" } */
va1 = vna;
va1 = va;
}
|
google
|
chromium
|
Wconversion-real
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wconversion-real.C
| 2,078 |
utf_8
|
9edc88a9888f500419aa84c03e8b5c77
|
/* Test for diagnostics for Wconversion for floating-point.
C++ equivalent of gcc/testsuite/gcc.dg/Wconversion-real.c */
/* { dg-do compile }
/* { dg-options "-Wconversion" } */
float vfloat;
double vdouble;
long double vlongdouble;
void ffloat (float f);
void fdouble (double d);
void flongdouble (long double ld);
void h (void)
{
float f = 0;
double d = 0;
long double ld = 0;
ffloat (3.1); /* { dg-warning "conversion" } */
vfloat = 3.1; /* { dg-warning "conversion" } */
ffloat (3.1L); /* { dg-warning "conversion" } */
vfloat = 3.1L; /* { dg-warning "conversion" } */
fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */
vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */
ffloat (vdouble); /* { dg-warning "conversion" } */
vfloat = vdouble; /* { dg-warning "conversion" } */
ffloat (vlongdouble); /* { dg-warning "conversion" } */
vfloat = vlongdouble; /* { dg-warning "conversion" } */
fdouble (vlongdouble); /* { dg-warning "conversion" "" { target large_long_double } } */
vdouble = vlongdouble; /* { dg-warning "conversion" "" { target large_long_double } } */
ffloat ((float) 3.1);
vfloat = (float) 3.1;
ffloat ((float) 3.1L);
vfloat = (float) 3.1L;
fdouble ((double) 3.1L);
vdouble = (double) 3.1L;
ffloat ((float) vdouble);
vfloat = (float) vdouble;
ffloat ((float) vlongdouble);
vfloat = (float) vlongdouble;
fdouble ((double) vlongdouble);
vdouble = (double) vlongdouble;
ffloat (3.0);
vfloat = 3.0;
ffloat (3.1f);
vfloat = 3.1f;
ffloat (0.25L);
vfloat = 0.25L;
fdouble (3.0);
vdouble = 3.0;
fdouble (3.1f);
vdouble = 3.1f;
fdouble (0.25L);
vdouble = 0.25L;
flongdouble (3.0);
vlongdouble = 3.0;
flongdouble (3.1f);
vlongdouble = 3.1f;
flongdouble (0.25L);
vlongdouble = 0.25L;
ffloat (f);
vfloat = f;
fdouble (f);
vdouble = f;
fdouble (d);
vdouble = d;
flongdouble (f);
vlongdouble = f;
flongdouble (d);
vlongdouble = d;
flongdouble (ld);
vlongdouble = ld;
}
|
google
|
chromium
|
pr11492
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pr11492.C
| 259 |
utf_8
|
f257fca4d00c8c67aa2b9d6e43ee906f
|
// PR11492
// { dg-do compile }
// { dg-options "-Wsign-compare" }
int main( void )
{
unsigned int a;
unsigned char b;
for ( a = 0, b = 2; a > b * 1000; a++ ) /* { dg-bogus "comparison between signed and unsigned integer" } */
{ ; }
return 0;
}
|
google
|
chromium
|
pragma-system_header5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/pragma-system_header5.C
| 137 |
utf_8
|
ead08695035c4edabe2cbf3251983089
|
// PR c++/36760
// { dg-options "-Wextra" }
#include "pragma-system_header5.h"
void f()
{
g<const double>();
g<volatile void>();
}
|
google
|
chromium
|
anonymous-namespace-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C
| 516 |
utf_8
|
f8ad5a1b952230262de883716c47bcdd
|
// Test for the warning of exposing types from an anonymous namespace
// { dg-do compile }
//
#include "anonymous-namespace-2.h"
namespace {
struct good { };
}
struct g1 {
good * A;
};
struct g2 {
good * A[1];
};
struct g3 {
good (*A)[1];
};
#line 21 "foo.C"
struct b1 { // { dg-warning "uses the anonymous namespace" }
bad * B;
};
struct b2 { // { dg-warning "uses the anonymous namespace" }
bad * B[1];
};
struct b3 { // { dg-warning "uses the anonymous namespace" }
bad (*B)[1];
};
|
google
|
chromium
|
sequence-pt-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/sequence-pt-1.C
| 5,925 |
utf_8
|
f29205fe73b9b7871a2d5a931504281d
|
/* Test for sequence point warnings. */
/* Origin: Michael Meeks in
<URL:http://gcc.gnu.org/ml/gcc-patches/1998-06/msg00316.html>,
/* { dg-do compile } */
/* { dg-options "-Wsequence-point" } */
struct s
{
int a;
};
extern int fn (int);
extern int fnb (int, int);
extern int fnc (int *);
extern int sprintf (char *, const char *, ...);
typedef __SIZE_TYPE__ size_t;
void
foo (int a, int b, int n, int p, int *ptr, struct s *sptr,
int *ap, int *bp, int **cp, char *ans, int (*fnp[8])(int))
{
int len;
a = a++; /* { dg-warning "undefined" "sequence point warning" } */
a = --a; /* { dg-warning "undefined" "sequence point warning" } */
a = ++a + b; /* { dg-warning "undefined" "sequence point warning" } */
a = a-- + b; /* { dg-warning "undefined" "sequence point warning" } */
ap[n] = bp[n++]; /* { dg-warning "undefined" "sequence point warning" } */
ap[--n] = bp[n]; /* { dg-warning "undefined" "sequence point warning" } */
ap[++n] = bp[--n]; /* { dg-warning "undefined" "sequence point warning" } */
cp[n][n] = cp[n][n]++; /* { dg-warning "undefined" "sequence point warning" { xfail *-*-* } } */
cp[n][p] = cp[n][n++]; /* { dg-warning "undefined" "sequence point warning" } */
*ptr++ = (size_t)ptr++; /* { dg-warning "undefined" "sequence point warning" } */
sptr->a = sptr->a++; /* { dg-warning "undefined" "sequence point warning" { xfail *-*-* } } */
sptr->a = (size_t)(sptr++); /* { dg-warning "undefined" "sequence point warning" } */
*ptr++ = fn (*ptr); /* { dg-warning "undefined" "sequence point warning" } */
a = b = a++; /* { dg-warning "undefined" "sequence point warning" } */
b = a = --b; /* { dg-warning "undefined" "sequence point warning" } */
a = 1 + (a = 1); /* { dg-warning "undefined" "sequence point warning" } */
a = (a = b); /* { dg-warning "undefined" "sequence point warning" } */
a = (a = b) + 1; /* { dg-warning "undefined" "sequence point warning" } */
a = (bp[a++] = b) + 1; /* { dg-warning "undefined" "sequence point warning" } */
a = b++ * b++; /* { dg-warning "undefined" "sequence point warning" } */
a = fnb (b++, b++); /* { dg-warning "undefined" "sequence point warning" } */
a = (*fnp[b++]) (b++); /* { dg-warning "undefined" "sequence point warning" } */
a = (*fnp[b]) (b++); /* { dg-warning "undefined" "sequence point warning" } */
a = (*fnp[b++]) (b); /* { dg-warning "undefined" "sequence point warning" } */
*ap = fnc (ap++); /* { dg-warning "undefined" "sequence point warning" } */
(a += b) + (a += n); /* { dg-warning "undefined" "sequence point warning" } */
a = (b, b++) + (b++, b); /* { dg-warning "undefined" "sequence point warning" } */
ap[a++] += a; /* { dg-warning "undefined" "sequence point warning" } */
ap[a+=1] += a; /* { dg-warning "undefined" "sequence point warning" } */
ap[a++] += a++; /* { dg-warning "undefined" "sequence point warning" } */
ap[a+=1] += a++; /* { dg-warning "undefined" "sequence point warning" } */
a = a++, b = a; /* { dg-warning "undefined" "sequence point warning" } */
b = a, a = a++; /* { dg-warning "undefined" "sequence point warning" } */
a = (b++ ? n : a) + b; /* { dg-warning "undefined" "sequence point warning" } */
b ? a = a++ : a; /* { dg-warning "undefined" "sequence point warning" } */
b && (a = a++); /* { dg-warning "undefined" "sequence point warning" } */
(a = a++) && b; /* { dg-warning "undefined" "sequence point warning" } */
b, (a = a++); /* { dg-warning "undefined" "sequence point warning" } */
(a = a++), b; /* { dg-warning "undefined" "sequence point warning" } */
a ^= b ^= a ^= b; /* { dg-warning "undefined" "sequence point warning" } */
a = a; /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = (a++ && 4); /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = ! (a++ && 4); /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = - (a++ && 4); /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = (double) (a++ && 4); /* { dg-bogus "undefined" "bogus sequence point warning" } */
len = sprintf (ans, "%d", len++); /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = fn (a++); /* { dg-bogus "undefined" "bogus sequence point warning" } */
b++, (b + b); /* { dg-bogus "undefined" "bogus sequence point warning" } */
(a = b++), (a = b++); /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = (b++, b++); /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = b++ && b++; /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = b++ || b++; /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = (b++ ? b++ : a); /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = (b++ ? a : b++); /* { dg-bogus "undefined" "bogus sequence point warning" } */
ap[a++] += bp[b]; /* { dg-bogus "undefined" "bogus sequence point warning" } */
ap[a += 1] += 1; /* { dg-bogus "undefined" "bogus sequence point warning" } */
*ptr < 128 ? *ptr++ : *(ptr += 2); /* { dg-bogus "undefined" "bogus sequence point warning" } */
/* The following will be represented internally with a tree consisting of
many duplicated SAVE_EXPRs. This caused the previous version of the
sequence point warning code to fail by running out of virtual memory. */
a = ((b & 1 ? 21 : 0)
| (b & 2 ? 22 : 0)
| (b & 3 ? 23 : 0)
| (b & 4 ? 24 : 0)
| (b & 5 ? 25 : 0)
| (b & 6 ? 26 : 0)
| (b & 7 ? 27 : 0)
| (b & 8 ? 28 : 0)
| (b & 9 ? 29 : 0)
| (b & 10 ? 30 : 0)
| (b & 11 ? 31 : 0)
| (b & 12 ? 32 : 0)
| (b & 13 ? 1 : 0)
| (b & 14 ? 2 : 0)
| (b & 15 ? 3 : 0)
| (b & 16 ? 4 : 0)
| (b & 17 ? 5 : 0)
| (b & 18 ? 6 : 0)
| (b & 19 ? 7 : 0)
| (b & 20 ? 8 : 0)
| (b & 21 ? 9 : 0));
}
|
google
|
chromium
|
Wsequence-point-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wsequence-point-1.C
| 140 |
utf_8
|
78a781a7fee9227b3174b6dee0ac20b3
|
// { dg-do compile }
// { dg-options "-Wsequence-point" }
struct C
{
~C() throw();
};
void t_test1 (C* mapping)
{
delete [] mapping;
}
|
google
|
chromium
|
Wreturn-type-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wreturn-type-2.C
| 192 |
utf_8
|
1d81b4c94aef9d2c63d5599d4508e03a
|
// PR middle-end/16558
// { dg-options "-Wreturn-type" }
struct C
{
C ();
~C ();
};
int getref (int ndx)
{
C d;
if (ndx != 0) {
C base;
return 0;
}
else
return 0;
}
|
google
|
chromium
|
main
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/main.C
| 180 |
utf_8
|
217f0311161c670d6ef0fbd06a3c6b91
|
// { dg-do compile }
// PR c++/4494: Incorrect diagnostics about return type of main.
typedef int int_t;
int_t main() {
}
|
google
|
chromium
|
Warray-bounds-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Warray-bounds-2.C
| 221 |
utf_8
|
798433d4099cd8d7572fde802e640896
|
/* { dg-do compile } */
/* Test that -Warray-bounds is enabled by -Wall */
/* { dg-options "-O2 -Wall" } */
int a[10];
int* f(void) {
a[-1] = 0; /* { dg-warning "array subscript" } */
return a;
}
|
google
|
chromium
|
Wno-div-by-zero
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wno-div-by-zero.C
| 91 |
utf_8
|
13048d07bf8630f21562df0b77b67343
|
// { dg-options "-Wno-div-by-zero" }
int breakme()
{
int x = 0;
x /= 0;
return x;
}
|
google
|
chromium
|
Wswitch-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wswitch-2.C
| 754 |
utf_8
|
063811cae4064dfe33ddbcd11e9f93ee
|
/* Further -Wswitch tests. */
/* { dg-do compile } */
/* { dg-options "-Wswitch" } */
enum e { e1 = 0, e2 = 1, e3 = 1, e4 = 2 };
int
foo (enum e ei, int j)
{
switch (ei)
{
case e1: return 1;
case e3: return 2;
case e4: return 3;
} /* No warning here since e2 has the same value as e3. */
switch (ei) /* { dg-warning "enumeration value 'e4' not handled in switch" "enum e4" } */
{
case e1: return 1;
case e2: return 2;
}
switch ((int) ei)
{
case e1: return 1;
} /* No warning here since switch condition was cast to int. */
switch ((enum e) j) /* { dg-warning "enumeration value 'e1' not handled in switch" "enum e1" } */
{
case e2: return 1;
case e4: return 2;
}
return 0;
}
|
google
|
chromium
|
Wstrict-aliasing-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-2.C
| 215 |
utf_8
|
414da1b51217d31e1c2f4c076e8fe650
|
/* { dg-do compile } */
/* { dg-options "-Wstrict-aliasing=2 -O2" } */
double x;
template <typename T>
T *foo(void)
{
return (T *)&x; /* { dg-bogus "strict-aliasing" } */
}
template double *foo<double>(void);
|
google
|
chromium
|
Wall-write-strings
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wall-write-strings.C
| 138 |
utf_8
|
38c1d3bcd70aac8e2e1f0e19b075e6a9
|
// PR 8586
// { dg-do compile }
// { dg-options "-Wall" }
char* foo = "foo"; // { dg-warning "" }
const char* bar = "bar";
|
google
|
chromium
|
switch1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/switch1.C
| 313 |
utf_8
|
cbeb61a079567f59bdce9faa40877398
|
// { dg-do compile { target { int32plus } } }
signed char sc;
void
foo (void)
{
switch (sc)
{
case 1:
case 2 * __SCHAR_MAX__ + 3: // { dg-warning "case label value exceeds maximum" }
case - 2 * __SCHAR_MAX__ - 1: // { dg-warning "case label value is less than minimum" }
break;
}
}
|
google
|
chromium
|
incomplete1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/incomplete1.C
| 681 |
utf_8
|
5dc2eb037ac5530c74f0ae8e9052adb9
|
// { dg-do compile }
// Contributed by Brian Gaeke; public domain.
// 5 If the object being deleted has incomplete class type at the
// point of deletion and the complete class has a non-trivial
// destructor or a deallocation function, the behavior is undefined.
// (But the deletion does not constitute an ill-formed program. So the
// program should nevertheless compile, but it should give a warning.)
class A; // { dg-warning "forward declaration of 'struct A'" "" }
A *a; // { dg-warning "'a' has incomplete type" "" }
int
main (int argc, char **argv)
{
delete a; // { dg-warning "delete" "warn" }
// { dg-message "note" "note" { target *-*-* } 19 }
return 0;
}
|
google
|
chromium
|
Wparentheses-18
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-18.C
| 4,249 |
utf_8
|
a161987df2474d8488c67b358fe0c962
|
// { dg-do compile }
// { dg-options "-Wparentheses" }
// Template version of Wparentheses-9.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
|
Wstrict-aliasing-bogus-nested-arrays
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-nested-arrays.C
| 227 |
utf_8
|
b84015e5a6773bd08e2a0f87ad5c4641
|
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */
int foo () {
int buffer[10][10];
int* pi = &buffer[0][0]; /* { dg-bogus "same element type" } */
*pi = 10;
return buffer[0][0];
}
|
google
|
chromium
|
Wunused-8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wunused-8.C
| 194 |
utf_8
|
0d99e205a486cf3984dae4b4c82a1c4f
|
// PR c++/16029
// { dg-options "-Wunused" }
int main ()
{
// We should not see an "unused" warning about "whatever" on the
// next line.
return whatever (); // { dg-error "declared" }
}
|
google
|
chromium
|
Wreturn-type-5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wreturn-type-5.C
| 240 |
utf_8
|
ac4f08dd2a157d7c72adbbb04354e082
|
// PR c++/36254
// { dg-do compile }
// { dg-options "-Wreturn-type" }
int i, j, k;
struct X { X (); ~X (); };
bool
foo ()
{
X x;
if (i && j)
{
if (k)
return true;
else
return false;
}
else
return false;
}
|
google
|
chromium
|
Winline-4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Winline-4.C
| 486 |
utf_8
|
401a1cfacaa701f3e1459d7dcaf225d9
|
// { dg-do compile }
// { dg-options "-O2 -Winline" }
// Origin: <markus at oberhumer dot com>
// PR 17115: We should not emit -Winline warning for functions marked with
// noinline
struct Foo {
__attribute__((noinline)) int a(int r) { return r & 1; }
virtual __attribute__((noinline)) int b(int r) { return r & 1; }
static __attribute__((noinline)) int c(int r) { return r & 1; }
};
int bar(int r) {
Foo f;
int k = 1; k &= f.a(r); k &= f.b(r); k &= f.a(r);
return k;
}
|
google
|
chromium
|
Wstring-literal-comparison-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-3.C
| 318 |
utf_8
|
a0b497dc1f8dc8ce49f81bc391f0deb1
|
/* PR c/7776 */
/* { dg-do compile } */
/* { dg-options "" } */
int test1(char *ptr)
{
return ptr == "foo";
}
int test2()
{
return "foo" != (const char*)0;
}
int test3()
{
return "foo" == (const char*)0;
}
int test4()
{
return (const char*)0 != "foo";
}
int test5()
{
return (const char*)0 == "foo";
}
|
google
|
chromium
|
friend
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/friend.C
| 260 |
utf_8
|
0163a6a329fdf7f5efa7b908b04848a0
|
/* { dg-do compile } */
/* { dg-options -Wredundant-decls } */
/* Test to see if spurious warnings about redundant
declarations are emiited because of the friend
declaration. */
class Foo
{
friend void bar (Foo);
public:
};
extern void bar (Foo);
|
google
|
chromium
|
Wparentheses-15
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/warn/Wparentheses-15.C
| 2,287 |
utf_8
|
6550ed73f75ed13c7d925453010445d0
|
// { dg-do compile }
// { dg-options "-Wparentheses" }
// Template version of Wparentheses-6.C.
int foo (int);
template<class T>
void
bar (T a, T b, T c)
{
foo (a <= b <= c); // { dg-warning "comparison" "correct warning" }
foo ((a <= b) <= c);
foo (a <= (b <= c));
foo (1 <= 2 <= c); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) <= c);
foo (1 <= (2 <= c));
foo (1 <= 2 <= 3); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) <= 3);
foo (1 <= (2 <= 3));
foo (a > b > c); // { dg-warning "comparison" "correct warning" }
foo ((a > b) > c);
foo (a > (b > c));
foo (1 > 2 > c); // { dg-warning "comparison" "correct warning" }
foo ((1 > 2) > c);
foo (1 > (2 > c));
foo (1 > 2 > 3); // { dg-warning "comparison" "correct warning" }
foo ((1 > 2) > 3);
foo (1 > (2 > 3));
foo (a < b <= c); // { dg-warning "comparison" "correct warning" }
foo ((a < b) <= c);
foo (a < (b <= c));
foo (1 < 2 <= c); // { dg-warning "comparison" "correct warning" }
foo ((1 < 2) <= c);
foo (1 < (2 <= c));
foo (1 < 2 <= 3); // { dg-warning "comparison" "correct warning" }
foo ((1 < 2) <= 3);
foo (1 < (2 <= 3));
foo (a <= b > c); // { dg-warning "comparison" "correct warning" }
foo ((a <= b) > c);
foo (a <= (b > c));
foo (1 <= 2 > c); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) > c);
foo (1 <= (2 > c));
foo (1 <= 2 > 3); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) > 3);
foo (1 <= (2 > 3));
foo (a <= b == c); // { dg-warning "comparison" "correct warning" }
foo ((a <= b) == c);
foo (a <= (b == c));
foo (1 <= 2 == c); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) == c);
foo (1 <= (2 == c));
foo (1 <= 2 == 3); // { dg-warning "comparison" "correct warning" }
foo ((1 <= 2) == 3);
foo (1 <= (2 == 3));
foo (a != b != c); // { dg-warning "comparison" "correct warning" }
foo ((a != b) != c);
foo (a != (b != c));
foo (1 != 2 != c); // { dg-warning "comparison" "correct warning" }
foo ((1 != 2) != c);
foo (1 != (2 != c));
foo (1 != 2 != 3); // { dg-warning "comparison" "correct warning" }
foo ((1 != 2) != 3);
foo (1 != (2 != 3));
}
template void bar<int> (int, int, int); // { dg-message "instantiated" }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.