GDC2 compilation warnings
bearophile
bearophileHUGS at lycos.com
Tue Nov 23 14:27:12 PST 2010
While compiling GDC2 today I have seen hundreds of warnings, usually one of 5 types:
../../gcc/d/d-gcc-real.h: In member function const real_value& real_t::rv() const:
../../gcc/d/d-gcc-real.h:54: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from ../../gcc/d/d-builtins.c:72:
../../gcc/d/d-bi-attrs-44.h: In function handle_packed_attribute:
../../gcc/d/d-bi-attrs-44.h:211: warning: unknown conversion type character E in format
../../gcc/d/d-bi-attrs-44.h:211: warning: too many arguments for format
../../gcc/d/dmd2/builtin.c: In member function BUILTIN FuncDeclaration::isBuiltin():
../../gcc/d/dmd2/builtin.c:44: warning: unused variable FeZe
../../gcc/d/dmd2/builtin.c:45: warning: unused variable FeZe2
../../gcc/d/dmd2/toobj.c: In member function virtual void ClassDeclaration::toObjFile(int):
../../gcc/d/dmd2/toobj.c:691: warning: comparison between signed and unsigned integer expressions
../../gcc/d/dmd2/toobj.c:693: warning: comparison between signed and unsigned integer expressions
In file included from ../../gcc/d/dmd2/root.h:29,
from ../../gcc/d/dmd2/total.h:24,
from ../../gcc/d/d-cppmngl.cc:25:
../../gcc/d/dmd2/dchar.h:155: warning: unused parameter pstart
Comments:
- Unused variable warning: this is useful to avoid bugs;
- Type-punned pointer warning: so far I have never received an answer to my questions about this possible problem in D.
- Printing functions wrong argument number warning: this is something D needs to add, for writef, writefln, printf, sprintf, etc (even if it can't work in all situations). Having those as run-time errors is silly in a language that unlike dynamic languages forces you to compile the code. This is an example of dynamic typing where I don't want it.
- Signed unsigned comparison warning: unless D invents some other very good solution, this warning is a ugly but necessary patch over one hole of the C language that D too has.
Bye,
bearophile
More information about the Digitalmars-d
mailing list