(slight) problems compiling Cyrus IMAP 2.2.3

Nikola Milutinovic Nikola.Milutinovic at ev.co.yu
Fri Mar 5 02:01:17 EST 2004


Hi all.

First try and a (slight) bump into the wall. :-)

My OS/CC is Tru64 UNIX with DEC CC. I ran into errors/warnings in ./lib/imapopts.c

First, the light stuff, the warnings.

cc: Warning: imapopts.h, line 12: Trailing comma found in enumerator list.
cc: Warning: imapopts.h, line 152: Trailing comma found in enumerator list.

Indeed, there is a trailing comma, please guys, fix it.

Now the errors.

cc: Warning: imapopts.c, line 35: In the initializer for imapopts[1].val.s, the 
address constant "((const char ...)"")" may be cast only to a pointer type, but 
"union config_value" is a union type.
   { IMAPOPT_ADMINS, "admins", 0, (union config_value)((const char *) ""), 
OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },

cc: Error: imapopts.c, line 35: In the initializer for imapopts[1].val.s, "union 
config_value" is a union type, which is not scalar.
   { IMAPOPT_ADMINS, "admins", 0, (union config_value)((const char *) ""), 
OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },

It appears DEC CC holds high animosity towards these kinds of constructs. 
Testing this out further, I have found that a slight change towards *what I 
think is ANSI C standard, shows no errors. This is my change:

-ORIGINAL-------------------------------------------------------------------
struct imapopt_s imapopts[] =
{
   { IMAPOPT_ZERO, "", 0, { NULL }, OPT_NOTOPT },

   { IMAPOPT_ADMINS, "admins", 0, (union config_value)((const char *) ""), 
OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
----------------------------------------------------------------------------
-CHANGED--------------------------------------------------------------------
struct imapopt_s imapopts[] =
{
   { IMAPOPT_ZERO, "", 0, { NULL }, OPT_NOTOPT },

   { IMAPOPT_ADMINS, "admins", 0, { (const char *) ""}, OPT_STRING, {  { NULL, 
IMAP_ENUM_ZERO } } },
----------------------------------------------------------------------------

This doesn't choke the compiler and it was set to follow strict ANSI-C.

Does this change pose a problem to you guys?

I'm not asking only whether your GNU-C will swallow it (I'm sure it will), but 
also does that notation sit well with you? It is basically initializing a union 
as it would initialize a struct. It seams sensible to me.

Nix.

---
Home Page: http://asg.web.cmu.edu/cyrus
Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list