Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#3427) Remove noreturn attribute
Home

[Freeciv-Dev] Re: (PR#3427) Remove noreturn attribute

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#3427) Remove noreturn attribute
From: "Raimar Falke" <rf13@xxxxxxxxxxxxxxxxx>
Date: Fri, 28 Feb 2003 00:59:00 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Thu, Feb 27, 2003 at 09:19:18AM -0800, Reinier Post wrote:
> > So if you have access to other compilers please test and report the
> > results.
> 
> /tmp % cat vargs.c 
> #define x(...) #__VA_ARGS__
> x(a,b)
> /tmp % cc -E vargs.c
> # 1 "vargs.c"
> "vargs.c", line 1: invalid token in #define macro parameters: ...
> # 2
> x(a,b)
> #ident "acomp: WorkShop Compilers 5.0 98/12/15 C 5.0"
> cc: acomp failed for vargs.c
> /tmp %
> 
> (This is Sun Forte C 5.0.)
> 
> I do not see a compiler option for anything related to
> variadic arguments or C99.

Next version without variadic arguments. Tested with gcc and icc6.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  This message has been ROT-13 encrypted twice for extra security.

Index: common/shared.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/shared.c,v
retrieving revision 1.99
diff -u -u -r1.99 shared.c
--- common/shared.c     2003/02/16 17:04:14     1.99
+++ common/shared.c     2003/02/28 08:54:51
@@ -651,7 +651,7 @@
   should only be called for code errors - user errors (like not being able
   to find a tileset) should just exit rather than dumping core.
 ***************************************************************************/
-void die(const char *format, ...)
+void real_die(const char *format, ...)
 {
   va_list ap;
 
Index: common/shared.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v
retrieving revision 1.110
diff -u -u -r1.110 shared.h
--- common/shared.h     2002/12/18 19:05:22     1.110
+++ common/shared.h     2003/02/28 08:54:51
@@ -163,8 +163,14 @@
 int cat_snprintf(char *str, size_t n, const char *format, ...)
      fc__attribute((format (printf, 3, 4)));
 
-void die(const char *format, ...)
-     fc__attribute((format (printf, 1, 2))) fc__attribute((noreturn));
+#define die(format, args...)    \
+  do{                           \
+    real_die(format , ## args); \
+    exit(EXIT_FAILURE);         \
+  } while(0)
+
+void real_die(const char *format, ...)
+     fc__attribute((format (printf, 1, 2)));
 
 char *user_home_dir(void);
 char *user_username(void);

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