source: doc/theses/thierry_delisle_PhD/code/readyQ_proto/assert.hpp @ 26d40a1

Last change on this file since 26d40a1 was f9f3775, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Moved phd code for the readQ prototype to it's own folder

  • 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.