Re: [coldfire-gnu-discuss] 4.3-43 toolchain for mcf547x warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coldfire-gnu-discuss] 4.3-43 toolchain for mcf547x warnings



Wong, Ken wrote:

> Using the 4.3-43 toolchain, I’m not getting the “too many arguments”
> warning when I compile the following sample code:

> static const char test[] = "%d";

>   printf (test, a, b);

GCC, unlike most compilers, issues different warnings depending on what
optimizations are performed.  If the compiler notices that the array is
"const", and therefore substitutes the string into the "printf" call,
then it will issue the warning.  But, if it doesn't, then it will not.
Whether that substitution occurs depends on the exact version of the
compiler and what level of optimization is in use.

Some users find this variability of warnings confusing.  (I do,
personally.)  But, some people like the fact that the compiler can then
offer warnings about cases like yours; many other compilers cannot issue
such warnings because they do not do any optimization before issuing
warnings.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@xxxxxxxxxxxxxxxx
(650) 331-3385 x713