From: Lionel Sambuc Date: Tue, 2 Sep 2014 14:57:50 +0000 (+0200) Subject: Some more NDEBUG fixes X-Git-Tag: v3.3.0~25 X-Git-Url: http://zhaoyanbai.com/repos/ddns-confgen.html?a=commitdiff_plain;h=9d3fcac4cd94c99d6300bba3ab995f44571a4994;p=minix.git Some more NDEBUG fixes - replace a stray assert(0) with abort() - remove unrequired copy-pasted #undef NDEBUG - replace some #if NDEBUG by #if DEBUG as they protect debug printf()s. Change-Id: Iff4c0331b06e860d32d91ce6b1d6c765ed065c8b --- diff --git a/minix/lib/libc/sys/recvfrom.c b/minix/lib/libc/sys/recvfrom.c index 01d3e48c9..58bba5e46 100644 --- a/minix/lib/libc/sys/recvfrom.c +++ b/minix/lib/libc/sys/recvfrom.c @@ -1,8 +1,6 @@ #include #include "namespace.h" -#undef NDEBUG - #include #include #include @@ -122,9 +120,7 @@ ssize_t recvfrom(int sock, void *__restrict buffer, size_t length, #if DEBUG fprintf(stderr, "recvfrom: not implemented for fd %d\n", sock); #endif - errno= ENOSYS; - assert(0); - return -1; + abort(); } static ssize_t _tcp_recvfrom(int sock, void *__restrict buffer, size_t length, diff --git a/minix/lib/libc/sys/recvmsg.c b/minix/lib/libc/sys/recvmsg.c index 472711a21..f80ae2d27 100644 --- a/minix/lib/libc/sys/recvmsg.c +++ b/minix/lib/libc/sys/recvmsg.c @@ -1,8 +1,6 @@ #include #include "namespace.h" -#undef NDEBUG - #include #include #include diff --git a/minix/lib/libc/sys/sendmsg.c b/minix/lib/libc/sys/sendmsg.c index 4d97f79ac..c0a342b6a 100644 --- a/minix/lib/libc/sys/sendmsg.c +++ b/minix/lib/libc/sys/sendmsg.c @@ -1,8 +1,6 @@ #include #include "namespace.h" -#undef NDEBUG - #include #include #include diff --git a/minix/lib/libc/sys/sendto.c b/minix/lib/libc/sys/sendto.c index f0d6a2811..d7d846913 100644 --- a/minix/lib/libc/sys/sendto.c +++ b/minix/lib/libc/sys/sendto.c @@ -1,8 +1,6 @@ #include #include "namespace.h" -#undef NDEBUG - #include #include #include diff --git a/minix/lib/libsys/asynsend.c b/minix/lib/libsys/asynsend.c index 59ca8b553..3f414712f 100644 --- a/minix/lib/libsys/asynsend.c +++ b/minix/lib/libsys/asynsend.c @@ -19,6 +19,8 @@ static asynmsg_t msgtable[ASYN_NR]; static int first_slot = 0, next_slot = 0; static int initialized = 0; +#define DEBUG 0 + /*===========================================================================* * asynsend3 * *===========================================================================*/ @@ -54,7 +56,7 @@ int fl; if ((flags & (AMF_VALID|AMF_DONE)) == (AMF_VALID|AMF_DONE)) { /* Marked in use by us (VALID) and processed by the kernel */ if (msgtable[first_slot].result != OK) { -#if NDEBUG +#if DEBUG printf("asynsend: found entry %d with error %d\n", first_slot, msgtable[first_slot].result); #endif @@ -92,7 +94,7 @@ int fl; if (msgtable[src_ind].result == OK) continue; else { -#if NDEBUG +#if DEBUG printf( "asynsend: found entry %d with error %d\n", src_ind, msgtable[src_ind].result); @@ -105,7 +107,7 @@ int fl; /* Copy/move in use entry */ -#if NDEBUG +#if DEBUG printf("asynsend: copying entry %d to %d\n", src_ind, dst_ind); #endif if (src_ind != dst_ind) msgtable[dst_ind] = msgtable[src_ind];