AnsweredAssumed Answered

Disabling gcc warnings

Question asked by Dave Wills on May 29, 2014
Latest reply on Jun 10, 2014 by Dave Wills

Hi,

 

I'm new to the CodeWarrior environment.  I'm used to making sure there are not only no errors (duh!) but no warnings in my compiles.  Some warnings are generated in SOUP and I don't want to modify the SOUP, and some warnings are justifiable (which in some medical environments must be justified).  What I have done in the past is to disable warnings globally when they can have no affect on the code, or disable warnings for a single line of code (or a file, but not as good).

 

I'm using an E02 processor and am stuck with the gcc compiler.  I've searched the archives here and there are plenty of hits for disabling warnings, but after digging through them none seem to apply to the gcc compiler.  I'm also used to getting warning numbers, but this compiler only generates messages.  For example,

 

format '%d' expects argument of type 'int', but argument 2 has type 'uint32_t' [-Wformat]

variable 'c' set but not used [-Wunused-but-set-variable]

 

The first one I can take care of by just commenting out the line of code, only used for debug.  But it would be nice to disable the warning for just this line.

 

The second one is a problem because the hardware requires a register read to set conditions in the peripheral, even though the data isn't used.  In other compilers, I've been able to eliminate this kind of warning by casting the variable as (void) in the statement that uses it.

 

Any ideas?

 

Thanks!

 

Dave

Outcomes