diff options
author | Dirk Mueller <mueller@gcc.gnu.org> | 2007-03-10 17:38:42 +0000 |
---|---|---|
committer | Dirk Mueller <mueller@gcc.gnu.org> | 2007-03-10 17:38:42 +0000 |
commit | 4cdffe3d10fe694b87a4bf6c7dd9cad501df9129 (patch) | |
tree | 97db729de18f4522ea6a2b666d84483228ed2dbf | |
parent | 36be7cc9af01244799ed682304952b135e4dbbad (diff) | |
download | gcc-4cdffe3d10fe694b87a4bf6c7dd9cad501df9129.zip gcc-4cdffe3d10fe694b87a4bf6c7dd9cad501df9129.tar.gz gcc-4cdffe3d10fe694b87a4bf6c7dd9cad501df9129.tar.bz2 |
Wlogical-op-1.c: Remove duplicated part.
2007-03-10 Dirk Mueller <dmueller@suse.de>
* gcc.dg/Wlogical-op-1.c: Remove duplicated part.
* g++.dg/warn/Wlogical-op-1.C: Remove duplicated part.
From-SVN: r122799
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wlogical-op-1.C | 57 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wlogical-op-1.c | 55 |
2 files changed, 10 insertions, 102 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wlogical-op-1.C b/gcc/testsuite/g++.dg/warn/Wlogical-op-1.C index 186f7ab..f67ab89 100644 --- a/gcc/testsuite/g++.dg/warn/Wlogical-op-1.C +++ b/gcc/testsuite/g++.dg/warn/Wlogical-op-1.C @@ -1,7 +1,7 @@ // { dg-do compile} // { dg-options "-Wlogical-op" } -enum { a, b }; +enum { a, b1, b2 }; enum testenum { t1, t2}; @@ -28,65 +28,20 @@ extern testenum testa(); void foo() { - if ( f && b ) // { dg-warning "always evaluate as" } + if ( f && b2 ) // { dg-warning "always evaluate as" } do_something(1); - if ( c && b ) // { dg-warning "always evaluate as" } + if ( c && b2 ) // { dg-warning "always evaluate as" } do_something(2); - if ( b && c == a ) // { dg-bogus "always evaluate as" } + if ( b2 && c == a ) // { dg-bogus "always evaluate as" } do_something(101); if ( 1 && c ) do_something(102); // { dg-bogus "always evaluate as" } - if ( t2 && b ) // { dg-bogus "always evaluate as" } + if ( t2 && b2 ) // { dg-bogus "always evaluate as" } do_something(103); if ( true && c == a ) // { dg-bogus "always evaluate as" } do_something(104); - if ( b && true ) // { dg-bogus "always evaluate as" } + if ( b2 && true ) // { dg-bogus "always evaluate as" } do_something(105); } -// { dg-do compile} -// { dg-options "-Winvariant-expr" } - -enum { a, b }; - -enum testenum { t1, t2}; - -extern int c; -extern bool bool_a, bool_b; - -template<typename Enum> -class QFlags -{ -public: - typedef void **Zero; - int i; - inline QFlags(Enum f) : i(f) {} - - inline operator int() const - { return i;} - -}; - -QFlags<testenum> f(t2); -extern void do_something(int); - -extern testenum testa(); -void foo() -{ - if ( f && b ) // { dg-warning "always evaluate as" } - do_something(1); - if ( c && b ) // { dg-warning "always evaluate as" } - do_something(2); - - if ( b && c == a ) // { dg-bogus "always evaluate as" } - do_something(101); - if ( 1 && c ) - do_something(102); // { dg-bogus "always evaluate as" } - if ( t2 && b ) // { dg-bogus "always evaluate as" } - do_something(103); - if ( true && c == a ) // { dg-bogus "always evaluate as" } - do_something(104); - if ( b && true ) // { dg-bogus "always evaluate as" } - do_something(105); -} diff --git a/gcc/testsuite/gcc.dg/Wlogical-op-1.c b/gcc/testsuite/gcc.dg/Wlogical-op-1.c index 154e8f4..d9687bf 100644 --- a/gcc/testsuite/gcc.dg/Wlogical-op-1.c +++ b/gcc/testsuite/gcc.dg/Wlogical-op-1.c @@ -33,62 +33,15 @@ void foo() if ( b && c == a ) /* { dg-bogus "always evaluate as" } */ (void)testa(); - if ( 1 && c ) /* { dg-warning "always evaluate as" } */ + if ( 1 && c ) /* { dg-bogus "always evaluate as" } */ (void)testa(); - if ( t2 && b ) /* { dg-warning "always evaluate as" } */ + if ( t2 && b ) /* { dg-bogus "always evaluate as" } */ (void)testa(); - if ( 0 && c == a ) /* { dg-warning "always evaluate as" } */ + if ( 0 && c == a ) /* { dg-bogus "always evaluate as" } */ (void)testa(); - if ( b && 1 ) /* { dg-warning "always evaluate as" } */ - (void)testa(); -} -/* - { dg-do compile} - { dg-options "-Winvariant-expr" } -*/ - -enum { a, ba, b }; - -enum testenum { t1, t2}; - -extern int c; -extern char bool_a, bool_b; - -extern int testa(); - -void foo() -{ - if ( testa() && b ) /* { dg-warning "always evaluate as" } */ - (void)testa(); - - if ( c && b ) /* { dg-warning "always evaluate as" } */ - (void)testa(); - - if ( c && 0x42 ) /* { dg-warning "always evaluate as" } */ - (void)testa(); - - if ( c && 0x42 ) /* { dg-warning "always evaluate as" } */ - (void) testa(); - - if ( c && 0x80 >>6) /* { dg-warning "always evaluate as" } */ - (void)testa(); - - - if ( b && c == a ) /* { dg-bogus "always evaluate as" } */ - (void)testa(); - - if ( 1 && c ) /* { dg-warning "always evaluate as" } */ - (void)testa(); - - if ( t2 && b ) /* { dg-warning "always evaluate as" } */ - (void)testa(); - - if ( 0 && c == a ) /* { dg-warning "always evaluate as" } */ - (void)testa(); - - if ( b && 1 ) /* { dg-warning "always evaluate as" } */ + if ( b && 1 ) /* { dg-bogus "always evaluate as" } */ (void)testa(); } |