OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-src/gcc-4.2.2/gcc/testsuite/g++.dg/warn
    from Rev 149 to Rev 154
    Reverse comparison

Rev 149 → Rev 154

/Wcast-qual1.C
0,0 → 1,7
// PR c++/24667
// { dg-options "-Wcast-qual" }
 
int main(int, char**) {
const int foo[2] = {1,1};
((int*)foo)[0] = 0; // { dg-warning "cast" }
}
Wcast-qual1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: miss-format-4.C =================================================================== --- miss-format-4.C (nonexistent) +++ miss-format-4.C (revision 154) @@ -0,0 +1,32 @@ +/* Test warnings for missing format attributes on function pointers. */ +/* Origin: Kaveh Ghazi */ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-format-attribute" } */ + +#include + +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; +}
miss-format-4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pedantic1.C =================================================================== --- pedantic1.C (nonexistent) +++ pedantic1.C (revision 154) @@ -0,0 +1,11 @@ +// PR10032 +// { dg-options "-pedantic" } + +int main() { + goto label; // { dg-error "" } + + int temp = 1; // { dg-error "" } + + label: // { dg-error "" } + return 1; +}
pedantic1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wparentheses-3.C =================================================================== --- Wparentheses-3.C (nonexistent) +++ Wparentheses-3.C (revision 154) @@ -0,0 +1,13 @@ +// Test that -Wparentheses does not give bogus warnings in the +// presence of templates. Bug 17041. + +// { dg-do compile } +// { dg-options "-Wparentheses" } + +template struct A +{ + int i; + A() { if ((i = 0)) ; } +}; + +A<0> a;
Wparentheses-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-10.C =================================================================== --- Wunused-10.C (nonexistent) +++ Wunused-10.C (revision 154) @@ -0,0 +1,8 @@ +// PR c++/19190 +// { dg-options "-Wunused" } + +struct breakme +{ + void setAction( unsigned char a ) { act = a; } + unsigned int act:8; +};
Wunused-10.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: implicit-typename2.C =================================================================== --- implicit-typename2.C (nonexistent) +++ implicit-typename2.C (revision 154) @@ -0,0 +1,12 @@ +// { dg-do compile } + +// Origin: Wolfgang Bangerth + +// PR c++/11039: Implicit typename warning in friend class declaration. + +template struct X { + struct Y { + struct Z {}; + }; + friend struct Y::Z; +};
implicit-typename2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23075.C =================================================================== --- pr23075.C (nonexistent) +++ pr23075.C (revision 154) @@ -0,0 +1,9 @@ +// PR c/23075 +// { dg-do compile } +// { dg-options "-O2 -Wreturn-type" } + +int +foo (void) +{ + return; // { dg-error "with no value" } +} // { dg-bogus "control reaches end" }
pr23075.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pragma-system_header3.C =================================================================== --- pragma-system_header3.C (nonexistent) +++ pragma-system_header3.C (revision 154) @@ -0,0 +1,10 @@ +// PR c++/30500 +// { dg-options "-Wcast-align" } + +#include "pragma-system_header3.h" + +void f() +{ + g(); + h(); +}
pragma-system_header3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: effc2.C =================================================================== --- effc2.C (nonexistent) +++ effc2.C (revision 154) @@ -0,0 +1,39 @@ +// { dg-do compile } +// { dg-options "-Weffc++" } +// Contributed by Benjamin Kosnik +// PR c++/16169 : Improve -Weffc++ rule 15 + +struct A { + const A& foo(); + const A& operator=(int) + { return foo(); } +}; + +struct B { + B& foo(); + B& operator=(int) + { return foo(); } +}; + +struct C { + C& operator=(int) + { return *this; } +}; + +struct D { + D operator=(int) + { return *this; } // { dg-warning "should return a reference" } +}; + +struct E { + E& foo(); + E operator=(int) + { return foo(); } // { dg-warning "should return a reference" } +}; + +struct F +{ + operator float(); + float operator=(int) + { return *this; } // { dg-warning "should return a reference" } +};
effc2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor-dtor-privacy-2.C =================================================================== --- ctor-dtor-privacy-2.C (nonexistent) +++ ctor-dtor-privacy-2.C (revision 154) @@ -0,0 +1,7 @@ +struct C { + static bool result; +private: + static bool check(); +}; + +bool C::result = check();
ctor-dtor-privacy-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: missing-field-init-2.C =================================================================== --- missing-field-init-2.C (nonexistent) +++ missing-field-init-2.C (revision 154) @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-field-initializers" } */ + +struct s { int a, b, c; }; +struct s s1 = { 1, 2, 3 }; +struct s s2 = { 1, 2 }; /* { dg-warning "(missing initializer)|(near initialization)" } */ +struct s s3[] = { { 1, 2 }, { 4, 5 } }; /* { dg-warning "(missing initializer)|(near initialization)" } */ +struct s s4[] = { 1, 2, 3, 4, 5 }; /* { dg-warning "(missing initializer)|(near initialization)" } */ +struct s s5[] = { 1, 2, 3, 4, 5, 6 };
missing-field-init-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: no-write-strings.C =================================================================== --- no-write-strings.C (nonexistent) +++ no-write-strings.C (revision 154) @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options -Wno-write-strings } + +int main() +{ + char* p = "Asgaard"; +}
no-write-strings.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstring-literal-comparison-1.C =================================================================== --- Wstring-literal-comparison-1.C (nonexistent) +++ Wstring-literal-comparison-1.C (revision 154) @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Waddress" } */ + +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"; +} +
Wstring-literal-comparison-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: deprecated-2.C =================================================================== --- deprecated-2.C (nonexistent) +++ deprecated-2.C (revision 154) @@ -0,0 +1,11 @@ +/* Test __attribute__((deprecated)). Test merging with multiple + declarations. Bug 7425 (C++ version). */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void func(void); +void func(void) __attribute__((deprecated)); + +void f(void) { + func(); /* { dg-warning "'func' is deprecated" } */ +}
deprecated-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: deprecated.C =================================================================== --- deprecated.C (nonexistent) +++ deprecated.C (revision 154) @@ -0,0 +1,117 @@ +/* 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 "'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 "'f1' is deprecated" "f1" } */ +} + +int func2(S1 *p) +{ + S1 lp; + + if (p->field1) + return p->field2; /* { dg-warning "'field2' is deprecated" "" } */ + else if (lp.field4) /* { dg-warning "'field4' is deprecated" "" } */ + return p->field3; + + p->u1.field5 = g1 + p->field7; + p->u2.field9; /* { dg-warning "'u2' is deprecated" "" } */ + return p->u1.field6 + p->field8; /* { dg-warning "'field6' is deprecated" "" } */ + /* { dg-warning "'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; + +inline void T::member1(int) {} + +int T::member3(T *p) +{ + p->member1(1); /* { dg-warning "'member1' is deprecated" "" } */ + (*p).member1(2); /* { dg-warning "'member1' is deprecated" "" } */ + p->member2(1); /* { dg-warning "'member2' is deprecated" "" } */ + (*p).member2(2); /* { dg-warning "'member2' is deprecated" "" } */ + p->member3(p); + (*p).member3(p); + return f1(); /* { dg-warning "'f1' is deprecated" "" } */ +} +#endif + +
deprecated.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inline2.C =================================================================== --- inline2.C (nonexistent) +++ inline2.C (revision 154) @@ -0,0 +1,20 @@ +// PR c++/21627 + +template +struct TPL +{ + TPL (){} + ~TPL (){} + void method () {} +}; + +template <> TPL::TPL (); +template <> TPL::~TPL (); +template <> void TPL::method (); + +void Foo () +{ + TPL i; + i.method (); +} +
inline2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: write-strings-default.C =================================================================== --- write-strings-default.C (nonexistent) +++ write-strings-default.C (revision 154) @@ -0,0 +1,7 @@ +// { dg-do compile } +// Test the default for -Wwrite-strings + +int main() +{ + char* p = "Asgaard"; // { dg-warning "warning:.*deprecated.*" } +}
write-strings-default.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wreturn-1.C =================================================================== --- Wreturn-1.C (nonexistent) +++ Wreturn-1.C (revision 154) @@ -0,0 +1,9 @@ +// { dg-options "-Wreturn-type" } +// PR c++/15742 + +extern void exit(int) __attribute__ ((noreturn)); + +template +struct A { + int find_cmp(void) { exit(1); } +};
Wreturn-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wctor-dtor.C =================================================================== --- Wctor-dtor.C (nonexistent) +++ Wctor-dtor.C (revision 154) @@ -0,0 +1,13 @@ +// 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; +}
Wctor-dtor.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Winline-2.C =================================================================== --- Winline-2.C (nonexistent) +++ Winline-2.C (revision 154) @@ -0,0 +1,5 @@ +// PR c++/10929 +// { dg-options "-Winline -O3" } + +int foo (); +int bar () { return foo (); }
Winline-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: conversion-function-1.C =================================================================== --- conversion-function-1.C (nonexistent) +++ conversion-function-1.C (revision 154) @@ -0,0 +1,8 @@ +// Copyright (C) 2003 Free Software Foundation +// Contributed by Gabriel Dos Reis +// { dg-options "-Wno-conversion" } + +struct A { + operator A&(); +}; +
conversion-function-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wswitch-default-1.C =================================================================== --- Wswitch-default-1.C (nonexistent) +++ Wswitch-default-1.C (revision 154) @@ -0,0 +1,22 @@ +// PR C++/21123 +/* { dg-do compile } */ +/* { dg-options "-Wswitch-default" } */ + + +template +void foo( ) +{ + int i = 0; + + switch ( i ) /* { dg-bogus "switch missing default case" } */ + { + case 9: + default: + break; + } +} + +void f() +{ + foo(); +}
Wswitch-default-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: register-var-1.C =================================================================== --- register-var-1.C (nonexistent) +++ register-var-1.C (revision 154) @@ -0,0 +1,14 @@ +/* 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 "error: address of explicit register variable" } */ +}
register-var-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: format2.C =================================================================== --- format2.C (nonexistent) +++ format2.C (revision 154) @@ -0,0 +1,32 @@ +// Test for format attributes: test applying them to types in C++. +// Origin: Joseph Myers +// { dg-do compile } +// { dg-options "-Wformat" } + +__attribute__((format(printf, 1, 2))) void (*tformatprintf0) (const char *, ...); +void (*tformatprintf1) (const char *, ...) __attribute__((format(printf, 1, 2))); +void (__attribute__((format(printf, 1, 2))) *tformatprintf2) (const char *, ...); +void (__attribute__((format(printf, 1, 2))) ****tformatprintf3) (const char *, ...); + +char * (__attribute__((format_arg(1))) *tformat_arg) (const char *); + +void +baz (int i) +{ + (*tformatprintf0) ("%d", i); + (*tformatprintf0) ((*tformat_arg) ("%d"), i); + (*tformatprintf0) ("%"); // { dg-warning "format" "prefix" } + (*tformatprintf0) ((*tformat_arg) ("%")); // { dg-warning "format" "prefix" } + (*tformatprintf1) ("%d", i); + (*tformatprintf1) ((*tformat_arg) ("%d"), i); + (*tformatprintf1) ("%"); // { dg-warning "format" "postfix" } + (*tformatprintf1) ((*tformat_arg) ("%")); // { dg-warning "format" "postfix" } + (*tformatprintf2) ("%d", i); + (*tformatprintf2) ((*tformat_arg) ("%d"), i); + (*tformatprintf2) ("%"); // { dg-warning "format" "nested" } + (*tformatprintf2) ((*tformat_arg) ("%")); // { dg-warning "format" "nested" } + (****tformatprintf3) ("%d", i); + (****tformatprintf3) ((*tformat_arg) ("%d"), i); + (****tformatprintf3) ("%"); // { dg-warning "format" "nested 2" } + (****tformatprintf3) ((*tformat_arg) ("%")); // { dg-warning "format" "nested 2" } +}
format2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noreturn-2.C =================================================================== --- noreturn-2.C (nonexistent) +++ noreturn-2.C (revision 154) @@ -0,0 +1,4 @@ +// { dg-options "-Wall" } + +template +int f (T t) { } // { dg-warning "no return" }
noreturn-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noeffect5.C =================================================================== --- noeffect5.C (nonexistent) +++ noeffect5.C (revision 154) @@ -0,0 +1,8 @@ +/* PR middle-end/13325 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n); +void f (void *dest, const void *src) { + memcpy (dest, src, 0); +}
noeffect5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: incomplete1.C =================================================================== --- incomplete1.C (nonexistent) +++ incomplete1.C (revision 154) @@ -0,0 +1,21 @@ +// { 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" "" } + return 0; +}
incomplete1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstrict-aliasing-1.C =================================================================== --- Wstrict-aliasing-1.C (nonexistent) +++ Wstrict-aliasing-1.C (revision 154) @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing=2 -O2" } */ + +double x; +int *foo(void) +{ + return (int *)&x; /* { dg-warning "strict-aliasing" } */ +} +
Wstrict-aliasing-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wreturn-type-1.C =================================================================== --- Wreturn-type-1.C (nonexistent) +++ Wreturn-type-1.C (revision 154) @@ -0,0 +1,11 @@ +// PR c++/11725 +// { dg-options "-Wreturn-type" } + +template +struct A +{ + int foo() + { + throw "Stop"; + } +};
Wreturn-type-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wsequence-point-1.C =================================================================== --- Wsequence-point-1.C (nonexistent) +++ Wsequence-point-1.C (revision 154) @@ -0,0 +1,11 @@ +// { dg-do compile } +// { dg-options "-Wsequence-point" } +struct C +{ + ~C() throw(); +}; + +void t_test1 (C* mapping) +{ + delete [] mapping; +}
Wsequence-point-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstrict-aliasing-5.C =================================================================== --- Wstrict-aliasing-5.C (nonexistent) +++ Wstrict-aliasing-5.C (revision 154) @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing=2 -O2" } */ + +float foo () +{ + unsigned int MASK = 0x80000000; + return (float &) MASK; /* { dg-warning "strict-aliasing" } */ +} +
Wstrict-aliasing-5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: conv1.C =================================================================== --- conv1.C (nonexistent) +++ conv1.C (revision 154) @@ -0,0 +1,33 @@ +// { dg-do compile } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 20 Apr 2003 + +// 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; +}
conv1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21983.C =================================================================== --- pr21983.C (nonexistent) +++ pr21983.C (revision 154) @@ -0,0 +1,7 @@ +// PR c++/21983 +// { dg-do compile } + +struct B { virtual void foo () = 0; }; +struct D1 : public virtual B { virtual void foo () {} }; +struct D2 : public virtual B { virtual void foo () {} }; +struct D : public D1, public D2 { }; // { dg-warning "no unique final overrider" }
pr21983.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pragma-system_header3.h =================================================================== --- pragma-system_header3.h (nonexistent) +++ pragma-system_header3.h (revision 154) @@ -0,0 +1,7 @@ +#pragma GCC system_header + +template + int* g() { static char c; return reinterpret_cast(&c); } + +template + T* h() { static char c; return reinterpret_cast(&c); }
pragma-system_header3.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: huge-val1.C =================================================================== --- huge-val1.C (nonexistent) +++ huge-val1.C (revision 154) @@ -0,0 +1,33 @@ +// PR c++/23139: HUGE_VAL definition should be accepted with -pedantic. +// Origin: Joseph Myers +// { dg-do link } +// { dg-options "-pedantic-errors" } + +#include + +double d = HUGE_VAL; +#ifdef HUGE_VALF +float f = HUGE_VALF; +#endif +#ifdef HUGE_VALL +long double l = HUGE_VALL; +#endif + +extern void link_failure (); + +int +main () +{ +#ifdef __GLIBC__ + if (HUGE_VAL != __builtin_huge_val ()) + link_failure (); +#ifdef HUGE_VALF + if (HUGE_VALF != __builtin_huge_valf ()) + link_failure (); +#endif +#ifdef HUGE_VALL + if (HUGE_VALL != __builtin_huge_vall ()) + link_failure (); +#endif +#endif +}
huge-val1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-3.C =================================================================== --- Wunused-3.C (nonexistent) +++ Wunused-3.C (revision 154) @@ -0,0 +1,11 @@ +// { dg-do compile } +// { dg-options "-Wunused -O" } + +void do_cleanups(); + +class Cleanup { +public: + ~Cleanup() { do_cleanups();} +}; + +static Cleanup dummy;
Wunused-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-7.C =================================================================== --- Wunused-7.C (nonexistent) +++ Wunused-7.C (revision 154) @@ -0,0 +1,12 @@ +// PR c++/14481 +// { dg-options "-Wunused" } + +void func() +{ + struct mybitfields { + unsigned int s_field:8; + }; + struct mybitfields s; + s.s_field = 255; +}; +
Wunused-7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: miss-format-1.C =================================================================== --- miss-format-1.C (nonexistent) +++ miss-format-1.C (revision 154) @@ -0,0 +1,41 @@ +/* Test for warnings for missing format attributes. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-format-attribute" } */ +/* { dg-error "not declared" "" { target *-*-solaris2.5.1 *-*-solaris2.[5-8] } 24 } */ + +#include +#include + +void +foo (const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + vprintf (fmt, ap); /* { dg-warning "candidate" "printf attribute warning" } */ + va_end (ap); +} + +void +bar (const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-solaris2.5.1 *-*-solaris2.[5-8] } } */ + va_end (ap); +} + +__attribute__((__format__(__printf__, 1, 2))) void +foo2 (const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + vprintf (fmt, ap); + va_end (ap); +} + +void +vfoo (const char *fmt, va_list arg) +{ + vprintf (fmt, arg); /* { dg-warning "candidate" "printf attribute warning 2" } */ +}
miss-format-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unused-result1.C =================================================================== --- unused-result1.C (nonexistent) +++ unused-result1.C (revision 154) @@ -0,0 +1,10 @@ +// 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" } +};
unused-result1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: miss-format-5.C =================================================================== --- miss-format-5.C (nonexistent) +++ miss-format-5.C (revision 154) @@ -0,0 +1,48 @@ +/* Test warnings for missing format attributes on function pointers. */ +/* Origin: Kaveh Ghazi */ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-format-attribute" } */ + +#include + +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; +}
miss-format-5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor-init-1.C =================================================================== --- ctor-init-1.C (nonexistent) +++ ctor-init-1.C (revision 154) @@ -0,0 +1,9 @@ +// PR c++/11554 +// { dg-options "-Wall" } + +struct Y { + Y (); + int i1, i2; // { dg-warning "" } +}; + +Y::Y () : i2(0), i1(0) {} // { dg-warning "" }
ctor-init-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunreachable-code-1.C =================================================================== --- Wunreachable-code-1.C (nonexistent) +++ Wunreachable-code-1.C (revision 154) @@ -0,0 +1,22 @@ +/* PR17544 Incorrect -Wunreachable-code warning + Origin: sebor@roguewave.com + + G++ appends a "return 0;" when finishing a function, but it was not + given a source location. The gimplifier thinks a return statement + needs a locus so it would add one, making the compiler generated code + visible to the unreachable code warning. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wunreachable-code" } */ + +int +main (int argc, char *argv[]) +{ + const char* const s = argc < 2 ? "" : argv [1]; + int i = 0; + do { + ++i; + } while (i < s [0]); + return i; +} +
Wunreachable-code-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wbraces1.C =================================================================== --- Wbraces1.C (nonexistent) +++ Wbraces1.C (revision 154) @@ -0,0 +1,3 @@ +// PR c++/19755 +// { dg-options "-Wmissing-braces" } +int a[2][2] = { 0, 1 , 2, 3 }; // { dg-warning "" }
Wbraces1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: weak1.C =================================================================== --- weak1.C (nonexistent) +++ weak1.C (revision 154) @@ -0,0 +1,15 @@ +// The PA HP-UX dynamic loader doesn't support unsatisfied weak symbols. +// { dg-do run } +// { dg-require-weak "" } +// { dg-skip-if "No unsat" { hppa*-*-hpux* } { "*" } { "" } } + +extern void foo (void) __attribute__ ((weak)); + +int +main () +{ + if (&foo) + foo (); + + return 0; +}
weak1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wparentheses-4.C =================================================================== --- Wparentheses-4.C (nonexistent) +++ Wparentheses-4.C (revision 154) @@ -0,0 +1,19 @@ +// Test that -Wparentheses does not give bogus warnings in the +// presence of templates for non-plain assignment. Bug 17120. + +// { dg-do compile } +// { dg-options "-Wparentheses" } + +template + inline _Tp + cmath_power(_Tp __x, unsigned int __n) + { + while (__n >>= 1) + ; + return __x; + } + +int main() +{ + cmath_power(1.0, 3); +}
Wparentheses-4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-11.C =================================================================== --- Wunused-11.C (nonexistent) +++ Wunused-11.C (revision 154) @@ -0,0 +1,11 @@ +// PR c++/20212 +// { dg-options "-O2 -Wunused -Wextra" } + +template void f(int); +void g(int i) +{ + f<0>(i); +} +template void f(int i __attribute__((unused)) ) +{} +
Wunused-11.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: implicit-typename3.C =================================================================== --- implicit-typename3.C (nonexistent) +++ implicit-typename3.C (revision 154) @@ -0,0 +1,12 @@ +// { dg-do compile } + +// Origin: Wolfgang Bangerth + +// PR c++/11039: Implicit typename warning in friend class declaration. + +template struct X { + struct Y { + struct Z {}; + }; + template friend struct Y::Z f(U); +};
implicit-typename3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: main-2.C =================================================================== --- main-2.C (nonexistent) +++ main-2.C (revision 154) @@ -0,0 +1,19 @@ +// { dg-do compile } +// Make sure that the type of f1 does not change +// after the error of main about not returning +// int. +// From Pekka Vuorela +// PR c++/23229 + +void f1(); + +void +main() /* { dg-error "must return" } */ +{ + f1(); +} + +void f1() +{ +} +
main-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: main.C =================================================================== --- main.C (nonexistent) +++ main.C (revision 154) @@ -0,0 +1,11 @@ +// { dg-do compile } + +// Origin: Donald W. Gillies + +// PR c++/4494: Incorrect diagnostics about return type of main. + +typedef int int_t; + +int_t main() { + +}
main.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: effc3.C =================================================================== --- effc3.C (nonexistent) +++ effc3.C (revision 154) @@ -0,0 +1,58 @@ +// { dg-do compile } +// { dg-options "-Weffc++" } +// Contributed by Benjamin Kosnik +// PR c++/16165 and PR c++/8211: Improve item 11 of -Weffc++ + + +// We should not warn for this class since this kind of pointers can +// never hold dynamic memory. +struct A { + void (*func1)(void); + void (A::*func2)(void); + int A::*func3; + + int a; + void b(void); + + A(); + ~A(); +}; + +// We do not warn for this class because there is no destructor, so we +// assume there is no dynamic memory allocated (it could point to a +// global variable). +struct B { + int *ptr; + B(); +}; + + +// We should emit a warning for these +struct C1 { // { dg-warning "" "" } + int *ptr; + C1(); + ~C1(); +}; + +struct C2 { // { dg-warning "" "" } + int *ptr; + C2(); + C2(const C2&); + ~C2(); +}; + +struct C3 { // { dg-warning "" "" } + int *ptr; + C3(); + ~C3(); + C3& operator=(const C3&); +}; + +// But not for this +struct C4 { + int *ptr; + C4(); + C4(const C4&); + ~C4(); + C4& operator=(const C4&); +};
effc3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wconversion1.C =================================================================== --- Wconversion1.C (nonexistent) +++ Wconversion1.C (revision 154) @@ -0,0 +1,12 @@ +// { dg-options "-fsigned-char -Wconversion" } + +char c1 = 1024; // { dg-warning "overflow" } +char c2 = char(1024); +char c3 = (char) 1024; +char c4 = static_cast(1024); + +unsigned char uc1 = -129; // { dg-warning "unsigned" } + +bool b1 = -3; + +int i1 = 0x80000000;
Wconversion1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstring-literal-comparison-2.C =================================================================== --- Wstring-literal-comparison-2.C (nonexistent) +++ Wstring-literal-comparison-2.C (revision 154) @@ -0,0 +1,29 @@ +/* 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"; +} +
Wstring-literal-comparison-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: var-args1.C =================================================================== --- var-args1.C (nonexistent) +++ var-args1.C (revision 154) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +#include + +void foo(int, ...) +{ + va_list va; + int i; + i = va_arg(va, int&); /* { dg-warning "cannot receive objects" } */ +} +
var-args1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Winline-3.C =================================================================== --- Winline-3.C (nonexistent) +++ Winline-3.C (revision 154) @@ -0,0 +1,10 @@ +// { dg-options "-Winline -O" } + +#include + +using namespace std; + +int main(void) +{ + vector v(10); +}
Winline-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wreturn-2.C =================================================================== --- Wreturn-2.C (nonexistent) +++ Wreturn-2.C (revision 154) @@ -0,0 +1,7 @@ +// { dg-do compile } +int foo(int first) { + while (true) { + return first; + } +} // { dg-bogus "control reaches" } +
Wreturn-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: register-var-2.C =================================================================== --- register-var-2.C (nonexistent) +++ register-var-2.C (revision 154) @@ -0,0 +1,14 @@ +/* PR/18160 */ + +/* { dg-do compile } */ + +/* This should yield an error even without -pedantic. */ +/* { dg-options "-Wall -W" } */ + +void g(int *); + +void f(void) +{ + register int x; + g(&x); /* { dg-warning "address requested for 'x', which is declared 'register'" } */ +}
register-var-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wswitch-default-2.C =================================================================== --- Wswitch-default-2.C (nonexistent) +++ Wswitch-default-2.C (revision 154) @@ -0,0 +1,21 @@ +// PR C++/21123 +/* { dg-do compile } */ +/* { dg-options "-Wswitch-default" } */ + + +template +void foo( ) +{ + int i = 0; + + switch ( i ) /* { dg-warning "switch missing default case" } */ + { + case 9: + break; + } +} + +void f() +{ + foo(); +}
Wswitch-default-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wshadow-1.C =================================================================== --- Wshadow-1.C (nonexistent) +++ Wshadow-1.C (revision 154) @@ -0,0 +1,41 @@ +/* Copyright (C) 2001, 2002 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options -Wshadow } */ + +/* Source: Neil Booth, 3 Nov 2001, and PR 16, 713. -Wshadow was + giving a bunch of warnings we didn't want, and wasn't giving the + location of the shadowed variable. */ + +struct status // { dg-bogus "shadowed declaration" } +{ + int member; + void foo2 (); + + inline static int foo3 (int member) // { dg-bogus "shadows" } + { + return member; + } +}; + +int decl1; // { dg-warning "shadowed declaration" } +int decl2; // { dg-warning "shadowed declaration" } +void foo (struct status &status,// { dg-bogus "shadows a global decl" } + double decl1) // { dg-warning "shadows a global decl" } +{ +} + +void foo1 (int d) +{ + double d; // { dg-error "shadows a parameter" } +} + +void status::foo2 () +{ + int member; // { dg-warning "shadows a member" } + int decl2; // { dg-warning "shadows a global decl" } + int local; // { dg-warning "shadowed declaration" } + { + int local; // { dg-warning "shadows a previous local" } + } +}
Wshadow-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: format3.C =================================================================== --- format3.C (nonexistent) +++ format3.C (revision 154) @@ -0,0 +1,12 @@ +// 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; +} +
format3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noeffect2.C =================================================================== --- noeffect2.C (nonexistent) +++ noeffect2.C (revision 154) @@ -0,0 +1,20 @@ +// { dg-do compile } +// { dg-options "-Wall" } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 18 Aug 2003 +// Origin PR 11945 gerald@pfeifer.com + +// PR 11945 inconsistent warnings + +extern "C" void FormatDisk(); + template + struct C { + C(){ FormatDisk(), 0; } // { dg-warning "right-hand operand of comma" "" } + }; + template struct C; // { dg-warning "instantiated" } + template + void f() { FormatDisk(), 0; } // { dg-warning "right-hand operand of comma" "" } + template void f (); // { dg-warning "instantiated" } +void g() { FormatDisk(), 0; } // { dg-warning "right-hand operand of comma" "" } +
noeffect2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noreturn-3.C =================================================================== --- noreturn-3.C (nonexistent) +++ noreturn-3.C (revision 154) @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-Wall" } + +// Origin: stip@mathematik.uni-ulm.de +// Andrew Pinski + +// PR c++/13106: No return warning when return type is a dependent type. + +template T dummy() { } + +int main() { + dummy(); +}
noreturn-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noeffect6.C =================================================================== --- noeffect6.C (nonexistent) +++ noeffect6.C (revision 154) @@ -0,0 +1,14 @@ +// { dg-options "-Wall" } +// PR c++/15083 + +extern "C" int printf(const char*,...); +struct Counter { + Counter(){printf("Hello World.\n");} +}; +template< typename T > +void resetData() { + new Counter(); +} +int main() { + resetData(); +}
noeffect6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstrict-aliasing-2.C =================================================================== --- Wstrict-aliasing-2.C (nonexistent) +++ Wstrict-aliasing-2.C (revision 154) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing=2 -O2" } */ + +double x; + +template +T *foo(void) +{ + return (T *)&x; /* { dg-bogus "strict-aliasing" } */ +} + +template double *foo(void); +
Wstrict-aliasing-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wreturn-type-2.C =================================================================== --- Wreturn-type-2.C (nonexistent) +++ Wreturn-type-2.C (revision 154) @@ -0,0 +1,20 @@ +// 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; +}
Wreturn-type-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wswitch-1.C =================================================================== --- Wswitch-1.C (nonexistent) +++ Wswitch-1.C (revision 154) @@ -0,0 +1,63 @@ +/* PR c/4475, PR c++/3780 */ +/* { dg-do compile } */ +/* { dg-options "-Wswitch" } */ + +enum e { e1, e2 }; + +int +foo (int i, int j, enum e ei, enum e ej, enum e ek, enum e el, + enum e em, enum e en, enum e eo, enum e ep) +{ + switch (i) + { + case 1: return 1; + case 2: return 2; + } + switch (j) + { + case 3: return 4; + case 4: return 3; + default: break; + } + switch (ei) /* { dg-warning "enumeration value 'e1' not handled in switch" "enum e1" } */ + { /* { dg-warning "enumeration value 'e2' not handled in switch" "enum e2" { target *-*-* } 22 } */ + } + switch (ej) + { + default: break; + } + switch (ek) /* { dg-warning "enumeration value 'e2' not handled in switch" "enum e2" } */ + { + case e1: return 1; + } + switch (el) + { + case e1: return 1; + default: break; + } + switch (em) + { + case e1: return 1; + case e2: return 2; + } + switch (en) + { + case e1: return 1; + case e2: return 2; + default: break; + } + switch (eo) + { + case e1: return 1; + case e2: return 2; + case 3: return 3; /* { dg-warning "case value '3' not in enumerated type 'e'" "excess 3" } */ + } + switch (ep) + { + case e1: return 1; + case e2: return 2; + case 3: return 3; + default: break; + } /* Since there is a default, no warning about ``case 3'' */ + return 0; +}
Wswitch-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: conv2.C =================================================================== --- conv2.C (nonexistent) +++ conv2.C (revision 154) @@ -0,0 +1,4 @@ +// PR c++/13932 +// { dg-options "-Wconversion" } + +int i = 1.; // { dg-warning "converting" }
conv2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstrict-aliasing-6.C =================================================================== --- Wstrict-aliasing-6.C (nonexistent) +++ Wstrict-aliasing-6.C (revision 154) @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing=2 -O2" } */ + +int foo () +{ + char buf[8]; + return *((int *)buf); /* { dg-warning "strict-aliasing" } */ +} +
Wstrict-aliasing-6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: empty-body.C =================================================================== --- empty-body.C (nonexistent) +++ empty-body.C (revision 154) @@ -0,0 +1,12 @@ +// PR c++/5520 +// { dg-options "-O2 -Wextra" } + +void breakme() +{ + if(1) ; // { dg-warning "empty body" } + if(1) {} // { dg-bogus "empty body" } + if(1) (void)0; // { dg-bogus "empty body" } + if(1) {} else; // { dg-warning "empty body" } + if(1) {} else (void)0; // // { dg-bogus "empty body" } + if(1) ; else (void)0; // // { dg-bogus "empty body" } +}
empty-body.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: private1.C =================================================================== --- private1.C (nonexistent) +++ private1.C (revision 154) @@ -0,0 +1,16 @@ +// g++ should not complain about A having private [cd]tors. + +class A +{ + A(); + ~A(); +public: + int dummy(); // needed to get bogus warning + static A* get_A (); +}; + +A* A::get_A() +{ + static A a; + return &a; +}
private1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-4.C =================================================================== --- Wunused-4.C (nonexistent) +++ Wunused-4.C (revision 154) @@ -0,0 +1,30 @@ +// { dg-do compile } +// { dg-options "-Wunused-parameter" } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 15 Sep 2003 +// Origin: yotamm@mellanox.co.il + + +// PR c++/9848. Missing warning + +struct C1 { + // Only use in-charge ctor + C1(int bi) {} // { dg-warning "unused parameter" "" } +}; +struct C2 { + // Only use base ctor + C2(int bi) {} // { dg-warning "unused parameter" "" } +}; + +struct D : C2 +{ + D (int) : C2 (1) {} +}; + +void show_compile_warning () +{ + C1 c1 (1); + + D d (1); +}
Wunused-4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wdiv-by-zero.C =================================================================== --- Wdiv-by-zero.C (nonexistent) +++ Wdiv-by-zero.C (revision 154) @@ -0,0 +1,7 @@ +// test that division by zero warnings are enabled by default +int breakme() +{ + int x = 0; + x /= 0; // { dg-warning "division by" } + return x; +}
Wdiv-by-zero.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-8.C =================================================================== --- Wunused-8.C (nonexistent) +++ Wunused-8.C (revision 154) @@ -0,0 +1,9 @@ +// 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" } +}
Wunused-8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: miss-format-2.C =================================================================== --- miss-format-2.C (nonexistent) +++ miss-format-2.C (revision 154) @@ -0,0 +1,17 @@ +/* Test for warnings for missing format attributes. Don't warn if no + relevant parameters for a format attribute; see c/1017. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-format-attribute" } */ + +#include +#include + +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); +}
miss-format-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wnvdtor.C =================================================================== --- Wnvdtor.C (nonexistent) +++ Wnvdtor.C (revision 154) @@ -0,0 +1,10 @@ +// { dg-options "-Wnon-virtual-dtor" } + +extern "Java" +{ + class Foo + { + public: + virtual void bar( void); + }; +}
Wnvdtor.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: miss-format-6.C =================================================================== --- miss-format-6.C (nonexistent) +++ miss-format-6.C (revision 154) @@ -0,0 +1,31 @@ +/* Test warnings for missing format attributes on function pointers. */ +/* Origin: Kaveh Ghazi */ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-format-attribute" } */ + +#include + +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); +}
miss-format-6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wparentheses-1.C =================================================================== --- Wparentheses-1.C (nonexistent) +++ Wparentheses-1.C (revision 154) @@ -0,0 +1,68 @@ +// Test operation of -Wparentheses. Warnings for assignments used as +// truth-values. Essentially the same as gcc.dg/Wparentheses-3.c. +// Origin: Joseph Myers + +// { 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); + 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); +}
Wparentheses-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunreachable-code-2.C =================================================================== --- Wunreachable-code-2.C (nonexistent) +++ Wunreachable-code-2.C (revision 154) @@ -0,0 +1,23 @@ +// 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; +}
Wunreachable-code-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wbraces2.C =================================================================== --- Wbraces2.C (nonexistent) +++ Wbraces2.C (revision 154) @@ -0,0 +1,15 @@ +// PR c++/20175 +// { dg-options "-Wmissing-braces" } +int a[2][2] = { 0, 1, 2, 3 }; // { dg-warning "missing braces" } +int b[2][2] = { { 0, 1 }, { 2, 3 } }; +int c[2][2] = { { { 0 }, 1 }, { 2, 3 } }; // { dg-error "braces around scalar" } +struct S { char s[6]; int i; }; +S d = { "hello", 1 }; +S e = { { "hello" }, 1 }; +S f = { { { "hello" } }, 1 }; // { dg-error "braces around scalar" } +S g = { 'h', 'e', 'l', 'l', 'o', '\0', 1 }; // { dg-warning "missing braces" } +struct T { wchar_t s[6]; int i; }; +T i = { L"hello", 1 }; +T j = { { L"hello" }, 1 }; +T k = { { { L"hello" } }, 1 }; // { dg-error "braces around scalar" } +T l = { L'h', L'e', L'l', L'l', L'o', L'\0', 1 };// { dg-warning "missing braces" }
Wbraces2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wsign-compare-1.C =================================================================== --- Wsign-compare-1.C (nonexistent) +++ Wsign-compare-1.C (revision 154) @@ -0,0 +1,6 @@ +// { dg-options "-Wsign-compare" } + +extern unsigned u; + +template +int f() { return u > 1; }
Wsign-compare-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-12.C =================================================================== --- Wunused-12.C (nonexistent) +++ Wunused-12.C (revision 154) @@ -0,0 +1,8 @@ +// PR c++/24302 +// { dg-options "-Wunused" } + +static union +{ + unsigned char FLT4ARR[4]; + float FLT4; +}; // { dg-warning "used" }
Wunused-12.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wdtor1.C =================================================================== --- Wdtor1.C (nonexistent) +++ Wdtor1.C (revision 154) @@ -0,0 +1,22 @@ +// PR c++/20145 +// { dg-options "-Wnon-virtual-dtor" } +# 1 "t.cc" +# 1 "" +# 1 "" +# 1 "t.cc" +# 1 "include/t.h" 1 3 4 +// Declare the template with explicit C++ linkage in case system +// headers have implicit C linkage. +extern "C++" { +template class t +{ + virtual void f(); +}; +} +# 2 "t.cc" 2 + +void f(void) +{ + t<1> h; +} +
Wdtor1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: main-3.C =================================================================== --- main-3.C (nonexistent) +++ main-3.C (revision 154) @@ -0,0 +1,7 @@ +// PR c++/29735 +// { dg-do compile } + +int __attribute__ ((vector_size (8))) main () // { dg-error "must return" } +{ + return 0; +}
main-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wreorder-1.C =================================================================== --- Wreorder-1.C (nonexistent) +++ Wreorder-1.C (revision 154) @@ -0,0 +1,14 @@ +// { 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 () {} // { dg-warning "copy" } +};
Wreorder-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstring-literal-comparison-3.C =================================================================== --- Wstring-literal-comparison-3.C (nonexistent) +++ Wstring-literal-comparison-3.C (revision 154) @@ -0,0 +1,29 @@ +/* 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"; +} +
Wstring-literal-comparison-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf1.C =================================================================== --- pmf1.C (nonexistent) +++ pmf1.C (revision 154) @@ -0,0 +1,18 @@ +// { dg-do compile } + +// Origin: benko@sztaki.hu + +// PR c++/10496: Incorrect pointer to member function diagnostics +// for constant member functions. + +struct a +{ + int f() const; +}; + + +int +a::f() const +{ + int (a::* b)() const = &f; // { dg-error "&a::f" } +}
pmf1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wchar-subscripts.C =================================================================== --- Wchar-subscripts.C (nonexistent) +++ Wchar-subscripts.C (revision 154) @@ -0,0 +1,12 @@ +/* Copyright (C) 2005 Free Software Foundation. + + by Gabriel Dos Reis */ + +// { dg-do compile } +// { dg-options "-Wchar-subscripts" } + +int main() +{ + int ary[256] = { 0 }; + return ary['a']; +}
Wchar-subscripts.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Winline-4.C =================================================================== --- Winline-4.C (nonexistent) +++ Winline-4.C (revision 154) @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-O2 -Winline" } +// Origin: +// 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; +}
Winline-4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wreturn-3.C =================================================================== --- Wreturn-3.C (nonexistent) +++ Wreturn-3.C (revision 154) @@ -0,0 +1,18 @@ +// { 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); +}
Wreturn-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Woverloaded-1.C =================================================================== --- Woverloaded-1.C (nonexistent) +++ Woverloaded-1.C (revision 154) @@ -0,0 +1,17 @@ +/* { dg-options "-Woverloaded-virtual" } */ + +class Base { +public: + virtual ~Base() { + } +}; + +class Derived: public Base { +public: + int Base() { // There should be no error here. + return 5; + } +}; + +int main() { +}
Woverloaded-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: template-1.C =================================================================== --- template-1.C (nonexistent) +++ template-1.C (revision 154) @@ -0,0 +1,15 @@ +//Origin: bangerth@dealii.org +//PR c++/11490 +//Since N is know at instantiation time, there +// should be no warning about comparision between +// unsinged and signed interegers. + +// { dg-do compile } +// { dg-options "-W" } + +template bool f() { + unsigned int i=0; + return i!=N; // { dg-bogus "signed and unsigned" } +} + +template bool f<2> ();
template-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wshadow-2.C =================================================================== --- Wshadow-2.C (nonexistent) +++ Wshadow-2.C (revision 154) @@ -0,0 +1,10 @@ +/* { dg-options "-Wshadow" } */ + +struct A { + void a1 () { + struct B { B() {} }; // There should be no warning here. + } + void a2 () { + struct B { }; + } +};
Wshadow-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: format4.C =================================================================== --- format4.C (nonexistent) +++ format4.C (revision 154) @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-Wformat=2" } + +extern "C" int printf (const char*, ...); + +void foo(int i) +{ + printf("Hello World %d!\n", i); + printf(&"Hello World %d!\n"[0], i); + printf(&"Hello World %d!\n"[6], i); + printf(&"Hello World %d!\n"[8]-2, i); + printf(&"Hello World %d!\n"[4]+2, i); +}
format4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noeffect7.C =================================================================== --- noeffect7.C (nonexistent) +++ noeffect7.C (revision 154) @@ -0,0 +1,8 @@ +// PR c++/8057 +// Don't give a "statement has no effect" warning when declaring a +// template, only when instantiating it. +// { dg-do compile } +// { dg-options "-Wunused" } +struct Y { static int i; }; +template class X { X() { Y::i; }; }; +class Z { Z() { Y::i; }; }; // { dg-warning "no effect" }
noeffect7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sentinel.C =================================================================== --- sentinel.C (nonexistent) +++ sentinel.C (revision 154) @@ -0,0 +1,11 @@ +/* { 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" } */ +}
sentinel.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstrict-aliasing-3.C =================================================================== --- Wstrict-aliasing-3.C (nonexistent) +++ Wstrict-aliasing-3.C (revision 154) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing=2 -O2" } */ + +double x; + +template +T *foo(void) +{ + return (T *)&x; /* { dg-warning "strict-aliasing" } */ +} + +template int *foo(void); /* { dg-warning "instantiated from here" } */ +template char *foo(void); /* { dg-bogus "instantiated from here" } */ +
Wstrict-aliasing-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wreturn-type-3.C =================================================================== --- Wreturn-type-3.C (nonexistent) +++ Wreturn-type-3.C (revision 154) @@ -0,0 +1,14 @@ +// PR middle-end/19583 +// { dg-options "-Wreturn-type -O" } + +struct E{}; + +inline int bar() throw(E) +{ + return 0; +} + +void foo () +{ + bar(); +}
Wreturn-type-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wswitch-2.C =================================================================== --- Wswitch-2.C (nonexistent) +++ Wswitch-2.C (revision 154) @@ -0,0 +1,31 @@ +/* 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; +}
Wswitch-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: conv3.C =================================================================== --- conv3.C (nonexistent) +++ conv3.C (revision 154) @@ -0,0 +1,4 @@ +// PR c++/19457 + +int i=-1; +unsigned int j= ~0; // { dg-bogus "" }
conv3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-1.C =================================================================== --- Wunused-1.C (nonexistent) +++ Wunused-1.C (revision 154) @@ -0,0 +1,15 @@ +// Test whether -Wunused handles empty classes the same as non-empty. +// { dg-do compile } +// { dg-options "-Wunused" } + +struct A {}; +struct B { char c; }; + +void foo () +{ + struct A a0, a1; + struct B b0, b1 = { 25 }; + + a0 = a1; // { dg-bogus "value computed is not used" } + b0 = b1; +}
Wunused-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstrict-aliasing-7.C =================================================================== --- Wstrict-aliasing-7.C (nonexistent) +++ Wstrict-aliasing-7.C (revision 154) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing -O2" } */ + +int a[2]; + +double *foo1(void) +{ + return (double *)a; /* { dg-warning "strict-aliasing" } */ +} + +double *foo2(void) +{ + return (double *)&a[0]; /* { dg-warning "strict-aliasing" } */ +} + +__complex__ double x; +int *bar(void) +{ + return (int *)&__imag__ x; /* { dg-warning "strict-aliasing" } */ +}
Wstrict-aliasing-7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-5.C =================================================================== --- Wunused-5.C (nonexistent) +++ Wunused-5.C (revision 154) @@ -0,0 +1,19 @@ +/* PR opt/14288 */ +/* { dg-do compile } */ +/* { dg-options "-O -Wall" } */ + +volatile int sink; +extern int foo(int); + +struct S +{ + int x; + + S() { x = foo(0); } + ~S() { sink = x; } +}; + +int test(bool p) +{ + return p ? foo(S().x) : 0; /* { dg-bogus "uninitialized" } */ +}
Wunused-5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-9.C =================================================================== --- Wunused-9.C (nonexistent) +++ Wunused-9.C (revision 154) @@ -0,0 +1,38 @@ +// PR c++/11224 +// { dg-options "-Wunused" } + +struct someclass { + + bool isEmpty() const { return true; } +}; + +int main() +{ + bool bOk = false; + someclass foo; + + bOk == foo.isEmpty(); // { dg-warning "not used" } + + return bOk; +} + +int& f(); + +void g() { + f() == 0; // { dg-warning "not used" } + f() != 1; // { dg-warning "not used" } + f() < 2; // { dg-warning "not used" } + f() > 3; // { dg-warning "not used" } + f() <= 4; // { dg-warning "not used" } + f() >= 5; // { dg-warning "not used" } + f() + 6; // { dg-warning "not used" } + f() - 7; // { dg-warning "not used" } + f() * 8; // { dg-warning "not used" } + f() / 9; // { dg-warning "not used" } + +f(); // { dg-warning "not used" } + -f(); // { dg-warning "not used" } + ++f(); + --f(); + f() = 10; + f() <<= 11; +}
Wunused-9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: volatile1.C =================================================================== --- volatile1.C (nonexistent) +++ volatile1.C (revision 154) @@ -0,0 +1,12 @@ +// PR c++/26577 + +struct A +{ + A(const A&); + A& operator=(const A&); + void baz() volatile; +}; +void A::baz() volatile +{ + *this; // { dg-warning "will not be accessed" } +}
volatile1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: miss-format-3.C =================================================================== --- miss-format-3.C (nonexistent) +++ miss-format-3.C (revision 154) @@ -0,0 +1,26 @@ +/* Test warnings for missing format attributes on function pointers. */ +/* Origin: Kaveh Ghazi */ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-format-attribute" } */ + +#include + +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 = na; + noattr_t na2 = a; /* { dg-warning "candidate" "initialization warning" } */ + attr_t a1 = na; + attr_t a2 = a; + + vnoattr_t vna1 = vna; + vnoattr_t vna2 = va; /* { dg-warning "candidate" "initialization warning" } */ + vattr_t va1 = vna; + vattr_t va2 = va; +}
miss-format-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nonnull1.C =================================================================== --- nonnull1.C (nonexistent) +++ nonnull1.C (revision 154) @@ -0,0 +1,16 @@ +// Test that "nonnull" attribute works for C++. +// Origin: Joseph Myers +// { 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 +g () +{ + f (0); // { dg-warning "null" "null argument" } +}
nonnull1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: compare1.C =================================================================== --- compare1.C (nonexistent) +++ compare1.C (revision 154) @@ -0,0 +1,10 @@ +/* -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" } */ +}
compare1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: friend.C =================================================================== --- friend.C (nonexistent) +++ friend.C (revision 154) @@ -0,0 +1,14 @@ +/* { 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);
friend.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wparentheses-2.C =================================================================== --- Wparentheses-2.C (nonexistent) +++ Wparentheses-2.C (revision 154) @@ -0,0 +1,43 @@ +// 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. +// Origin: Joseph Myers + +// { 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); +}
Wparentheses-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Weff1.C =================================================================== --- Weff1.C (nonexistent) +++ Weff1.C (revision 154) @@ -0,0 +1,5 @@ +// { dg-options "-Weffc++" } + +struct S {}; +/* Base classes should have virtual destructors. */ +struct T : public S {}; // { dg-warning "" }
Weff1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wno-div-by-zero.C =================================================================== --- Wno-div-by-zero.C (nonexistent) +++ Wno-div-by-zero.C (revision 154) @@ -0,0 +1,8 @@ +// { dg-options "-Wno-div-by-zero" } + +int breakme() +{ + int x = 0; + x /= 0; + return x; +}
Wno-div-by-zero.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new1.C =================================================================== --- new1.C (nonexistent) +++ new1.C (revision 154) @@ -0,0 +1,3 @@ +void f() { + new int[0]; // { dg-warning "zero" } +}
new1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: oldcast1.C =================================================================== --- oldcast1.C (nonexistent) +++ oldcast1.C (revision 154) @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-ansi -pedantic-errors -Wold-style-cast" } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 26 Dec 2001 + +// 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; +} +
oldcast1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: return-reference.C =================================================================== --- return-reference.C (nonexistent) +++ return-reference.C (revision 154) @@ -0,0 +1,21 @@ +// { dg-do compile } + +const int* bar(); + +const int& +foo1() +{ + static int empty; + const int* x = bar(); + return (x ? *x : empty); // { dg-bogus ".*" "" { xfail *-*-* } } +} + +const int& +foo2() +{ + static int empty; + const int* x = bar(); + const int& r = (x ? *x : empty); + return (r); +} +
return-reference.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: implicit-typename1.C =================================================================== --- implicit-typename1.C (nonexistent) +++ implicit-typename1.C (revision 154) @@ -0,0 +1,17 @@ +// The -pedantic option must be omitted to trigger the crash. +// { dg-do compile } +// { dg-options "" } + +// PR c++/7982: Crash warning about implicit typename. +// The base class refers to another typename, while the +// name lookup finds a template. + +template struct X {}; + +template struct C { + typedef typename T::X X; +}; + +template struct A : public C { + typedef X X; +};
implicit-typename1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: effc1.C =================================================================== --- effc1.C (nonexistent) +++ effc1.C (revision 154) @@ -0,0 +1,16 @@ +// { dg-options -Weffc++ } +// { dg-do compile } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 26 Apr 2002 + +// Bug 5719 + +class A +{ + public: + A & operator+=( int ); + A & operator+( int ); // { dg-warning ".* should return by value" "" } + A operator+=( float ); + A operator+( float ); +};
effc1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor-dtor-privacy-1.C =================================================================== --- ctor-dtor-privacy-1.C (nonexistent) +++ ctor-dtor-privacy-1.C (revision 154) @@ -0,0 +1,9 @@ +// { dg-options "-Wctor-dtor-privacy" } + +struct C { // { dg-warning "" } + static bool result; +private: + static bool check(); +}; + +bool C::result = check();
ctor-dtor-privacy-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: missing-field-init-1.C =================================================================== --- missing-field-init-1.C (nonexistent) +++ missing-field-init-1.C (revision 154) @@ -0,0 +1,9 @@ +/* { 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 }; /* { dg-bogus "missing initializer" } */ +struct s s5[] = { 1, 2, 3, 4, 5, 6 };
missing-field-init-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inline1.C =================================================================== --- inline1.C (nonexistent) +++ inline1.C (revision 154) @@ -0,0 +1,23 @@ +// { dg-do compile } + +// Copyright (C) 2002 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 26 Dec 2002 + +// PR 4803. Used inline functions must have a definition. + +inline void Foo1 (); // { dg-warning "inline function" "" } +inline void Bar1 (); +template inline void Foo2(T); // { dg-warning "inline function" "" } +template inline void Bar2(T); + +void Baz () +{ + Foo1 (); + Foo2 (1); + + Bar1 (); + Bar2 (1); +} + +inline void Bar1 () {} +template inline void Bar2(T) {}
inline1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstring-literal-comparison-4.C =================================================================== --- Wstring-literal-comparison-4.C (nonexistent) +++ Wstring-literal-comparison-4.C (revision 154) @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -Wno-address" } */ + +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"; +} +
Wstring-literal-comparison-4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Winline-1.C =================================================================== --- Winline-1.C (nonexistent) +++ Winline-1.C (revision 154) @@ -0,0 +1,10 @@ +// { dg-options "-Winline -O2" } + +static inline int foo(int x); + +int main() +{ + return(foo(17)); +} + +inline int foo(int x) { return(x); }
Winline-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: format1.C =================================================================== --- format1.C (nonexistent) +++ format1.C (revision 154) @@ -0,0 +1,15 @@ +// Test that formats get checked according to C94. +// Origin: Joseph Myers . +// { dg-do compile } +// { dg-options "-ansi -pedantic -Wformat" } + +#include + +void +foo (int i, int *ip, __WINT_TYPE__ lc, wchar_t *ls) +{ + std::printf ("%d%ls%lc\n", i, ls, lc); + std::printf ("%d", ls); // { dg-warning "format" "printf warning" } + std::scanf ("%d%lc%ls%l[abc]", ip, ls, ls, ls); + std::scanf ("%hd", ip); // { dg-warning "format" "scanf warning" } +}
format1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noreturn-1.C =================================================================== --- noreturn-1.C (nonexistent) +++ noreturn-1.C (revision 154) @@ -0,0 +1,71 @@ +// Test that noreturn attributes are properly set. +// Origin: Kaveh Ghazi 2002-06-18. +// { dg-do compile } +// { dg-options "-Wall -O2" } + +#include + +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); +} +
noreturn-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wshadow-3.C =================================================================== --- Wshadow-3.C (nonexistent) +++ Wshadow-3.C (revision 154) @@ -0,0 +1,8 @@ +// PR c++/18530 +// { dg-options "-Wshadow" } + +struct A { + A(); + ~A(); + void foo (int __ct, int __dt) {} +};
Wshadow-3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unit-1.C =================================================================== --- unit-1.C (nonexistent) +++ unit-1.C (revision 154) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ + +struct a { int mode; }; +int sys_msgctl (void) +{ + struct a setbuf; /* { dg-warning "'setbuf\.a::mode' is used" } */ + return setbuf.mode; +} +
unit-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noeffect4.C =================================================================== --- noeffect4.C (nonexistent) +++ noeffect4.C (revision 154) @@ -0,0 +1,88 @@ +// { dg-do compile } +// { dg-options "-Wall" } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 2 Sep 2003 + +// 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 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 (x); + dynamic_cast (x); + reinterpret_cast (x.Foo ()); // { dg-error "invalid cast" } + const_cast (x.Foo ()); // { dg-warning "not used" } + + reinterpret_cast (&x);// { dg-warning "no effect" "" } + const_cast (x); // { dg-warning "no effect" "" } + sizeof (x++); // { dg-warning "no effect" "" } + __alignof__ (x++); // { dg-warning "no effect" "" } +} + +template void Foo<4> (X&); // { dg-warning "instantiated" }
noeffect4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: write-strings.C =================================================================== --- write-strings.C (nonexistent) +++ write-strings.C (revision 154) @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options -Wwrite-strings } + +int main() +{ + char* p = "Asgaard"; // { dg-warning "warning:.*deprecated.*" } +}
write-strings.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noeffect8.C =================================================================== --- noeffect8.C (nonexistent) +++ noeffect8.C (revision 154) @@ -0,0 +1,15 @@ +// PR c++/26696, 28996 +// { dg-do compile } +// { dg-options "-Waddress" } + +struct A +{ + static void f() {} +}; + +int main() +{ + A a; + a.f; // { dg-warning "not call" } + A().f; // { dg-warning "not call" } +}
noeffect8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: undefined1.C =================================================================== --- undefined1.C (nonexistent) +++ undefined1.C (revision 154) @@ -0,0 +1,7 @@ +// 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(); } }
undefined1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wstrict-aliasing-4.C =================================================================== --- Wstrict-aliasing-4.C (nonexistent) +++ Wstrict-aliasing-4.C (revision 154) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing=2 -O2" } */ + +double x; + +template +T *foo(void) +{ + int a[2]; + float *y = (float *)a; /* { dg-bogus "strict-aliasing" } */ + return (T *)&x; /* { dg-bogus "strict-aliasing" } */ +} +
Wstrict-aliasing-4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-2.C =================================================================== --- Wunused-2.C (nonexistent) +++ Wunused-2.C (revision 154) @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-Wunused -O3" } + +static const int i = 0; +static void f() { } /* { dg-warning "defined but not used" "" } */ +static inline void g() { }
Wunused-2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: conv4.C =================================================================== --- conv4.C (nonexistent) +++ conv4.C (revision 154) @@ -0,0 +1,22 @@ +// { 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; +}
conv4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: return-reference2.C =================================================================== --- return-reference2.C (nonexistent) +++ return-reference2.C (revision 154) @@ -0,0 +1,21 @@ +// PR c++/26671 + +class A +{ +public: + int first; + int second; + +}; + +int &f() +{ + A a; // { dg-error "local" } + return a.second; +} + +int &g() +{ + int ar[42]; // { dg-error "local" } + return ar[20]; +}
return-reference2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused-6.C =================================================================== --- Wunused-6.C (nonexistent) +++ Wunused-6.C (revision 154) @@ -0,0 +1,11 @@ +/* PR middle-end/14203 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +void foo() +{ + if (false) + if (int i=0) // { dg-warning "unused" "" } + int j=0; // { dg-warning "unused" "" } +} +
Wunused-6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.