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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.benjamin/] [warn01.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do assemble  }
// { dg-do assemble  }
// { dg-options "-Wall -Weffc++" }
// { dg-options "-Wall -Weffc++" }
//1 g++/12952 un-named variables in a catch block
//1 g++/12952 un-named variables in a catch block
//Wall or Wunused should not give warnings here
//Wall or Wunused should not give warnings here
template 
template 
void f (void) {
void f (void) {
   try
   try
    {
    {
    }
    }
   catch( int)
   catch( int)
    {
    {
    }
    }
}
}
//
//
//2 g++/12923 __attribute__((__unused__)) not working for objects
//2 g++/12923 __attribute__((__unused__)) not working for objects
//Weffc++ or Wunused should not report the object as an error
//Weffc++ or Wunused should not report the object as an error
class C {
class C {
  public:
  public:
  C();
  C();
};
};
void f (void){
void f (void){
  C x __attribute__ ((__unused__));
  C x __attribute__ ((__unused__));
  int y __attribute__ ((__unused__));
  int y __attribute__ ((__unused__));
}
}
//
//
//3 g++/12982 lock should not give error here, as above
//3 g++/12982 lock should not give error here, as above
void setLock ();
void setLock ();
void clearLock ();
void clearLock ();
template 
template 
class test {
class test {
public:
public:
   class lock
   class lock
   {
   {
   public:
   public:
     lock () { setLock(); }
     lock () { setLock(); }
     ~lock () { clearLock(); }
     ~lock () { clearLock(); }
   };
   };
  static void f (void)
  static void f (void)
  {
  {
   lock local  __attribute__ ((__unused__));
   lock local  __attribute__ ((__unused__));
  }
  }
};
};
//
//
//4 g++/12988 neither Mutex nor AutoMutex varibles should give warnings here
//4 g++/12988 neither Mutex nor AutoMutex varibles should give warnings here
//compile with -Weffc++ or -Wunused depending on post or pre 97r1
//compile with -Weffc++ or -Wunused depending on post or pre 97r1
class Mutex {
class Mutex {
private:
private:
  long counter;
  long counter;
public:
public:
  virtual long retcntr() {return counter;};
  virtual long retcntr() {return counter;};
  Mutex(int i = 0): counter(i) {};
  Mutex(int i = 0): counter(i) {};
  virtual ~Mutex() {};
  virtual ~Mutex() {};
} __attribute__ ((__unused__));
} __attribute__ ((__unused__));
class AutoMutex: public Mutex{
class AutoMutex: public Mutex{
private:
private:
  long counter2;
  long counter2;
public:
public:
  long retcntr() {return counter2;};
  long retcntr() {return counter2;};
  AutoMutex(int i = 0): counter2(i) {};
  AutoMutex(int i = 0): counter2(i) {};
  virtual ~AutoMutex() {};
  virtual ~AutoMutex() {};
} __attribute__ ((__unused__));
} __attribute__ ((__unused__));
template 
template 
int foofunc(T x){
int foofunc(T x){
  Mutex sm(2);
  Mutex sm(2);
  AutoMutex m(&sm);
  AutoMutex m(&sm);
  return 0;
  return 0;
}
}
//5 sanity check to make sure other attributes cannot be used
//5 sanity check to make sure other attributes cannot be used
class Mutex2 {
class Mutex2 {
private:
private:
  long counter;
  long counter;
public:
public:
  virtual long retcntr() {return counter;};
  virtual long retcntr() {return counter;};
  Mutex2(int i = 0): counter(i) {};
  Mutex2(int i = 0): counter(i) {};
  virtual ~Mutex2() {};
  virtual ~Mutex2() {};
} __attribute__ ((warn));  // { dg-warning "" }
} __attribute__ ((warn));  // { dg-warning "" }
 
 

powered by: WebSVN 2.1.0

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