== Quote from bearophile ([email protected])'s article
> While compiling GDC2 today I have seen hundreds of warnings, usually one of 5 
> types:

I'm rather thankful that you didn't try compiling a month or two ago then. :~)
I've cut down the amount of warnings emitted by a *lot*, and I can't even begin 
to
stress that fact.

> ../../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

If you have a great idea to fix this warning, please send a patch.


> 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

I have (yet) no clue why this happens. It's a direct copy from c-common.c, which
doesn't exhibit this format error when compiled with the same C compiler and 
flags.

> ../../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�

We don't use that function for anything at the moment. Though I think the idea 
may
have been to make GCC builtins known to the Frontend parser.

> ../../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

Meh. This is what you get when you compile DMD with:

WARNINGS=-W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wcast-qual

I think it would be a good target to get the frontend compiling with the above 
and
-Werror. :)


> 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

I've always been in favour of more warnings for trivial things which can produce
undefined behaviour.

Reply via email to