OSSP CVS Repository

ossp - Check-in [4700]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4700
Date: 2004-Sep-12 13:27:32 (local)
2004-Sep-12 11:27:32 (UTC)
User:rse
Branch:
Comment: Workaround GCC 2.x and 3.5 (3.4 worked fine) macro parsing behaviour by using a pre-declared function pointer type "typedef int (*pth_event_func_t)(void *);" instead of using an inlined "int (*)(void *)".

Triggered by a report from: Robert Anderson <RWA@sbcglobal.net>

Tickets:
Inspections:
Files:
ossp-pkg/pth/ChangeLog      1.616 -> 1.617     6 inserted, 0 deleted
ossp-pkg/pth/pth_event.c      1.63 -> 1.64     17 inserted, 13 deleted

ossp-pkg/pth/ChangeLog 1.616 -> 1.617

--- ChangeLog    2004/09/12 09:28:04     1.616
+++ ChangeLog    2004/09/12 11:27:32     1.617
@@ -21,6 +21,12 @@
                   
   Changes between 2.0.1 and 2.0.2 (13-Jul-2003 to xx-XXX-2004)
 
+   *) Workaround GCC 2.x and 3.5 (3.4 worked fine) macro parsing
+      behaviour by using a pre-declared function pointer type "typedef
+      int (*pth_event_func_t)(void *);" instead of using an inlined 
+      "int (*)(void *)".
+      [Ralf S. Engelschall, Robert Anderson <RWA@sbcglobal.net>]
+
    *) Fixed prototype for pthread_attr_setschedparam(3) from
       to use a "const struct sched_param *" argument.
       [Rafael Ávila de Espíndola <rafael.espindola@ic.unicamp.br>]


ossp-pkg/pth/pth_event.c 1.63 -> 1.64

--- pth_event.c  2004/07/13 11:00:43     1.63
+++ pth_event.c  2004/09/12 11:27:32     1.64
@@ -30,6 +30,10 @@
 
 #if cpp
 
+/* pre-declare type of function event callback
+   (mainly to workaround va_arg(3) problems below) */
+typedef int (*pth_event_func_t)(void *);
+
 /* event structure */
 struct pth_event_st {
     struct pth_event_st *ev_next;
@@ -38,15 +42,15 @@
     int ev_type;
     int ev_goal;
     union {
-        struct { int fd; }                                        FD;
-        struct { int *n; int nfd; fd_set *rfds, *wfds, *efds; }   SELECT;
-        struct { sigset_t *sigs; int *sig; }                      SIGS;
-        struct { pth_time_t tv; }                                 TIME;
-        struct { pth_msgport_t mp; }                              MSG;
-        struct { pth_mutex_t *mutex; }                            MUTEX;
-        struct { pth_cond_t *cond; }                              COND;
-        struct { pth_t tid; }                                     TID;
-        struct { int (*func)(void *); void *arg; pth_time_t tv; } FUNC;
+        struct { int fd; }                                          FD;
+        struct { int *n; int nfd; fd_set *rfds, *wfds, *efds; }     SELECT;
+        struct { sigset_t *sigs; int *sig; }                        SIGS;
+        struct { pth_time_t tv; }                                   TIME;
+        struct { pth_msgport_t mp; }                                MSG;
+        struct { pth_mutex_t *mutex; }                              MUTEX;
+        struct { pth_cond_t *cond; }                                COND;
+        struct { pth_t tid; }                                       TID;
+        struct { pth_event_func_t func; void *arg; pth_time_t tv; } FUNC;
     } ev_args;
 };
 
@@ -196,7 +200,7 @@
         /* custom function event */
         ev->ev_type = PTH_EVENT_FUNC;
         ev->ev_goal = (int)(spec & (PTH_UNTIL_OCCURRED));
-        ev->ev_args.FUNC.func  = va_arg(ap, int (*)(void *));
+        ev->ev_args.FUNC.func  = va_arg(ap, pth_event_func_t);
         ev->ev_args.FUNC.arg   = va_arg(ap, void *);
         ev->ev_args.FUNC.tv    = va_arg(ap, pth_time_t);
     }
@@ -266,9 +270,9 @@
     }
     else if (ev->ev_type & PTH_EVENT_FUNC) {
         /* custom function event */
-        int (**func)(void *) = va_arg(ap, int (**)(void *));
-        void **arg           = va_arg(ap, void **);
-        pth_time_t *tv       = va_arg(ap, pth_time_t *);
+        pth_event_func_t *func = va_arg(ap, pth_event_func_t *);
+        void **arg             = va_arg(ap, void **);
+        pth_time_t *tv         = va_arg(ap, pth_time_t *);
         *func = ev->ev_args.FUNC.func;
         *arg  = ev->ev_args.FUNC.arg;
         *tv   = ev->ev_args.FUNC.tv;

CVSTrac 2.0.1