source: doc/theses/thierry_delisle_PhD/code/assert.hpp @ 5569a31

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 5569a31 was 50aeb6f, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Small tweaks to the memory layout

  • Property mode set to 100644
File size: 546 bytes
Line 
1#pragma once
2
3#ifndef NDEBUG
4#include <cassert>
5#include <cstdlib>
6
7#define sstr(s) #s
8#define xstr(s) sstr(s)
9
10extern const char * __my_progname;
11
12#define assertf(cond, ...) ({             \
13        if(!(cond)) {                       \
14                fprintf(stderr, "%s: " __FILE__ ":" xstr(__LINE__) ": %s: Assertion '" xstr(cond) "' failed.\n", __my_progname, __PRETTY_FUNCTION__); \
15                fprintf(stderr, __VA_ARGS__); \
16                fprintf(stderr, "\n"); \
17                std::abort();                 \
18        }                                   \
19})
20#else
21#define assertf(cond, ...)
22#endif
Note: See TracBrowser for help on using the repository browser.