ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/dclient/include/compiler.h
(Generate patch)

Comparing deliantra/dclient/include/compiler.h (file contents):
Revision 1.3 by sf-pippijn, Mon Oct 18 15:34:21 2010 UTC vs.
Revision 1.4 by sf-pippijn, Tue Oct 19 09:45:03 2010 UTC

4 4
5#include "adt/foreach.h" 5#include "adt/foreach.h"
6#include "adt/nullptr.h" 6#include "adt/nullptr.h"
7#include "adt/logs.h" 7#include "adt/logs.h"
8 8
9void log_failure (char const *file, int line, char const *func, char const *cond);
10
11#define LOC __FILE__, __LINE__, __func__
12
9#define return_unless(cond) \ 13#define return_unless(cond) \
10 do { \ 14 do { \
11 if (!(cond)) \ 15 if (!(cond)) \
12 { LOG ("error") << #cond << '\n'; \ 16 { log_failure (LOC, #cond); \
13 return; } \ 17 return; } \
14 } while (0) 18 } while (0)
15 19
16#define return_val_unless(cond, val) \ 20#define return_val_unless(cond, val) \
17 do { \ 21 do { \
18 if (!(cond)) \ 22 if (!(cond)) \
19 { LOG ("error") << #cond << '\n'; \ 23 { log_failure (LOC, #cond); \
20 return val; } \ 24 return val; } \
21 } while (0) 25 } while (0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines