Werror

Mason slash.tmp@free.fr
Wed Feb 10 08:35:00 GMT 2016


On 10/02/2016 05:11, manojmaybe wrote:

> I am using gcc 4.8.5 in centos 7. I compile c program with flag Werror and
> gcc generate an error
> 
>  variable ‘test’ set but not used [-Werror=unused-but-set-variable]
>      obj* test;
>                 ^
> cc1: all warnings being treated as errors
> 
> But the variable test is used.

You need to provide a small test case exhibiting the problem.

> The same program without any modification and compile with Werror flag in
> centos 6 (gcc 4.4.7) is successfully compiled without any warning and error.
> 
> What is the reason for different behavior of the gcc in two version.

The unused-but-set-variable variable didn't exist in gcc 4.4

Regards.



More information about the Gcc-help mailing list