Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] Re: compile errors on bitvector code with Sun cc (PR#2046)
Home

[Freeciv-Dev] Re: compile errors on bitvector code with Sun cc (PR#2046)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: compile errors on bitvector code with Sun cc (PR#2046)
From: Jason Short <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Sep 2002 08:43:56 -0700 (PDT)

Reinier Post wrote:
  Dear Per,

The Sep 10 snapshot fails to compile with with Sun's (ANSI) cc:

cc -DHAVE_CONFIG_H -I. -I. -I.. -I./../common -I./../server -I../intl    -g -c 
`test -f advattitude.c || echo './'`advattitude.c
"./../common/unittype.h", line 151: warning: syntax error:  empty declaration
"./../common/unittype.h", line 152: warning: syntax error:  empty declaration
"./aitools.h", line 30: invalid token in #define macro parameters: ...
"./aitools.h", line 42: invalid token in #define macro parameters: ...
"./aitools.h", line 54: invalid token in #define macro parameters: ...
cc: acomp failed for advattitude.c
make[3]: *** [advattitude.o] Error 2
make[3]: Leaving directory 
`/scratch/rp/freeciv/code/compiled/latest/freeciv-cvs-Sep-10+none/ai'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory 
`/scratch/rp/freeciv/code/compiled/latest/freeciv-cvs-Sep-10+none'
make[1]: *** [all] Error 2
make[1]: Leaving directory 
`/scratch/rp/freeciv/code/compiled/latest/freeciv-cvs-Sep-10+none'
make: *** 
[/home/rp/.freeciv/code/compiled/latest/freeciv-cvs-Sep-10+none/server/civserver]
 Error 2

The lines in unittype.h invoke the BV_DEFINE macro; I have no idea what goes
wrong there.  The problem in aitools.h is a define that contains "..." in the
argument list, which is not a construct I can find anywhere.


I can reproduce this.

The warning in unittype.h is because the macro definition is given an unnecessary semicolon after it, so there's an extra semicolon which is an "empty declaration". This is harmless, but should be fixed (patch attached).

The aitools.h problem is much bigger, and probably comes up in many places in the code. Does anyone know how this can be avoided? Is there a more "proper" way to do variable-argument macros, or is that just impossible in Sun CC?

jason
Index: common/shared.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v
retrieving revision 1.102
diff -u -r1.102 shared.h
--- common/shared.h     2002/09/27 12:32:44     1.102
+++ common/shared.h     2002/09/27 15:42:40
@@ -92,7 +92,7 @@
   bv_check_mask((vec1).vec, (vec2).vec, sizeof((vec1).vec), sizeof((vec2).vec))
 
 #define BV_DEFINE(name, bits) \
-  typedef struct { unsigned char vec[_BV_BYTES(bits)]; } name;
+  typedef struct { unsigned char vec[_BV_BYTES(bits)]; } name
 
 char *create_centered_string(const char *s);
 

[Prev in Thread] Current Thread [Next in Thread]