Dovecot 2.2.25 compiling error

Joseph Tam jtam.home at gmail.com
Tue Jul 12 19:01:40 UTC 2016


>>> 	void foo(int X[static 20]);
>>> 
>>> will compile but if you remove "X", it won't.
>> 
>> The change was to replace "int" with "unsigned char" in the above test
>> program, and the test started failing then in CentOS 5's gcc.  I'd
>> expect the same to happen for you also.
>
> No, it will fail with both "int" and "unsigned char" without the dummy
> argument "X", and works for both if one is inserted.  I don't know why --
> perhaps a bug with my version of gcc.

I don't have a CentOS5 lying around, so I tried compiling this with the
gcc supplied by Ubuntu8 (v4.2.4), and observed the same failure.  With
a newer gcc (v4.6.3), it compiles cleanly with/without the X identifier.
The type was irrelevant in both versions.

My eyes glazed over trying to decipher section 6.7.5 of the ISO C99
document, so I've come to the conclusion I'm lousy at reading ISO
documents.  I suspect the identifier-less prototype is legal.

 	http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

For now, I'll just patch sha1.h

 	+++ ./src/lib/sha1.h~	Tue Jul 12 11:51:48 2016
 	--- ./src/lib/sha1.h	Tue Jul 12 11:52:00 2016
 	@@ -80,1 +80,1 @@
 	-	unsigned char [STATIC_ARRAY SHA1_RESULTLEN]);
 	+	unsigned char dummy[STATIC_ARRAY SHA1_RESULTLEN]);

Joseph Tam <jtam.home at gmail.com>


More information about the dovecot mailing list