Defines

asserts.hpp File Reference

#include <cstdlib>
#include <iostream>
#include <csignal>
Include dependency graph for asserts.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define BREAKPOINT()
#define WES_HALT()   abort()
#define ERROR_LOG(a)
#define ASSERT_LOG(a, b)   if (!(a)) { ERROR_LOG(b); } else (void)0
#define FATAL_ERROR   ERROR_LOG("FATAL ERROR")
#define UNREACHABLE_CODE   ERROR_LOG("REACHED UNREACHABLE CODE")
 Marker for code that should be unreachable.
#define ASSERT_OP(a, op, b)   ASSERT_LOG((a) op (b), #a " " #op " " #b " (" << (a) << " " #op " " << (b) << ")")
#define ASSERT_EQ(a, b)   ASSERT_OP(a,==,b)
#define ASSERT_NE(a, b)   ASSERT_OP(a,!=,b)
#define ASSERT_GE(a, b)   ASSERT_OP(a,>=,b)
#define ASSERT_LE(a, b)   ASSERT_OP(a,<=,b)
#define ASSERT_GT(a, b)   ASSERT_OP(a,>,b)
#define ASSERT_LT(a, b)   ASSERT_OP(a,<,b)

Define Documentation

#define ASSERT_EQ (   a,
  b 
)    ASSERT_OP(a,==,b)

Definition at line 67 of file asserts.hpp.

#define ASSERT_GE (   a,
  b 
)    ASSERT_OP(a,>=,b)

Definition at line 69 of file asserts.hpp.

#define ASSERT_GT (   a,
  b 
)    ASSERT_OP(a,>,b)

Definition at line 71 of file asserts.hpp.

#define ASSERT_LE (   a,
  b 
)    ASSERT_OP(a,<=,b)

Definition at line 70 of file asserts.hpp.

#define ASSERT_LOG (   a,
  b 
)    if (!(a)) { ERROR_LOG(b); } else (void)0
#define ASSERT_LT (   a,
  b 
)    ASSERT_OP(a,<,b)

Definition at line 72 of file asserts.hpp.

#define ASSERT_NE (   a,
  b 
)    ASSERT_OP(a,!=,b)

Definition at line 68 of file asserts.hpp.

#define ASSERT_OP (   a,
  op,
  b 
)    ASSERT_LOG((a) op (b), #a " " #op " " #b " (" << (a) << " " #op " " << (b) << ")")

Definition at line 62 of file asserts.hpp.

#define BREAKPOINT (  ) 

Definition at line 39 of file asserts.hpp.

#define ERROR_LOG (   a  ) 
#define FATAL_ERROR   ERROR_LOG("FATAL ERROR")

Definition at line 52 of file asserts.hpp.

#define UNREACHABLE_CODE   ERROR_LOG("REACHED UNREACHABLE CODE")

Marker for code that should be unreachable.

This can be used to avoid compiler warnings and to detect logic errors in the code.

Definition at line 59 of file asserts.hpp.

#define WES_HALT (  )     abort()

Definition at line 40 of file asserts.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Wed May 23 2012 01:03:41 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs