Index: ossp-pkg/pth/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/pth/ChangeLog,v rcsdiff -q -kk '-r1.616' '-r1.617' -u '/v/ossp/cvs/ossp-pkg/pth/ChangeLog,v' 2>/dev/null --- 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 ] + *) Fixed prototype for pthread_attr_setschedparam(3) from to use a "const struct sched_param *" argument. [Rafael Ávila de Espíndola ] Index: ossp-pkg/pth/pth_event.c RCS File: /v/ossp/cvs/ossp-pkg/pth/pth_event.c,v rcsdiff -q -kk '-r1.63' '-r1.64' -u '/v/ossp/cvs/ossp-pkg/pth/pth_event.c,v' 2>/dev/null --- 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;