summaryrefslogtreecommitdiff
path: root/assembler/gen4asm.h
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-01-21 22:12:10 +0000
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:38 +0000
commitc74c80c9a5d2d84c55ba373d2d56ada635467ee6 (patch)
treeac725428e370ab764548d75309276d6138b821e1 /assembler/gen4asm.h
parent79c62f1134b2200fc49c43178d846ecba8e37a7b (diff)
assembler: Make sure nobody adds a field back to struct brw_instruction
Adding something there will break the library, so we might as check for it. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'assembler/gen4asm.h')
-rw-r--r--assembler/gen4asm.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/assembler/gen4asm.h b/assembler/gen4asm.h
index aeb2b9cc..388cc756 100644
--- a/assembler/gen4asm.h
+++ b/assembler/gen4asm.h
@@ -55,6 +55,15 @@ extern long int gen_level;
void yyerror (char *msg);
+#define STRUCT_SIZE_ASSERT(TYPE, SIZE) \
+typedef struct { \
+ char compile_time_assert_ ## TYPE ## _size[ \
+ (sizeof (struct TYPE) == (SIZE)) ? 1 : -1]; \
+ } _ ## TYPE ## SizeCheck
+
+/* ensure nobody changes the size of struct brw_instruction */
+STRUCT_SIZE_ASSERT(brw_instruction, 16);
+
/**
* This structure is the internal representation of directly-addressed
* registers in the parser.