Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppressing certain errors with icc and gcc 1

Status
Not open for further replies.

Mthales

Technical User
Feb 27, 2004
1,181
GB
Hi,
I have a bunch of code that is not mine so I can't really change it but I have been given the task of writing the makefiles to compile and link this code.
The problem I have is that parts of it are spewing out the same warning message lots of times and I'd like to hide that warning but still be able to see others.
I am trying to use both the icc and gcc compilers.
So my question is do these compilers have a method of suppressing certain warning numbers? Can this be done with a command line flag or some sort of pragma line?

Thanks for any help
M

Trainee Chocolate Management Executive.
 
In my mind, hiding compilation warnings is just hiding from the reality that the code needs fixing.
To get rid of the warnings, you should fix them !

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Thanks for the reply and yes that would be my solution as well but management says it's not my code so I can't do that and I have to just hide the warnings :-(

Trainee Chocolate Management Executive.
 
There are ways to suppress specific warnings, for example to suppress import warnings, you would use the switch "-Wno-import".

Or the "-w" switch will inhibit all warnings.

See
--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
sedj thank you very much for that link - I had looked at those flags but I can't work out which category the warning I need to hide would fall under.
The warning is:
Code:
warning #383: value copied to temporary, reference to temporary used

M

Trainee Chocolate Management Executive.
 
I don't know what that error means exactly, but from the sound of it, it could mean that you are referencing a variable which is no longer available - which could cause major problems.

Eg :

Code:
char* func0() {
  char bla[256];
  sprintf(bla, "hello");

  return &bla[0];
}

void func1() {
  char* hello = func0();
}

This would cause some nasty results - and if that error is something like this, then I really would push the need to fix it !

Of course, I could be way off ...



--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Thanks very much for your help guys - I think I'll bypass the management and go talk to the code's owner about what it's actually doing.

M

Trainee Chocolate Management Executive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top