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 | android | Warray-bounds-4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-4.C | 921 | utf_8 | c5f8d177b95311df0a23b28f8373351d | // { dg-do compile }
// { dg-options "-O2 -Warray-bounds" }
class String
{
public:
virtual unsigned long length() const = 0;
virtual char get(unsigned long index) const = 0;
virtual void set(unsigned long index, char value) = 0;
virtual char& operator[] (unsigned long value) = 0;
virtual ~String() {};
};
te... |
google | android | Wunused-10 | .C | toolchain/gcc/gcc-4.9/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 | android | string1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/string1.C | 257 | utf_8 | 8f037cf9c57a56b596c880e43bb0df05 | // PR c++/35652
// { dg-options "-O" }
#include <string>
int test() {
// blank line padding, could also be code...
//
//
//
//
//
//
//
//
//
std::string s = "";
s += 'x' + "y"; // { dg-warning "bounds of constant string" }
}
|
google | android | Wreturn-1 | .C | toolchain/gcc/gcc-4.9/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 | android | Wunused-9 | .C | toolchain/gcc/gcc-4.9/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-warni... |
google | android | Wnvdtor-3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wnvdtor-3.C | 1,295 | utf_8 | 6568c50bb4b28a370c190312d8036309 | // { dg-do compile }
// { dg-options "-Weffc++" }
// Warn when a class has virtual functions and accessible non-virtual
// destructor, in which case it would be possible but unsafe to delete
// an instance of a derived class through a pointer to the base class.
struct A
{
protected:
~A(); // inaccessible - no warni... |
google | android | format8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/format8.C | 192 | utf_8 | 73f4dcb572247643b18b851965928450 | // PR c++/52818
// { dg-options "-pedantic-errors -Wformat" }
extern "C" int printf (const char *, ...);
void f() {
printf("%lf", 0.0); // { dg-warning "%lf" "" { target { ! c++11 } } }
}
|
google | android | changes-meaning | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/changes-meaning.C | 246 | utf_8 | 9d482788ebfbc6a8f5bfebe98d71ae94 | /* { dg-do compile } */
/* { dg-options "-fpermissive" } */
template <class _Tp> class auto_ptr {}; /* { dg-warning "changes meaning" } */
template <class _Tp>
class counted_ptr
{
public:
auto_ptr<_Tp> auto_ptr(); /* { dg-warning "" } */
};
|
google | android | Wshadow-local-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-local-1.C | 737 | utf_8 | 90f370e921b61830ee422f6dd76434c5 | /* { dg-do compile } */
/* { dg-options -Wshadow-local } */
struct status
{
int member;
void foo2 ();
inline static int foo3 (int member)
{
return member;
}
};
int decl1; // { dg-bogus "shadowed declaration" }
int decl2; // { dg-bogus "shadowed declaration" }
v... |
google | android | Wconversion-null-3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C | 188 | utf_8 | b256e2e86a0c654704aeae4db0b68327 | // PR c++/48420
// { dg-do compile { target { ! c++11 } } }
void foo(int* p);
void bar() {
const bool kDebugMode = false;
foo(kDebugMode); // { dg-warning "converting 'false'" }
}
|
google | android | Wvla-3 | .C | toolchain/gcc/gcc-4.9/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 | android | overflow-warn-3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/overflow-warn-3.C | 4,578 | utf_8 | cb5efd3f14e6a337a7b1bfa0087e56fa | /* { dg-do compile } */
/* { dg-options "-fpermissive -pedantic" } */
#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: divi... |
google | android | Wbraces1 | .C | toolchain/gcc/gcc-4.9/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 | android | Wzero-as-null-pointer-constant-3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-3.C | 385 | utf_8 | 72f6e24d01ded2dacc4868ebf4d21a6f | // PR c++/51290
// { dg-options "-Wzero-as-null-pointer-constant" }
class A { int a; };
class B { int b; };
class C : public A, public B
{
private:
static void foo (A *x)
{
C *y = static_cast<C *>(x);
(void) y;
}
static void bar (B *x)
{
... |
google | android | Wstrict-aliasing-bogus-struct-included | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-struct-included.C | 269 | utf_8 | 73aa8fdd361564d9ba904d4252613717 | /* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */
struct S {
int i;
float f;
};
int foo () {
struct S s;
s.i = 7;
float* f = &s.f; /* { dg-bogus "float included in struct S" } */
*f = 2.0;
return s.i + (int)s.f;
}
|
google | android | pr36069 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/pr36069.C | 401 | utf_8 | 7bf21e020852a31958f06efe9a7f79d3 | // PR c++/36069 Strange "warning: suggest parentheses around
// assignment used as truth value" with volatile/non volatile bools
// { dg-do compile }
// { dg-options "-Wparentheses" }
struct foo {
bool a;
volatile bool b,c;
foo() { a = b = c = false; } // { dg-bogus "parentheses" }
};
int main() {
bool a;
... |
google | android | warn_unused | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/warn_unused.C | 385 | utf_8 | e29ebb1c2a1c295137eae1a72e9e7c7b | // { dg-do compile }
// { dg-options -Wunused }
struct __attribute__((warn_unused)) Test
{
Test();
~Test();
void use();
};
struct TestNormal
{
TestNormal();
};
int main()
{
Test unused; // { dg-warning "unused variable" }
Test used; // { dg-bogus "unused variable" }
TestNor... |
google | android | Wsequence-point-pr18050 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wsequence-point-pr18050.C | 414 | utf_8 | 8fb4b9a6c1d26c1e9bde7782d85ab4db | /* PR 18050 : bogus warning with -Wsequence-point */
/* { dg-do compile } */
/* { dg-options "-Wsequence-point" } */
struct x
{
int i;
};
void bar(struct x*, int *);
void foo(struct x *y)
{
bar(y++, &y->i); /* { dg-warning "operation on 'y' may be undefined" } */
}
void zz(int a, int *b)
{
*b = a;
}
void baz(... |
google | android | Woverflow-1 | .C | toolchain/gcc/gcc-4.9/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 | android | Wreorder-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wreorder-1.C | 204 | utf_8 | c581ab7bc1c10728c1e68266d06af6e9 | // { dg-options "-Wreorder -W" }
struct S {
S ();
};
struct T {
T ();
};
struct U : virtual public S, virtual public T {
U () : T (), S () {} // { dg-warning "" }
U (const U&) : S () {}
};
|
google | android | format7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/format7.C | 166 | utf_8 | cf1e5660ee1cd060f1bf1da012306d6b | // PR c++/50757
// { dg-options "-Wformat -Wno-nonnull" }
extern void *f (void *__s) __attribute__ ((__nonnull__ (1)));
int main()
{
void* const s = 0;
f(s);
}
|
google | android | miss-format-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/miss-format-1.C | 1,073 | utf_8 | c418e03d117424d22153072186732d70 | /* { dg-do compile } */
/* { dg-options "-Wmissing-format-attribute" } */
/* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */
/* VxWorks does not provide vscanf, either in kernel or RTP mode. */
/* { dg-error "not declared" "" { target *-*-vxworks* } 26 } */
#include <stdio.h>
#include <stda... |
google | android | compare1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/compare1.C | 246 | utf_8 | 064f2d562e6ae3005fac3be98940a167 | /* -Wall is supposed to trigger -Wsign-compare for C++. PR 10604.
See also gcc.dg/compare7.c. */
/* { dg-do compile } */
/* { dg-options "-Wall" } */
int f(unsigned a, int b)
{
return a < b; /* { dg-warning "signed and unsigned" } */
}
|
google | android | deprecated-7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/deprecated-7.C | 276 | utf_8 | 1a91ee27a48ba8f3961c5489d98ca492 | // PR c++/56130
int g_nn;
int& g_n __attribute__((deprecated)) = g_nn;
void f()
{
int f_nn;
int& f_n __attribute__((deprecated)) = f_nn;
f_n = 1; // { dg-warning "'f_n' is deprecated" }
}
int main()
{
g_n = 1; // { dg-warning "'g_n' is deprecated" }
f();
}
|
google | android | miss-format-4 | .C | toolchain/gcc/gcc-4.9/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) (co... |
google | android | pr11492 | .C | toolchain/gcc/gcc-4.9/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 | android | skip-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/skip-1.C | 417 | utf_8 | 67a0e31346c32b568b1d0584a5c6a3bc | // { dg-do compile }
// { dg-options "-Wall" }
// Check that we don't warn about code that will not be executed.
extern int f2(int);
void
f1(int i)
{
f2(1 == 1 ? 0 : f2(i >> -10));
f2(1 == 1 ? 0 : f2(i >> 128));
f2(1 == 1 ? 0 : f2(i << -10));
f2(1 == 1 ? 0 : f2(1 << 128));
f2(1 != 1 ? f2(i >> -10) : 0);
f2... |
google | android | Wsign-conversion | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wsign-conversion.C | 3,710 | utf_8 | 13a5045fd9eb40c38bd45ccb537cc5d4 | /* Test for diagnostics for implicit conversions between signed and
unsigned integer types.
C++ equivalent of gcc/testsuite/gcc.dg/Wsign-conversion.c */
// { dg-do compile }
// { dg-options "-fsigned-char -Wsign-conversion -ftrack-macro-expansion=0" }
#include <limits.h>
void fsc (signed char sc);
void fuc (... |
google | android | pmf2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/pmf2.C | 307 | utf_8 | c36be50bce1bb66a16eefbbb8eed1e5c | // PR c++/56104
// { dg-options "-Wall -O2" }
struct Foo
{
void call()
{}
};
template<class MEMSIG, MEMSIG MEMFUNC>
struct Wrap
{
inline static void call( Foo cc )
{
(cc.*MEMFUNC)(); // <- warning here
}
};
void bar()
{
Wrap<void (Foo::*)(), &Foo::call>::call( Foo() );
}
|
google | android | pr8570 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/pr8570.C | 330 | utf_8 | 591b28c4968c297ab14c8ab1384a1394 | // PR c++/8570
// { dg-do compile }
// { dg-options "" }
template <typename T, typename P>
class X { // { dg-message "note: previous declaration .* used 2" }
public:
X() { }
private:
template <typename U> friend class X; // { dg-error "redeclared with 1 template parameter" }
};
X<int, int> i; // { dg-message "re... |
google | android | main-2 | .C | toolchain/gcc/gcc-4.9/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 | android | Wunreachable-code-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunreachable-code-2.C | 293 | utf_8 | aa9f0a4fa9133811690bf8fa76df33b7 | // PR c++/21228
/* { dg-options "-Wunreachable-code" } */
class testStringBase
{
public:
char *stringPtr;
};
class testString : public testStringBase
{
public:
testString();
};
testString::testString()
{
stringPtr = (char *) 9;
}
int main(int argc, char **argv) {
testString s;
}
|
google | android | conv2 | .C | toolchain/gcc/gcc-4.9/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 | android | noeffect4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/noeffect4.C | 1,660 | utf_8 | 78cf893a8741490107d3cc3c403c9528 | // { 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);
in... |
google | android | Wchar-subscripts-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wchar-subscripts-2.C | 235 | utf_8 | d15107f3d840c1f7539a3dc2f640a5df | /* PR c++/16307 */
// { dg-do compile }
// { dg-options "-Wchar-subscripts" }
extern volatile char bla;
char foo (const char *s)
{
return s [bla]; // { dg-warning "array subscript" }
}
int main ()
{
foo ("\x80");
}
|
google | android | noreturn-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/noreturn-2.C | 94 | utf_8 | 10a2dc88ff4acf5169ed37d5b483050b | // { dg-options "-Wall" }
template <class T>
int f (T t) { } // { dg-warning "no return" }
|
google | android | Wstrict-aliasing-3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-3.C | 325 | utf_8 | c99391b2f8a50e512108d98c5c776a47 | /* { dg-do compile } */
/* { dg-options "-Wstrict-aliasing=2 -O2" } */
double x;
template <typename T>
T *foo(void)
{
return (T *)&x; /* { dg-warning "strict-aliasing" } */
}
template int *foo<int>(void); /* { dg-message "required from here" } */
template char *foo<char>(void); /* { dg-bogus "required from here" }... |
google | android | Wuninitializable-member | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wuninitializable-member.C | 362 | utf_8 | cb6b38abe346f8950bdb218ab4c6e17d | // { dg-do compile }
// { dg-options "-Wuninitialized" }
class X {
int & flag;// { dg-warning "non-static reference 'int& X::flag' in class without a constructor" }
public:
void f(){ flag++ ; }
};
class Y {
const int var;// { dg-warning "non-static const member 'const int Y::var' in class without a constructor... |
google | android | Wbraces3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wbraces3.C | 737 | utf_8 | 76fb8518d0b0d88c1bd0f1b96f745523 | // PR c++/25137
// { dg-options "-Wall" }
struct S { int s[3]; };
S s1 = { 1, 1, 1 };
struct S1 { int s[3]; };
struct S2 { struct S1 a; };
S2 s21 = { 1, 1, 1 };
struct S3 { int s[3]; };
struct S4 { struct S3 a; int b; };
S4 s41 = { 1, 1, 1, 1 };
struct S5 { int s[3]; };
struct S6 { struct S5 a; int b; };
S6 s61 = ... |
google | android | Wsign-compare-6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C | 218 | utf_8 | f62afd3f9167283e17437ccfc3ac257b | // PR c++/23608
// { dg-options "-Wsign-compare" }
#define FIVE 5
int main()
{
int i = 5;
int const ic = 5;
i < 5u; // { dg-warning "5:comparison between signed and unsigned" }
ic < 5u;
FIVE < 5u;
}
|
google | android | pr16302 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/pr16302.C | 4,584 | utf_8 | 41d9cea464884b07741794bae6f22f9f | // PR 16302
/* { dg-do compile } */
/* { dg-options "-Wlogical-op" } */
void bar (int);
int
foo (int argc, char *argv[])
{
if (argc != 1 || argc != 2) return 1; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
if (argc < 0 && argc > 10) return 1; /* { dg-warning "'and' of mutually exclusi... |
google | android | delete-array-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/delete-array-1.C | 226 | utf_8 | e415b9568db9cd79464c85885dc0c9e2 | // PR c++/29185
int a [1];
struct S { int a [1]; } s;
void foo (S *p)
{
delete a; // { dg-warning "deleting array" }
delete s.a; // { dg-warning "deleting array" }
delete p->a; // { dg-warning "deleting array" }
}
|
google | android | nonnull1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/nonnull1.C | 430 | utf_8 | 40efbe938691eeff621e7ef02235827f | // Test that "nonnull" attribute works for C++.
// { dg-do compile }
// { dg-options "-Wall" }
// The "nonnull" attribute is thoroughly tested for C, so here we
// simply test that it works at all, as at one point the relevant
// checking code was only called for C.
extern void f (char *) __attribute__((nonnull));
void... |
google | android | Wbraces2 | .C | toolchain/gcc/gcc-4.9/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 };... |
google | android | oldcast1 | .C | toolchain/gcc/gcc-4.9/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 | android | inline2 | .C | toolchain/gcc/gcc-4.9/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 | android | Warray-bounds-3 | .C | toolchain/gcc/gcc-4.9/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 | android | Wunused-var-10 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-var-10.C | 354 | utf_8 | 898eca8edc4214a3f0d47032d1e29a12 | // PR c++/44412
// { dg-do compile }
// { dg-options "-Wunused" }
struct S
{
static const int a = 3;
static int b;
int c;
};
const int S::a;
int S::b = 4;
int
f1 ()
{
S s;
return s.a;
}
int
f2 ()
{
S s;
return s.b;
}
void
f3 ()
{
S s; // { dg-warning "set but not used" }
s.c = 6;
}
int
f4 ()
{
... |
google | android | null4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/null4.C | 1,663 | utf_8 | 6bf805aeb1fce3c4508783b3ce563adb | // 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 < ... |
google | android | Wsign-conversion-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wsign-conversion-2.C | 179 | utf_8 | 1838324ae4d6c4171b6e67db3068b07b | // PR c++/56530
// { dg-options "-Wsign-conversion" }
struct string
{
string () {};
~string () {};
};
string foo[1]; // okay
string bar[1][1]; // gives bogus warning
|
google | android | overflow-warn-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/overflow-warn-1.C | 4,414 | utf_8 | cf64ec3395dd527364ec5df44cd81c7f | /* { dg-do compile } */
/* { dg-options "-fpermissive" } */
#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 ze... |
google | android | Wstrict-aliasing-bogus-escape-3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-3.C | 386 | utf_8 | ef9cbc9a3736627428296e32dffe78fd | /* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-aliasing" } */
struct Node_base {};
struct Node : Node_base
{
int data;
};
struct List
{
Node_base node, *prev;
List() : prev(&node) { xyz(); }
void xyz();
int back() { return static_cast<Node*>(prev)->data; }
};
struct A
{
virtual ~A();
};
A* fo... |
google | android | Wunused-var-14 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-var-14.C | 260 | utf_8 | 2e3edc42171a0504591e1cb9f346f40d | // PR c++/44682
// { dg-do compile }
// { dg-options "-Wunused" }
struct S { virtual ~S () {} };
struct T { virtual ~T () {} };
struct U : S, T {};
void f (U &);
void
g (void *v)
{
T *t = static_cast <T *> (v);
U *u = static_cast <U *> (t);
f (*u);
}
|
google | android | if-empty-1 | .C | toolchain/gcc/gcc-4.9/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 i... |
google | android | format2 | .C | toolchain/gcc/gcc-4.9/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, ... |
google | android | pr33738 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/pr33738.C | 448 | utf_8 | 641d612ace5eaec7b87aaf01704fb7f5 | // { dg-do run }
// { dg-options "-O2 -Wtype-limits -fstrict-enums" }
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 ();
... |
google | android | Wshadow-4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-4.C | 695 | utf_8 | 2e33a5dd790901f2d6f4cc57f311efc6 | // PR c++/39526
// { dg-options "-Wshadow" }
class INetURLObject
{
public:
INetURLObject(int i);
int GetMainURL() const;
};
int foo(int infoo) // { dg-bogus "shadowed declaration" }
{
int outfoo( INetURLObject( infoo ).GetMainURL()); // { dg-bogus "shadows" }
extern void f(int infoo);
struct A
{
... |
google | android | Wunused-label-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-label-2.C | 338 | utf_8 | 0c7d97044e723227e4b7e6aaa771fe52 | // { dg-do compile }
// { dg-options "-Wunused" }
// If __attribute__ ((unused)) follows a label and precedes a
// declaration, we should get a warning for the label, not the
// declaration.
void
f1()
{
int i1; // { dg-warning "unused variable" }
l1: __attribute__ ((unused)) int i2; // { dg-warning "label \[^\n... |
google | android | Wdiv-by-zero-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wdiv-by-zero-2.C | 705 | utf_8 | c82e0ad627d1dd3f9c88296bf13be5fc | // PR c++/56607
// { dg-do compile { target { { lp64 || ilp32 } || llp64 } } }
// { dg-require-effective-target c++11 }
// { dg-options "-O2 -Wdiv-by-zero" }
constexpr int sc () { return sizeof (char); }
constexpr int si () { return sizeof (int); }
constexpr int zc () { return sc () - 1; }
constexpr int zi (int d) { r... |
google | android | Wparentheses-26 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wparentheses-26.C | 896 | utf_8 | 95ec12b8ebc175ba1e342b0dba2fb6a2 | // PR c++/51064
// { dg-options "-Wparentheses" }
template<int i, int j = ((i + 7) >> 3)> class foo1 { };
typedef foo1<10> bar1;
template<int i, int j = (i + 7 >> 3)> class foo2 { }; // { dg-warning "suggest parentheses around '\\+'" }
typedef foo2<10> bar2;
template<int i, int j = (100 >> (i + 2))> class foo3 { };... |
google | android | Wparentheses-8 | .C | toolchain/gcc/gcc-4.9/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" "corr... |
google | android | Wreturn-type-4 | .C | toolchain/gcc/gcc-4.9/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<typenam... |
google | android | Wvla-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wvla-2.C | 194 | utf_8 | 6addede6411b71cb4a114ab84501c22e | /* { dg-do compile { target { ! c++1y } } } */
/* { dg-options "-pedantic-errors -Wvla" } */
void func (int i)
{
int array[i]; /* { dg-error "ISO C.* forbids variable.* array 'array'" } */
}
|
google | android | ref-temp1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/ref-temp1.C | 183 | utf_8 | dcf594b88cf5da1b2174fbc2c262fb71 | // PR c++/986
// { dg-options "-Wall -Wextra" }
struct X { X (int); };
struct Y {
Y ();
const X &x; // note the ampersand
};
Y::Y () : x(1) {} // { dg-warning "temporary" }
|
google | android | Wparentheses-13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wparentheses-13.C | 1,593 | utf_8 | 9ec8d4fa497036c260fb5d2dbf4ff336 | // { 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" "corre... |
google | android | Wunused-14 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-14.C | 337 | utf_8 | 4db1163df46bee9e9edd04cd86a682a4 | // Test that -Wunused should not emit a warning on the initialization of
// non-POD arrays. See PR c++/39803.
// { dg-do compile }
// { dg-options "-Wunused" }
#include <utility>
using std::pair;
int foo() {
pair<int, const char*> components[3]; // { dg-bogus "value computed is not used" }
components[0].first = ... |
google | android | Wunused-var-13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-var-13.C | 260 | utf_8 | 966a9896df46c3f2d3e58c856ebe5862 | // PR c++/44619
// { dg-do compile }
// { dg-options "-Wunused -W" }
struct S { int x, y; };
int
f1 ()
{
struct S p;
int S::*q = &S::x;
p.*q = 5;
return p.*q;
}
int
f2 (struct S *p, int S::*q)
{
struct S *r = p;
int S::*s = q;
return r->*s;
}
|
google | android | Wparentheses-14 | .C | toolchain/gcc/gcc-4.9/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);
w... |
google | android | Wparentheses-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wparentheses-1.C | 1,661 | utf_8 | d1f22f759809f81b1b677be34f938b02 | // Test operation of -Wparentheses. Warnings for assignments used as
// truth-values. Essentially the same as gcc.dg/Wparentheses-3.c.
// { dg-do compile }
// { dg-options "-Wparentheses" }
int foo (int);
int a, b, c;
bool d;
void
bar (void)
{
if (a = b) // { dg-warning "assignment" "correct warning" }
foo (0);... |
google | android | overflow-warn-6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/overflow-warn-6.C | 359 | utf_8 | e36e0e34c32010c5c54008377dce599e | /* Test non-constant operands in overflowed expressions. */
/* { dg-do compile } */
/* { dg-options "-Woverflow" } */
#include <limits.h>
int
h1 (int x)
{
return x * (0 * (INT_MAX + 1)); /* { dg-warning "integer overflow in expression" } */
}
int
h2 (int x)
{
return ((INT_MAX + 1) * 0) * x; /* { dg-warning "i... |
google | android | pr13358 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/pr13358.C | 635 | utf_8 | 061efc30af7992ab1388f47b212ad1fc | // PR c++/13358: g++ should accept a long long constant sans LL suffix
// if -Wno-long-long is in use.
// { dg-do compile }
// { dg-require-effective-target int32plus }
// { dg-options "-std=c++98 -Wno-long-long -pedantic-errors" }
void use_longlong ()
{
unsigned long long x1, x2, x3;
// make sure it's ok with ... |
google | android | noreturn-4 | .C | toolchain/gcc/gcc-4.9/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 | android | Wunused-local-typedefs | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C | 2,077 | utf_8 | e87b7d02676f112438f0e9a04aeb284d | // Origin PR c++/33255
// { dg-options "-Wunused" } <-- should trigger -Wunused-local-typedefs
// { dg-do compile }
void
test_warn()
{
typedef int foo; // { dg-warning "locally defined but not used" }
}
struct S
{
typedef int T;
S() {}
S(int) {}
};
template<class T>
struct ST
{
typedef T type;
ST ... |
google | android | sequence-pt-3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/sequence-pt-3.C | 328 | utf_8 | ad593aaafdf4b211b08e5be6b3abc282 | /* More sequence point warning tests */
/* { dg-do compile } */
/* { dg-options "-Wsequence-point" } */
void bar(int i, int j)
{
return;
}
void foo (int i)
{
int a = i-i++; (void)a; /* { dg-warning "undefined" "sequence point warning" } */
bar (i--, i++); /* { dg-warning "undefined" "sequence point warning"... |
google | android | Wstrict-aliasing-6 | .C | toolchain/gcc/gcc-4.9/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 | android | Wctor-dtor | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wctor-dtor.C | 227 | utf_8 | 2d2da24222711602624d6870a966c8b0 | // PR c++/21347
// { dg-options "-Wctor-dtor-privacy" }
class A {
public:
int x;
int getX() { return x; } // comment out to avoid warning
};
int foo() {
A a; // accepted: clearly the ctor is not private
return a.x;
}
|
google | android | Wtype-limits-no | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C | 3,164 | utf_8 | d803f73370f8916f5ec2a47e528fa49a | /* Test disabling -Wtype-limits. */
/* { dg-do compile } */
/* { dg-options "-Wextra -Wno-type-limits" } */
extern void assert (int);
void a (unsigned char x)
{
if (x < 0) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
if (x >= 0) return;/* { dg-bogus "comparison is alwa... |
google | android | deprecated-3 | .C | toolchain/gcc/gcc-4.9/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 | android | skip-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/skip-2.C | 771 | utf_8 | 4bf091c9b94c31660c0d977448470862 | // { dg-do compile }
// { dg-options "-Wall" }
extern int f2(int);
extern void f3();
void
f1(int i)
{
if (1 == 1 || f2(i >> -10))
f3();
if (1 == 1 || f2(i >> 128))
f3();
if (1 == 1 || f2(i << -10))
f3();
if (1 == 1 || f2(i << 128))
f3();
if (1 == 1 || i < 0xffffffff)
f3();
if (1 == 1 ||... |
google | android | overflow-warn-5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/overflow-warn-5.C | 420 | utf_8 | 4a9f855779aa7cb0488ab564acde90fc | /* PR c/27273 */
/* { dg-do compile } */
// This used to warn about "overflow in implicit constant conversion",
// which was wrong; 512 is never converted to unsigned char. Rather, an
// appropriate warning would be that the & expression always evaluates to 0
// because of the limited range of unsigned char.
unsigne... |
google | android | Wsequence-point-3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wsequence-point-3.C | 550 | utf_8 | 21e8a0380962b41685ed2da030d6e679 | // PR c++/46401
// { dg-do compile }
// { dg-options "-Wsequence-point" }
struct S
{
S ();
S &operator<< (const char *);
S (const S &);
};
#define N1(n) << #n
#define N2(n) N1(n)
#define N3(n) N2(n##0) N2(n##1) N2(n##2) N2(n##3) N2(n##4) \
N2(n##5) N2(n##6) N2(n##7) N2(n##8) N2(n##9)
#define N4(n) N3(n##... |
google | android | Wconditionally-supported-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wconditionally-supported-1.C | 803 | utf_8 | 3ea384ce70a66de19d8ab92542a57af7 | // { dg-options "-Wconditionally-supported" }
// DR 195 was about allowing conversions between function and object
// pointers under some circumstances. The issue got resolved for C++11,
// which, in 5.2.10 p8 says that: "Converting a function pointer to an
// object pointer type or vice versa is conditionally-suppo... |
google | android | sentinel | .C | toolchain/gcc/gcc-4.9/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); /* {... |
google | android | missing-field-init-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/missing-field-init-1.C | 402 | utf_8 | 67d018f4028bfdad4712e6c50a3eefa7 | /* { dg-do compile } */
/* { dg-options "-Wextra -Wno-missing-field-initializers" } */
struct s { int a, b, c; };
struct s s1 = { 1, 2, 3 };
struct s s2 = { 1, 2 }; /* { dg-bogus "missing initializer" } */
struct s s3[] = { { 1, 2 }, { 4, 5 } }; /* { dg-bogus "missing initializer" } */
struct s s4[] = { 1, 2, 3, 4, 5 ... |
google | android | Wparentheses-22 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wparentheses-22.C | 2,119 | utf_8 | d18ff788cbb2084df4ebb3ddadb46dd8 | // { dg-do compile }
// { dg-options "-Wparentheses" }
// Warnings for assignments used as truth-values when using classes.
// Like Wparentheses-1.C, but with a class.
int foo (int);
class C
{
public:
C()
: b(0)
{ }
// Use default assignment constructor.
// Provide conversion to bool so that an instan... |
google | android | Wtype-limits | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wtype-limits.C | 3,207 | utf_8 | 71601f987b700de3fca19a5eae13fe03 | /* { 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" ... |
google | android | Wvla-1 | .C | toolchain/gcc/gcc-4.9/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 | android | Wzero-as-null-pointer-constant-5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C | 332 | utf_8 | 898b78e0232d57b1bd08812896dbd99f | // PR c++/52718
// { dg-options "-Wzero-as-null-pointer-constant" }
struct foo
{
foo(void* a = 0) {}; // { dg-warning "zero as null pointer" }
};
void* fun(void* a = 0) {}; // { dg-warning "zero as null pointer" }
struct bar: foo
{
bar() {};
};
struct baz
{
baz(const foo& f1 = foo(),
void* f2 = fu... |
google | android | Walways-true-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Walways-true-2.C | 1,274 | utf_8 | 663359b0839155d74214e17713f6b355 | // 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... |
google | android | Wdouble-promotion | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wdouble-promotion.C | 3,219 | utf_8 | cf2551312abb241854e1de4e7dcfd670 | /* { dg-do compile } */
/* { dg-options "-Wdouble-promotion -ftrack-macro-expansion=2" } */
#include <stddef.h>
/* Some targets do not provide <complex.h> so we define I ourselves. */
#define I 1.0iF
#define ID ((_Complex double)I)
float f;
double d;
int i;
long double ld;
_Complex float cf;
_Complex double cd;
_Co... |
google | android | Winline-2 | .C | toolchain/gcc/gcc-4.9/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 | android | noreturn-1 | .C | toolchain/gcc/gcc-4.9/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();
}
... |
google | android | undefined1 | .C | toolchain/gcc/gcc-4.9/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 | android | Wpointer-arith-1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wpointer-arith-1.C | 250 | utf_8 | 10ae80ca102a17979ad4df9d03d42f13 | // PR c++/56815
// { dg-options "-Wpointer-arith" }
int main()
{
void *pv = 0;
pv++; // { dg-warning "forbids incrementing a pointer" }
typedef void (*pft) ();
pft pf = 0;
pf++; // { dg-warning "forbids incrementing a pointer" }
}
|
google | android | pr18016 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/pr18016.C | 253 | utf_8 | fc8649974dc36ab09d351dd258bf269d | /* { dg-do compile } */
/* { dg-options "-Wuninitialized -Winit-self" } */
class X {
int i;
X() : i(i) { } // { dg-warning "initialized with itself" }
X(int i) : i(i) { }
X(const X& x) : i(x.i) { }
};
// { dg-prune-output "In constructor" }
|
google | android | Wzero-as-null-pointer-constant-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-2.C | 464 | utf_8 | 25351c131271a50a8cfeb70c68ced525 | // PR c++/51045
// { dg-options "-Wzero-as-null-pointer-constant" }
template <typename T>
struct A
{
A() { t = new T; }
~A()
{
delete t;
}
T* t;
};
template <typename T>
struct B
{
B() { t = new T[1]; }
~B()
{
delete [] t;
}
T* t;
};
template <typename Type>
class Variant
{
Type t;
};... |
google | android | Wreturn-type-2 | .C | toolchain/gcc/gcc-4.9/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 | android | deprecated-8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/warn/deprecated-8.C | 394 | utf_8 | d045bc52a4a03d37180fee8ad8870655 | // PR c++/58305
class ToBeDeprecated {
} __attribute__ ((deprecated ("deprecated!")));
typedef ToBeDeprecated NotToBeDeprecated; // { dg-warning "'ToBeDeprecated' is deprecated" }
int main() {
ToBeDeprecated(); // { dg-warning "'ToBeDeprecated' is deprecated" }
ToBeDeprecated x; // { dg-warning "'ToBeDepr... |
google | android | Wstring-literal-comparison-3 | .C | toolchain/gcc/gcc-4.9/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 | android | Wstrict-aliasing-bogus-char-1 | .C | toolchain/gcc/gcc-4.9/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;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.