Add --disable-assert support for the library

Let configure enable (the default) or disable assert() code.

configure.ac:

Add in --enable-assert (the default) / --disable-assert support in libcoap.
Previously this was always enabled unless -DNDEBUG was passed in as a compiler
option.  Now NDEBUG is set or unset as appropriate in coap_config.h
This does not affect how assert()s work within the examples etc., only in the
library.

TODO:

HAVE_ASSERT_H is now cleaned up, so remove entry.

include/coap2/coap_internal.h:

Include assert.h for the library.

include/coap2/coap_io.h:
include/coap2/net.h:
include/coap2/resource.h:
src/address.c:
src/block.c:
src/coap_debug.c:
src/encode.c:
src/mem.c:
src/option.c:
src/pdu.c:
src/subscribe.c:
src/uri.c:

Remove un-needed '#include <assert.h>'
Note: address.h and utlist.h still include assert.h as there are assert()
within the header files.

examples/client.c:
src/coap_io.c:
src/coap_session.c:
src/net.c:
src/pdu.c:
src/resource.c:
src/str.c:

Remove any '#ifndef NDEBUG' wrappers for coap_log() output as they were true
before, but may not be now.
This commit is contained in:
Jon Shallow committed 2019-09-20 13:09:56 +01:00
1 parent 98cf51eae2
commit 8faa8c28ff
21 files changed
+13 -66

No files matched your search

-4
View File
@@ -8,10 +8,6 @@
#include "coap_internal.h"
#ifndef NDEBUG
# include <stdio.h>
#endif
/* Carsten suggested this when fls() is not available: */
#ifndef HAVE_FLS
int coap_fls(unsigned int i) {