[Dovecot] [PATCH] fix gcc warnings in 1.0rc26

Max Kellermann max at duempel.org
Thu Mar 15 12:46:22 EET 2007


Hi,

I have made a small patchset to fix some of the GCC warnings.  With
these patches, I was able to compile dovecot r_1_0_rc26 with the
following options:

 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith
 -Wchar-subscripts -Wformat=2 -Wbad-function-cast Wstrict-prototypes
 -Wredundant-decls -Wcast-align -Wwrite-strings Wpacked -Winline
 -Wdisabled-optimization -Wno-long-long -Wundef Wfloat-equal
 -Wsign-compare -Waggregate-return -Werror

Some of the changes may be arguable, escpecially the const warning
fixes, example:

 char *pass = "";

I changed that to "pass = NULL" and changed the function call:

 - auth_request_verify_plain(request, pass,
 + auth_request_verify_plain(request, pass == NULL ? "" : pass,

In other sources, I added "const" to parameters or to the return value
where it seemed to make sense and didn't cause harm.  Dealing with the
const problem can be tricky, and sometimes dirty deconstification
hacks are the only way to go..  however I believe we should always
turn on "-Wconst" and explicitly add manual deconstitication where we
assume it's not dangerous.

I didn't fix all "const" and "missing noreturn" warnings, but my
patches may be a good start...  if there is further interest in fixing
all of them, I'd be glad to do it.

Max

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dovecot-imap_bodystructure_write_const.patch
Type: text/x-diff
Size: 1806 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070315/53f1ec71/attachment-0004.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dovecot-gcc_warnings.patch
Type: text/x-diff
Size: 1133 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070315/53f1ec71/attachment-0005.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dovecot-noreturn.patch
Type: text/x-diff
Size: 2235 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070315/53f1ec71/attachment-0006.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dovecot-const_warnings.patch
Type: text/x-diff
Size: 11484 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070315/53f1ec71/attachment-0007.bin 


More information about the dovecot mailing list