Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Better output for validating size assert
  • Loading branch information
Filip Gawin committed Jan 22, 2021
1 parent d77846b commit 609cad506ff43f3333b61f5ff39d1ec494eba42e
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/core/common.h
@@ -364,8 +364,11 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
#define _TODO(x)
#define _TODOCONST(x) (x)

#ifdef CHECK_STRUCT_SIZES
#define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc)
#if CHECK_STRUCT_SIZES
template<int s, int t> struct check_size {
static_assert(s == t, "Invalid structure size");
};
#define VALIDATE_SIZE(struc, size) check_size<sizeof(struc), size> struc ## Check
#else
#define VALIDATE_SIZE(struc, size)
#endif

0 comments on commit 609cad5

Please sign in to comment.