minor cleanups
authorSzabolcs Nagy <nsz@port70.net>
Fri, 28 Jun 2013 20:23:26 +0000 (20:23 +0000)
committerSzabolcs Nagy <nsz@port70.net>
Fri, 28 Jun 2013 20:23:26 +0000 (20:23 +0000)
* 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
src/api/fmtmsg.c
src/api/ndbm.c
src/api/pthread.c
src/api/sys_types.c

index a739442..146499b 100644 (file)
@@ -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
 
index b89d58d..46a2486 100644 (file)
@@ -1,4 +1,4 @@
-#if X_FMTMSG
+#ifdef X_FMTMSG
 #include <fmtmsg.h>
 #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
index 180851f..e06e9b4 100644 (file)
@@ -1,4 +1,4 @@
-#if X_NDBM
+#ifdef X_NDBM
 #include <ndbm.h>
 #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
index 5be34c7..0501380 100644 (file)
@@ -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;}
index f7c634d..d9db5ed 100644 (file)
@@ -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)