tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CheckOffsets.h
Go to the documentation of this file.
1 /**
2  * Copyright (C) 2011
3  * University of Rochester Department of Computer Science
4  * and
5  * Lehigh University Department of Computer Science and Engineering
6  *
7  * License: Modified BSD
8  * Please see the file LICENSE.RSTM for licensing information
9  */
10 
11 #ifndef STM_ITM2STM_CHECK_OFFSETS_H
12 #define STM_ITM2STM_CHECK_OFFSETS_H
13 
14 // -----------------------------------------------------------------------------
15 // Defines some static checking functionality so that we can verify that our ASM
16 // offsets are valid. They could be invalidated based on struct layout
17 // changes. The correct offsets can be found by making the fake_begin target,
18 // and examining the asm.
19 //
20 // In reality, offsets.h should be a configure-time built header, but we don't
21 // really have the resources set up for that at the moment.
22 // -----------------------------------------------------------------------------
23 
24 #include "offsets.h" // platform-specific implementation
25 
26 #ifndef __GXX_EXPERIMENTAL_CXX0X__
27 #define FUNC2(x,y) x##y
28 #define FUNC1(x,y) FUNC2(x,y)
29 #define FUNC(x) FUNC1(x,__COUNTER__)
30 #define ASSERT_OFFSET(L, R) \
31  typedef char FUNC(OFFSET_CHECK_FAILED)[(L == R) ? 1 : -1];
32 #else
33 #define ASSERT_OFFSET(L, R) static_assert(L == R, "Offset check failed.")
34 #endif
35 
36 #endif // STM_ITM2STM_CHECK_OFFSETS_H