[exim-dev] Proposed change: compiler strictness issues

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Phil Pennock
Datum:  
To: exim-dev
CC: Tom Kistner
Betreff: [exim-dev] Proposed change: compiler strictness issues
For various reasons, I chose to try to compile Exim with these compiler
flags (under gcc):

-Werror -Wwrite-strings -Wunused-function -Waddress -Wpointer-sign
-Wformat -Wuninitialized -Winit-self

I've almost succeeded, patch referenced below. One file eludes me, in
the DKIM code. Test platform was FreeBSD/amd64 with gcc 4.2.1.

The biggest problem was the const-ness of string constants provided by
-Wwrite-strings, so the changes are relatively intrusive, adding const
to a variety of function prototypes.

The two issues are:

 (1) I'm not entirely happy with my change to auth-spa.c to get rid of
     the "always true" complaint, triggered by a macro which tested an
     address for truth, sometimes called for addresses from the stack.
     I chose to change the macro and add some (guarded)
     __attribute__((nonnull(...))) checks to the prototypes of the
     functions where the macro params were from the prototype instead
     of stack storage.  I'm uneasy and thinking I've missed something,
     so perhaps it would be better to just split the macros in two,
     instead.  Thoughts?


 (2) I had to override CFLAGS for pdkim/pdkim.c; the issue is the
     header_name_match() function; it takes a bool third param which
     determines whether or not the second param is const and safe to
     manipulate.  The function is long enough that splitting it into two
     variants is not a clean solution.


     Tom, is the invalidated header name logic actually used?  I'm
     thinking that the changes made to "tick" might just be to be able
     to see the problems when in a debugger, rather than used in the
     code?


The patch is currently available at:
http://git.exim.org/users/pdp/exim.git/commit/7652bba1240ebcacc17a65cdbaa88e7b181f5775

Review appreciated,
-Phil