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.2 by sf-pippijn, Mon Oct 18 14:11:42 2010 UTC vs.
Revision 1.4 by sf-pippijn, Tue Oct 19 09:45:03 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines