From 88de36005b4753800bc19689e6e5a5e83bf751fc Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Fri, 28 Jun 2013 20:23:26 +0000 Subject: [PATCH] minor cleanups * timer_t is not necessarily a numeric type * pthread_cleanup_* may not be defined as function * use #ifdef instead of #if when possible --- src/api/Makefile | 1 + src/api/fmtmsg.c | 4 +++- src/api/ndbm.c | 4 +++- src/api/pthread.c | 4 ++++ src/api/sys_types.c | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/api/Makefile b/src/api/Makefile index a739442..146499b 100644 --- a/src/api/Makefile +++ b/src/api/Makefile @@ -15,6 +15,7 @@ run: all.err all.err: $(ERR) LC_ALL=C $(CC) $(LDFLAGS) -o main *.o 2>main.err || true cat $(ERR) |\ + grep -v 'In function .f.' |\ grep -v 'Each undeclared identifier is reported only once' |\ grep -v 'for each function it appears in' >$@ || true diff --git a/src/api/fmtmsg.c b/src/api/fmtmsg.c index b89d58d..46a2486 100644 --- a/src/api/fmtmsg.c +++ b/src/api/fmtmsg.c @@ -1,4 +1,4 @@ -#if X_FMTMSG +#ifdef X_FMTMSG #include #define C(n) switch(n){case n:;} static void f() @@ -24,4 +24,6 @@ C(MM_NOMSG) C(MM_NOCON) {int(*p)(long,const char*,int,const char*,const char*,const char*) = fmtmsg;} } +#else +static void f(){} #endif diff --git a/src/api/ndbm.c b/src/api/ndbm.c index 180851f..e06e9b4 100644 --- a/src/api/ndbm.c +++ b/src/api/ndbm.c @@ -1,4 +1,4 @@ -#if X_NDBM +#ifdef X_NDBM #include #define T(t) (t*)0; #define F(t,n) {t *y = &x.n;} @@ -24,4 +24,6 @@ C(DBM_REPLACE) {DBM*(*p)(const char*,int,mode_t) = dbm_open;} {int(*p)(DBM*,datum,datum,int) = dbm_store;} } +#else +static void f(){} #endif diff --git a/src/api/pthread.c b/src/api/pthread.c index 5be34c7..0501380 100644 --- a/src/api/pthread.c +++ b/src/api/pthread.c @@ -68,8 +68,12 @@ C(PTHREAD_SCOPE_SYSTEM) {int(*p)(pthread_barrierattr_t*) = pthread_barrierattr_init;} {int(*p)(pthread_barrierattr_t*,int) = pthread_barrierattr_setpshared;} {int(*p)(pthread_t) = pthread_cancel;} +#ifndef pthread_cleanup_pop {void(*p)(int) = pthread_cleanup_pop;} +#endif +#ifndef pthread_cleanup_push {void(*p)(void(*)(void*),void*) = pthread_cleanup_push;} +#endif {int(*p)(pthread_cond_t*) = pthread_cond_broadcast;} {int(*p)(pthread_cond_t*) = pthread_cond_destroy;} {int(*p)(pthread_cond_t*restrict,const pthread_condattr_t*restrict) = pthread_cond_init;} diff --git a/src/api/sys_types.c b/src/api/sys_types.c index f7c634d..d9db5ed 100644 --- a/src/api/sys_types.c +++ b/src/api/sys_types.c @@ -18,7 +18,7 @@ N(pid_t) N(size_t) N(ssize_t) N(time_t) -N(timer_t) +T(timer_t) N(uid_t) #ifdef _XOPEN_SOURCE N(fsblkcnt_t) -- 2.20.1