r3916 - in trunk: . birnet birnet/tests



Author: timj
Date: 2006-09-27 19:27:03 -0400 (Wed, 27 Sep 2006)
New Revision: 3916

Modified:
   trunk/NEWS
   trunk/birnet/ChangeLog
   trunk/birnet/birnetcore.h
   trunk/birnet/birnetmsg.h
   trunk/birnet/birnetthread.h
   trunk/birnet/tests/threads.cc
Log:
Thu Sep 28 01:01:55 2006  Tim Janik  <timj gtk org>

        * birnetcore.h: introduce BIRNET_CONSTRUCTOR which wraps gcc's 
        "constructor" argument. as a work around for gcc-3.3, which tends
        to forget to emit code for static constructor functions if 
        -finline-functions is activated, also add attribute "used".

        * birnetthread.h:
        * birnetmsg.h: use BIRNET_CONSTRUCTOR to declare constructor functions.

        * tests/threads.cc: added a check for proper constructor function
        invokation before main().




Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2006-09-27 20:48:40 UTC (rev 3915)
+++ trunk/NEWS	2006-09-27 23:27:03 UTC (rev 3916)
@@ -1,3 +1,7 @@
+Overview of Changes in BEAST/BSE 0.7.1:
+
+* Fixes for gcc-3.3
+
 Overview of Changes in BEAST/BSE 0.7.0:
 
 * Renamed scheme shell to bsescm

Modified: trunk/birnet/ChangeLog
===================================================================
--- trunk/birnet/ChangeLog	2006-09-27 20:48:40 UTC (rev 3915)
+++ trunk/birnet/ChangeLog	2006-09-27 23:27:03 UTC (rev 3916)
@@ -1,3 +1,16 @@
+Thu Sep 28 01:01:55 2006  Tim Janik  <timj gtk org>
+
+	* birnetcore.h: introduce BIRNET_CONSTRUCTOR which wraps gcc's 
+	"constructor" argument. as a work around for gcc-3.3, which tends
+	to forget to emit code for static constructor functions if 
+	-finline-functions is activated, also add attribute "used".
+
+	* birnetthread.h:
+	* birnetmsg.h: use BIRNET_CONSTRUCTOR to declare constructor functions.
+
+	* tests/threads.cc: added a check for proper constructor function
+	invokation before main().
+
 Mon Sep 25 02:10:43 2006  Tim Janik  <timj gtk org>
 
 	* birnetsignalslot.hh: fixed reference handling for Data slots, so

Modified: trunk/birnet/birnetcore.h
===================================================================
--- trunk/birnet/birnetcore.h	2006-09-27 20:48:40 UTC (rev 3915)
+++ trunk/birnet/birnetcore.h	2006-09-27 23:27:03 UTC (rev 3916)
@@ -114,6 +114,7 @@
 #define BIRNET_DEPRECATED                       __attribute__ ((__deprecated__))
 #define BIRNET_ALWAYS_INLINE			__attribute__ ((always_inline))
 #define BIRNET_NEVER_INLINE			__attribute__ ((noinline))
+#define BIRNET_CONSTRUCTOR			__attribute__ ((constructor,used)) /* gcc-3.3 also needs "used" */
 #else   /* !__GNUC__ */
 #define BIRNET_PRETTY_FUNCTION                  (__func__)
 #define BIRNET_PURE
@@ -128,7 +129,8 @@
 #define BIRNET_DEPRECATED
 #define BIRNET_ALWAYS_INLINE
 #define BIRNET_NEVER_INLINE
-#error  Failed to detect a recent GCC version (>= 3.1)
+#define BIRNET_CONSTRUCTOR
+#error  Failed to detect a recent GCC version (>= 3.3)
 #endif  /* !__GNUC__ */
 
 /* --- convenient type shorthands --- */

Modified: trunk/birnet/birnetmsg.h
===================================================================
--- trunk/birnet/birnetmsg.h	2006-09-27 20:48:40 UTC (rev 3915)
+++ trunk/birnet/birnetmsg.h	2006-09-27 23:27:03 UTC (rev 3916)
@@ -143,7 +143,7 @@
   do { BirnetMsgType __mt = lvl; if (birnet_msg_check (__mt)) birnet_msg_log_printf (dom, __mt, __VA_ARGS__); } while (0)
 #define BIRNET_MSG_TYPE__DEF(variable, identifier, default_ouput, label) \
   BirnetMsgType variable = (BirnetMsgType) 0; \
-  static void __attribute__ ((constructor)) \
+  static void BIRNET_CONSTRUCTOR \
   BIRNET_CPP_PASTE4 (__birnet_msg_type__init, __LINE__, __, variable) (void) \
   { variable = birnet_msg_type_register (identifier, default_ouput, label); }
 

Modified: trunk/birnet/birnetthread.h
===================================================================
--- trunk/birnet/birnetthread.h	2006-09-27 20:48:40 UTC (rev 3915)
+++ trunk/birnet/birnetthread.h	2006-09-27 23:27:03 UTC (rev 3916)
@@ -200,17 +200,17 @@
 void  birnet_cond__unchain         (BirnetCond *cond);
 #define BIRNET_MUTEX__DECLARE_INITIALIZED(mutexname)                            \
   BirnetMutex mutexname = { 0 };                                                \
-  static void __attribute__ ((constructor))                                     \
+  static void BIRNET_CONSTRUCTOR                                     		\
   BIRNET_CPP_PASTE4 (__birnet_mutex__autoinit, __LINE__, __, mutexname) (void)	\
   { birnet_mutex__chain4init (&mutexname); }
 #define BIRNET_REC_MUTEX__DECLARE_INITIALIZED(recmtx)                           \
   BirnetRecMutex recmtx = { { 0 } };                                            \
-  static void __attribute__ ((constructor))                                     \
+  static void BIRNET_CONSTRUCTOR                                     		\
   BIRNET_CPP_PASTE4 (__birnet_rec_mutex__autoinit, __LINE__, __, recmtx) (void)	\
   { birnet_rec_mutex__chain4init (&recmtx); }
 #define BIRNET_COND__DECLARE_INITIALIZED(condname)                              \
   BirnetCond condname = { 0 };                                                  \
-  static void __attribute__ ((constructor))                                     \
+  static void BIRNET_CONSTRUCTOR                                     		\
   BIRNET_CPP_PASTE4 (__birnet_cond__autoinit, __LINE__, __, condname) (void)	\
   { birnet_cond__chain4init (&condname); }
 

Modified: trunk/birnet/tests/threads.cc
===================================================================
--- trunk/birnet/tests/threads.cc	2006-09-27 20:48:40 UTC (rev 3915)
+++ trunk/birnet/tests/threads.cc	2006-09-27 23:27:03 UTC (rev 3916)
@@ -16,7 +16,7 @@
  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  * Boston, MA 02111-1307, USA.
  */
-// #define TEST_VERBOSE
+//#define TEST_VERBOSE
 #include <birnet/birnettests.h>
 
 namespace {
@@ -815,10 +815,21 @@
 
 } // Anon
 
+static guint constructur_attribute_test = 0;
+
+static void BIRNET_CONSTRUCTOR
+constructur_attribute_test_initializer (void)
+{
+  constructur_attribute_test = 0x1237ABBA;
+}
+
 int
 main (int   argc,
       char *argv[])
 {
+  if (constructur_attribute_test != 305638330)
+    g_error ("%s: static constructors have not been called before main", G_STRFUNC);
+
   test_before_thread_init();
 
   birnet_init_test (&argc, &argv);




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]