On 23.05.2011 01:10, Germán Arias wrote:
On lun, 2011-05-23 at 00:13 +0200, Fred Kiefer wrote:
On 22.05.2011 01:50, Germán Arias wrote:
Compiling GUI with gcc 4.6.0 I get the error:
Making all for tool say...
Compiling file say.m ...
say.m: In function 'main':
say.m:17:12: error: defines the variable 'outfile' but not used
[-Werror=unused-but-set-variable]
cc1obj:
all warnings are treated as errors
make[5]: *** [obj/say.obj/say.m.o] Error 1
make[4]: *** [internal-tool-all_] Error 2
make[3]: *** [say.all.tool.variables] Error 2
make[2]: *** [internal-all] Error 2
make[1]: *** [internal-all] Error 2
make: *** [internal-all] Error 2
There are to angles to this problem. One is of course that, as gcc
reports, we have an unused variable in our code, which we should safely
remove. The other is that gcc treats warnings as errors and fails
because of this. I don't think that this is the standard even for gcc
4.6. You should find out where this is set and remove that setting.
Well, the variable "outfile" is declared as
NSString *outFile = nil;
and is used inside the loop while. But for some reason (I don't know how
the compiler works) show the previous error. Of course, I can compile
GUI removing the option -Werror in GNUmakefile of tool "say". And I
don't know if this option is really necessary here (I think no).
This option is never necessary, it just forces a developer to clean up
her code. Still that option should never make it into release make files
as different compilers may be a bit more strict and then perfect valid
code will no longer compile. Has happened in your case.
The compiler obviously was correct, as outFile was set at two places but
never read and this was what the compiler reported.
I changed the code to actually use that variable, corrected the
indentation and got the code to compile with non-C99 compilers. And then
I commented out that compiler option. Just to make sure :-)
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev