Patch RFC: Fix broken builds with Sun CC

ellie timoney ellie at fastmail.com
Thu Sep 17 20:13:45 EDT 2015


Hi Jens,

This is not as simple as just removing the casts from lib/imapopts.c --
it's a generated file.  Note the comments at the top:

> /* auto-generated by config2header 1.17 */
> 
> /* DO NOT EDIT */
> 
> /* THIS FILE AUTOMATICALLY GENERATED BY config2header 1.17 */

config2header lives in the tools/ subdirectory.  Any patch to fix this
issue would need to target that, not the file it produces.

The mailing list discussions you reference talk about this being a
result of the Sun compiler being strict about "Ansi C", by which I'm
assuming they mean C89/C90.  We generally target C99 these days (it is,
after all, 16 years old, and has itself already been superceded by
C11...).

I don't know if the Sun compiler has options to support C99, but if it
does, have you tried using them?

Cheers,

ellie

On Tue, Sep 15, 2015, at 06:56 PM, Jens Erat wrote:
> Dear Cyrus-maintainers,
> 
> building Cyrus IMAP 2.5.6 on Solaris 11 using the Sun CC, I experienced
> issues with some casts in `lib/imapopts.c`, an excerpt (similar lines
> occurring hundreds of times):
> 
> "lib/imapopts.c", line 32: invalid cast expression
> "lib/imapopts.c", line 32: non-constant initializer involving a cast
> "lib/imapopts.c", line 33: invalid cast expression
> "lib/imapopts.c", line 33: non-constant initializer involving a cast
> "lib/imapopts.c", line 36: invalid cast expression
> "lib/imapopts.c", line 36: non-constant initializer involving a cast
> "lib/imapopts.c", line 37: invalid cast expression
> "lib/imapopts.c", line 37: non-constant initializer involving a cast
> "lib/imapopts.c", line 40: invalid cast expression
> "lib/imapopts.c", line 41: invalid cast expression
> "lib/imapopts.c", line 44: invalid cast expression
> "lib/imapopts.c", line 45: invalid cast expression
> 
> This seems to have been reported multiple times by now [1] [2]. I
> applied the proposed fix by Christos Soulios in [1] (removing
> "GCCisms"), and it works fine for us.
> 
> I'm not sure whether this fix is a good or a bad idea, but these casts
> aren't, either, breaking compatibility with other compilers.
> 
> Regards from Lake Constance, Germany,
> Jens Erat
> 
> [1]: http://comments.gmane.org/gmane.mail.imap.cyrus/8927
> [2]:
> http://lists.andrew.cmu.edu/pipermail/info-cyrus/2004-April/006894.html
> 
> -- 
> Jens Erat
> Universität Konstanz
> Kommunikations-, Infomations-, Medienzentrum (KIM)
> Abteilung Basisdienste
> D-78457 Konstanz
> Mail: jens.erat at uni-konstanz.de
> 
> Email had 2 attachments:
> + cyrus-imapd-2.5.6-patch-casts.patch
>   96k (text/x-patch)
> + smime.p7s
>   7k (application/pkcs7-signature)


More information about the Cyrus-devel mailing list