Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
[Freeciv-Dev] cvs broken with CFLAGS -O0 -Wall -pedantic -DDEBUG -g
Home

[Freeciv-Dev] cvs broken with CFLAGS -O0 -Wall -pedantic -DDEBUG -g

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] cvs broken with CFLAGS -O0 -Wall -pedantic -DDEBUG -g
From: Nicolas Brunel <brunel@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 Aug 1999 18:47:41 +0000 (GMT)

Hello,

  with the flags I use, freeciv cvs doesn't compile.
In the macro ATHING_INIT, sz can't be known at compilation time.
I suppose David use one of gcc extra possibility.
I prefer that we use standard C as one day we may stop using gcc.

Bye,

Here is a patch to fix(change) this :

The main drawback of my patch is that we can't any more use two 
ATHING_INIT in a row. :-(

diff -ur -Xno.freeciv freeciv/common/astring.c freeciv-diff/common/astring.c
--- freeciv/common/astring.c    Sat Aug  7 04:30:37 1999
+++ freeciv-diff/common/astring.c       Sat Aug  7 18:26:55 1999
@@ -104,7 +104,7 @@
 ***********************************************************************/
 void ath_init(struct athing *ath, int size)
 {
-  struct athing zero_ath = ATHING_INIT(size);
+  ATHING_INIT(zero_ath,size);
   assert(ath);
   *ath = zero_ath;
 }
@@ -140,8 +140,8 @@
 ***********************************************************************/
 void ath_free(struct athing *ath)
 {
-  struct athing zero_ath = ATHING_INIT(1);
   int size;
+  ATHING_INIT(zero_ath,1);
 
   assert(ath);
   assert(ath->n_alloc>=0);
diff -ur -Xno.freeciv freeciv/common/astring.h freeciv-diff/common/astring.h
--- freeciv/common/astring.h    Sat Aug  7 04:30:37 1999
+++ freeciv-diff/common/astring.h       Sat Aug  7 18:23:20 1999
@@ -36,7 +36,9 @@
  * Notice a static astring var is exactly this already.
  */
 #define ASTRING_INIT  { 0, 0, 0 }
-#define ATHING_INIT(sz)  { 0, (sz), 0, 0 }
+#define ATHING_INIT(this_thing,sz)  \
+   struct athing this_thing = { 0, 0, 0, 0 }; \
+   (this_thing).size = (sz) \
 
 void astr_init(struct astring *astr);
 void astr_minsize(struct astring *astr, int n);
diff -ur -Xno.freeciv freeciv/common/registry.c freeciv-diff/common/registry.c
--- freeciv/common/registry.c   Sat Aug  7 04:44:23 1999
+++ freeciv-diff/common/registry.c      Sat Aug  7 18:27:58 1999
@@ -342,8 +342,8 @@
   int i;
   struct astring base_name = ASTRING_INIT;    /* for table or single entry */
   struct astring entry_name = ASTRING_INIT;
-  struct athing columns_tab = ATHING_INIT(sizeof(struct astring));
   struct astring *columns = NULL;      /* -> columns_tab.ptr */
+  ATHING_INIT(columns_tab,sizeof(struct astring));
 
   inf = inf_open(filename);
   if (!inf) {



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