diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C new file mode 100644 index 000000000..99b23967c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C @@ -0,0 +1,98 @@ +// { dg-do assemble } +// { dg-options "-Wall -Weffc++" } + +//1 g++/12952 un-named variables in a catch block +//Wall or Wunused should not give warnings here +template <class T> +void f (void) { + try + { + } + + catch( int) + { + } +} + +// +//2 g++/12923 __attribute__((__unused__)) not working for objects +//Weffc++ or Wunused should not report the object as an error +class C { + public: + C(); +}; + +void f (void){ + C x __attribute__ ((__unused__)); + int y __attribute__ ((__unused__)); +} + +// +//3 g++/12982 lock should not give error here, as above +void setLock (); +void clearLock (); + +template <class T> +class test { +public: + class lock + { + public: + lock () { setLock(); } + ~lock () { clearLock(); } + }; + + static void f (void) + { + lock local __attribute__ ((__unused__)); + } + +}; + + +// +//4 g++/12988 neither Mutex nor AutoMutex varibles should give warnings here +//compile with -Weffc++ or -Wunused depending on post or pre 97r1 +class Mutex { +private: + long counter; +public: + virtual long retcntr() {return counter;}; + Mutex(int i = 0): counter(i) {}; + virtual ~Mutex() {}; +} __attribute__ ((__unused__)); + +class AutoMutex: public Mutex{ +private: + long counter2; +public: + long retcntr() {return counter2;}; + AutoMutex(int i = 0): counter2(i) {}; + virtual ~AutoMutex() {}; +} __attribute__ ((__unused__)); + + +template <class T> +int foofunc(T x){ + Mutex sm(2); + AutoMutex m(&sm); + return 0; +} + + +//5 sanity check to make sure other attributes cannot be used +class Mutex2 { +private: + long counter; +public: + virtual long retcntr() {return counter;}; + Mutex2(int i = 0): counter(i) {}; + virtual ~Mutex2() {}; +} __attribute__ ((warn)); // { dg-warning "" } + + + + + + + |