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
This commit is contained in:
Lionel Sambuc 2014-09-02 16:57:50 +02:00
parent 20a91f7755
commit 9d3fcac4cd
5 changed files with 6 additions and 14 deletions

View file

@ -1,8 +1,6 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "namespace.h" #include "namespace.h"
#undef NDEBUG
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
@ -122,9 +120,7 @@ ssize_t recvfrom(int sock, void *__restrict buffer, size_t length,
#if DEBUG #if DEBUG
fprintf(stderr, "recvfrom: not implemented for fd %d\n", sock); fprintf(stderr, "recvfrom: not implemented for fd %d\n", sock);
#endif #endif
errno= ENOSYS; abort();
assert(0);
return -1;
} }
static ssize_t _tcp_recvfrom(int sock, void *__restrict buffer, size_t length, static ssize_t _tcp_recvfrom(int sock, void *__restrict buffer, size_t length,

View file

@ -1,8 +1,6 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "namespace.h" #include "namespace.h"
#undef NDEBUG
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -1,8 +1,6 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "namespace.h" #include "namespace.h"
#undef NDEBUG
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>

View file

@ -1,8 +1,6 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "namespace.h" #include "namespace.h"
#undef NDEBUG
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>

View file

@ -19,6 +19,8 @@ static asynmsg_t msgtable[ASYN_NR];
static int first_slot = 0, next_slot = 0; static int first_slot = 0, next_slot = 0;
static int initialized = 0; static int initialized = 0;
#define DEBUG 0
/*===========================================================================* /*===========================================================================*
* asynsend3 * * asynsend3 *
*===========================================================================*/ *===========================================================================*/
@ -54,7 +56,7 @@ int fl;
if ((flags & (AMF_VALID|AMF_DONE)) == (AMF_VALID|AMF_DONE)) { if ((flags & (AMF_VALID|AMF_DONE)) == (AMF_VALID|AMF_DONE)) {
/* Marked in use by us (VALID) and processed by the kernel */ /* Marked in use by us (VALID) and processed by the kernel */
if (msgtable[first_slot].result != OK) { if (msgtable[first_slot].result != OK) {
#if NDEBUG #if DEBUG
printf("asynsend: found entry %d with error %d\n", printf("asynsend: found entry %d with error %d\n",
first_slot, msgtable[first_slot].result); first_slot, msgtable[first_slot].result);
#endif #endif
@ -92,7 +94,7 @@ int fl;
if (msgtable[src_ind].result == OK) if (msgtable[src_ind].result == OK)
continue; continue;
else { else {
#if NDEBUG #if DEBUG
printf( printf(
"asynsend: found entry %d with error %d\n", "asynsend: found entry %d with error %d\n",
src_ind, msgtable[src_ind].result); src_ind, msgtable[src_ind].result);
@ -105,7 +107,7 @@ int fl;
/* Copy/move in use entry */ /* Copy/move in use entry */
#if NDEBUG #if DEBUG
printf("asynsend: copying entry %d to %d\n", src_ind, dst_ind); printf("asynsend: copying entry %d to %d\n", src_ind, dst_ind);
#endif #endif
if (src_ind != dst_ind) msgtable[dst_ind] = msgtable[src_ind]; if (src_ind != dst_ind) msgtable[dst_ind] = msgtable[src_ind];