Skip to content

Remove warnings when NDEBUG build option used #4066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cores/esp8266/core_esp8266_postmortem.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern cont_t g_cont;
static const char* s_panic_file = 0;
static int s_panic_line = 0;
static const char* s_panic_func = 0;
static const char* s_panic_what = 0;

static bool s_abort_called = false;

Expand Down Expand Up @@ -85,6 +86,11 @@ void __wrap_system_restart_local() {
ets_puts_P(s_panic_file);
ets_printf(":%d ", s_panic_line);
ets_puts_P(s_panic_func);
if (s_panic_what) {
ets_puts_P(PSTR(": Assertion '"));
ets_puts_P(s_panic_what);
ets_puts_P(PSTR("' failed."));
}
ets_puts_P(PSTR("\n"));
}
else if (s_abort_called) {
Expand Down Expand Up @@ -203,10 +209,10 @@ void abort(){
}

void __assert_func(const char *file, int line, const char *func, const char *what) {
(void) what;
s_panic_file = file;
s_panic_line = line;
s_panic_func = func;
s_panic_what = what;
gdb_do_break();
}

Expand Down
1 change: 1 addition & 0 deletions libraries/ESP8266WiFi/src/include/ClientContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ class ClientContext
err_t _connected(struct tcp_pcb *pcb, err_t err)
{
(void) err;
(void) pcb;
assert(pcb == _pcb);
assert(_connect_pending);
esp_schedule();
Expand Down
3 changes: 3 additions & 0 deletions libraries/ESP8266WiFi/src/include/DataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ class BufferDataSource : public DataSource {

const uint8_t* get_buffer(size_t size) override
{
(void) size;
assert(_pos + size <= _size);
return _data + _pos;
}

void release_buffer(const uint8_t* buffer, size_t size) override
{
(void) buffer;
assert(buffer == _data + _pos);
_pos += size;
}
Expand Down Expand Up @@ -69,6 +71,7 @@ class BufferedStreamDataSource : public DataSource {
_bufferSize = size;
}
size_t cb = _stream.readBytes(reinterpret_cast<char*>(_buffer.get()), size);
(void) cb;
assert(cb == size);
return _buffer.get();
}
Expand Down
2 changes: 1 addition & 1 deletion tools/sdk/libc/xtensa-lx106-elf/include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {
# define assert(__e) ((void)0)
#else
# define assert(__e) ((__e) ? (void)0 : __assert_func (PSTR(__FILE__), __LINE__, \
__ASSERT_FUNC, #__e))
__ASSERT_FUNC, PSTR(#__e)))

# ifndef __ASSERT_FUNC
/* Use g++'s demangled names in C++. */
Expand Down