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 "namespace.h"
#undef NDEBUG
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
@ -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,

View file

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

View file

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

View file

@ -1,8 +1,6 @@
#include <sys/cdefs.h>
#include "namespace.h"
#undef NDEBUG
#include <assert.h>
#include <errno.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 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];