Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] (PR#6232) Re: [Freeciv] Trouble with compiling
Home

[Freeciv-Dev] (PR#6232) Re: [Freeciv] Trouble with compiling

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#6232) Re: [Freeciv] Trouble with compiling
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 21 Sep 2003 19:24:46 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Irena Vránová wrote:
> Good morning.
> 
> I tried to compile freeciv at my computer.(Red Hat Linux)
> 
> I've got this error message
> 
>    advdiplomacy.c:90: badly punctuated parameter list in `#define'

Variable arguments in a macro is not a standard C thing AFAIK.  This has 
been discussed before, and the only satisfactory resolution IIRC is to 
rewrite it as a varargs function.  If it's static it should be optimized 
pretty well anyway.

See freelog() for another example.

jason

Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.5
diff -u -r1.5 advdiplomacy.c
--- ai/advdiplomacy.c   2003/09/16 15:12:39     1.5
+++ ai/advdiplomacy.c   2003/09/22 03:13:44
@@ -84,10 +84,16 @@
   because we may want to highligh/present these messages differently
   in the future.
 ***********************************************************************/
-#define notify(pplayer, text, ...)                                     \
-  if (diplomacy_verbose) {                                             \
-    notify_player_ex(pplayer, -1, -1, E_DIPLOMACY, text, __VA_ARGS__); \
+static void notify(struct player *pplayer, const char *text, ...)
+{
+  if (diplomacy_verbose) {
+    va_list ap;
+
+    va_start(ap, text);
+    notify_player_ex(pplayer, -1, -1, E_DIPLOMACY, text, ap);
+    va_end(ap);
   }
+}
 
 /********************************************************************** 
   This is your typical human reaction. Convert lack of love into 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#6232) Re: [Freeciv] Trouble with compiling, Jason Short <=