Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] (PR#8547) GCC poisoning v2
Home

[Freeciv-Dev] (PR#8547) GCC poisoning v2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8547) GCC poisoning v2
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 19 Apr 2004 14:46:46 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8547 >

Another version of this patch.

What is good: Catch illegal use of non-portables that we have portable
versions for in support.h

What is bad: Moves stuff around without a clear idea of why some stuff
should be here and some there (shared.h vs support.h).

  - Per

Index: common/connection.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/connection.c,v
retrieving revision 1.37
diff -u -r1.37 connection.c
--- common/connection.c 14 Jan 2004 11:58:12 -0000      1.37
+++ common/connection.c 19 Apr 2004 21:42:20 -0000
@@ -17,6 +17,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <stdio.h>
 #include <string.h>
 
 #ifdef HAVE_SYS_SELECT_H
Index: common/netintf.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/netintf.c,v
retrieving revision 1.19
diff -u -r1.19 netintf.c
--- common/netintf.c    25 Jan 2004 13:55:14 -0000      1.19
+++ common/netintf.c    19 Apr 2004 21:42:21 -0000
@@ -23,6 +23,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
Index: common/netintf.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/netintf.h,v
retrieving revision 1.9
diff -u -r1.9 netintf.h
--- common/netintf.h    25 Jan 2004 13:55:14 -0000      1.9
+++ common/netintf.h    19 Apr 2004 21:42:21 -0000
@@ -38,7 +38,6 @@
 #endif
 
 #include "ioz.h"
-#include "shared.h"            /* bool type */
 
 #ifdef FD_ZERO
 #define MY_FD_ZERO FD_ZERO
Index: common/packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.267
diff -u -r1.267 packets.c
--- common/packets.c    14 Jan 2004 11:58:12 -0000      1.267
+++ common/packets.c    19 Apr 2004 21:42:21 -0000
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <assert.h>
 #include <limits.h>
+#include <unistd.h>
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
Index: common/shared.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v
retrieving revision 1.124
diff -u -r1.124 shared.h
--- common/shared.h     10 Apr 2004 03:47:49 -0000      1.124
+++ common/shared.h     19 Apr 2004 21:42:21 -0000
@@ -16,41 +16,11 @@
 #include <stdlib.h>            /* size_t */
 #include <string.h>            /* memset */
 
-#if __BEOS__
-#include <posix/be_prim.h>
-#define __bool_true_false_are_defined 1
-#else
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#else /* Implement <stdbool.h> ourselves */
-#undef bool
-#undef true
-#undef false
-#undef __bool_true_false_are_defined
-#define bool fc_bool
-#define true  1
-#define false 0
-#define __bool_true_false_are_defined 1
-typedef unsigned int fc_bool;
-#endif /* ! HAVE_STDBOOL_H */
-#endif /* ! __BEOS__ */
+#include "support.h"
 
-/* Want to use GCC's __attribute__ keyword to check variadic
- * parameters to printf-like functions, without upsetting other
- * compilers: put any required defines magic here.
- * If other compilers have something equivalent, could also
- * work that out here.   Should this use configure stuff somehow?
- * --dwp
- */
-#if defined(__GNUC__)
-#define fc__attribute(x)  __attribute__(x)
-#else
-#define fc__attribute(x)
-#endif
-
-
-/* Note: the capability string is now in capstr.c --dwp */
-/* Version stuff is now in version.h --dwp */
+/* Poison functions to prevent them from being used (portability) */
+#pragma GCC poison snprintf vsnprintf strcasecmp strncasecmp usleep
+#pragma GCC poison strerror gethostname
 
 #define BUG_EMAIL_ADDRESS "bugs@xxxxxxxxxxxxxxxxxxx"
 #define WEBSITE_URL "http://www.freeciv.org/";
Index: common/support.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/support.c,v
retrieving revision 1.27
diff -u -r1.27 support.c
--- common/support.c    10 Jul 2003 03:34:30 -0000      1.27
+++ common/support.c    19 Apr 2004 21:42:21 -0000
@@ -81,7 +81,6 @@
 
 #include "fcintl.h"
 #include "mem.h"
-#include "netintf.h"
 
 #include "support.h"
 
Index: common/support.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/support.h,v
retrieving revision 1.18
diff -u -r1.18 support.h
--- common/support.h    10 Jul 2003 03:34:30 -0000      1.18
+++ common/support.h    19 Apr 2004 21:42:21 -0000
@@ -20,14 +20,44 @@
   See also mem.h, netintf.h, rand.h, and see support.c for more comments.
 ***********************************************************************/
 
+#if __BEOS__
+#include <posix/be_prim.h>
+#define __bool_true_false_are_defined 1
+#else
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#else /* Implement <stdbool.h> ourselves */
+#undef bool
+#undef true
+#undef false
+#undef __bool_true_false_are_defined
+#define bool fc_bool
+#define true  1
+#define false 0
+#define __bool_true_false_are_defined 1
+typedef unsigned int fc_bool;
+#endif /* ! HAVE_STDBOOL_H */
+#endif /* ! __BEOS__ */
+
+/* Want to use GCC's __attribute__ keyword to check variadic
+ * parameters to printf-like functions, without upsetting other
+ * compilers: put any required defines magic here.
+ * If other compilers have something equivalent, could also
+ * work that out here.   Should this use configure stuff somehow?
+ * --dwp
+ */
+#if defined(__GNUC__)
+#define fc__attribute(x)  __attribute__(x)
+#else
+#define fc__attribute(x)
+#endif
+
 #include <stdarg.h>
 #include <stdlib.h>            /* size_t */
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
-
-#include "shared.h"            /* bool type and fc__attribute */
 
 int mystrcasecmp(const char *str0, const char *str1);
 int mystrncasecmp(const char *str0, const char *str1, size_t n);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8547) GCC poisoning v2, Per I. Mathisen <=