Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2001:
[Freeciv-Dev] Re: (GCC errors)7 patches to freeciv-1.11.4 (3rd try)
Home

[Freeciv-Dev] Re: (GCC errors)7 patches to freeciv-1.11.4 (3rd try)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Chris Chittleborough <cchittleborough@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (GCC errors)7 patches to freeciv-1.11.4 (3rd try)
From: Thue <thue@xxxxxxx>
Date: Mon, 26 Feb 2001 00:35:49 +0100

Well, language syntax should not be decided by what broken compiler ships 
with the latest release.
A good reason one way or the other would be the C99 standard (there are so 
many C enthusiasts on this list who will jump on this one, so I will just 
leave it to them to battle it out for the correct syntax).
Anyway the redhat 7 people can compile with kgcc.

-Thue
-----------------
 GCC-Change.patch               WARNING: MORE WORK NEEDED!
        The freeciv code makes heavy use of a function named freelog(), which
        takes a variable number of arguments.  When compiling under gcc, this
        function is actually implemented as a macro, using a language extension
        which allows macros to have varying-length argument lists.
        Red Hat 7.0 comes with version 2.96 of gcc.  You may have heard that the
        GCC team are annoyed by this, because 2.96 was not intended for general
        release. Why does this matter? Well, 2.96 seems to require a different
        syntax for variadic macros (although the documentation still describes
        the old syntax). For example,
                #define log(level, args...)  reallylog((level) , ##args)
        has to be changed to
                #define log(level, args...)  reallylog((level) , args)
        to prevent lots of strange error messages.

        This patch makes common/log.h work with gcc 2.96, which is great if you
        want to compile under 2.96, but REALLY BAD if you are using an earlier
        version of gcc.  Probably THESE MACRO DEFINITIONS SHOULD HAVE MORE #if'd
        VARIANTS ... but I don't know which version(s) of gcc require which
        syntax.  Is there an autoconf test for this?  Sorry, but a proper patch
        for this problem is beyond my current expertise.

diff -rub freeciv-1.11.4.KIT/common/log.h freeciv-1.11.4/common/log.h
--- freeciv-1.11.4.KIT/common/log.h     Sun Mar 19 04:05:00 2000
+++ freeciv-1.11.4/common/log.h Wed Feb 21 15:41:43 2001
@@ -90,13 +90,13 @@
 #ifdef DEBUG
 #define freelog(level, args...) do { \
   if ((level) != LOG_DEBUG || logdebug_check(__FILE__, __LINE__)) { \
-    real_freelog((level), ##args); \
+    real_freelog((level), args); \
   } \
 } while(0) 
 #else
 #define freelog(level, args...) do { \
   if ((level) != LOG_DEBUG) { \
-    real_freelog((level), ##args); } \
+    real_freelog((level), args); } \
 } while(0) 
 #endif  /* DEBUG */
 #else



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