This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc/g++ equivalent for BC++ #pragma warn -xxx


Hi,

I try to wrote all of my prg's such way, that there is no error/warning
from the compiler. 
I swich all warnings on. 
I thing: most of the cases a warning leads to some errors I made, 
only some are just the thing I wan't. 
Most of the time I am able to modify my code to supress the warning for
that cases.

But I found no way to supress the warning:
------ taking address of temporary --------
Because this is just what I mean, I look for something to supress this
message, but only for the line of code it happens (meaning that the same
problem my exist at other places in my code and there it isn't what I
like to do).

Using other compilers (e.g. BC++) I use
#pragma warn -xxx
xxx stands for the warning I like to suppress.

Is there a way to do that with gcc ??

Some more info's on that:

Version of G++ I use: 2.95.2 (Linux/pentium)
gcc options used: at least -Wall

Some code-fragment that exhibits the warning:

class Foo
 {
  .. // two dots (..) mean some code left off
 };

void bar( Foo * pobj, ... ) // three dots (...) mean the elipse
(optional parameters)
 {
  // bar should process a list of Foo-objects, that's why i can't use
'Foo & obj'
  va_arg ..
  ..
 }

.. main ..
 {
  bar( &Foo(), NULL ); // this line gives the warning
 }

As You see the above statement 
bar( &Foo(), NULL );
creates a temporary object of class Foo, it's address was taken and
supplied to the function bar.
In most circumstances that isn't what someone migth, but it's right what
I need in this situation.


Thanks & greetings
 Günter

Kryptographische Unterschrift mit S/MIME


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]