summaryrefslogtreecommitdiffstats
path: root/Tests/IncludeTest
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-06-10 21:54:41 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-06-10 21:54:41 +0000
commite0d30b2e8a50adefcfa299b6cce8ec44056c2638 (patch)
treee3b0603b5311b3fd77615dec99a9fd32fcf81825 /Tests/IncludeTest
parentAdded static tests to catch base class misalginment issues (diff)
downloadDiligentCore-e0d30b2e8a50adefcfa299b6cce8ec44056c2638.tar.gz
DiligentCore-e0d30b2e8a50adefcfa299b6cce8ec44056c2638.zip
Fixed few alignment-related issues (API Version 240063)
Diffstat (limited to 'Tests/IncludeTest')
-rw-r--r--Tests/IncludeTest/GraphicsEngine/GraphicsTypesH_test.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Tests/IncludeTest/GraphicsEngine/GraphicsTypesH_test.cpp b/Tests/IncludeTest/GraphicsEngine/GraphicsTypesH_test.cpp
index c78f7a9f..d5c39436 100644
--- a/Tests/IncludeTest/GraphicsEngine/GraphicsTypesH_test.cpp
+++ b/Tests/IncludeTest/GraphicsEngine/GraphicsTypesH_test.cpp
@@ -65,12 +65,19 @@ namespace
// When compiling S2 with x64 gcc, it will place 'b' right after 'a', not after the end of struct S1.
// We try to catch such issues below
+
+#ifdef __GNUC__
+// Disable GCC warnings like this one:
+// warning: offsetof within non-standard-layout type ‘Diligent::{anonymous}::DeviceObjectAttribs is conditionally-supported [-Winvalid-offsetof]
+# pragma GCC diagnostic ignored "-Winvalid-offsetof"
+#endif
+
#define CHECK_BASE_STRUCT_ALIGNMENT(StructName) \
struct StructName##Test : StructName \
{ \
Uint8 AlignmentTest; \
}; \
- static_assert(offsetof(StructName##Test, AlignmentTest) == sizeof(StructName), "Using " #StructName " as a base class causes misalignment")
+ static_assert(offsetof(StructName##Test, AlignmentTest) == sizeof(StructName), "Using " #StructName " as a base class may result in misalignment")
CHECK_BASE_STRUCT_ALIGNMENT(DeviceObjectAttribs);
CHECK_BASE_STRUCT_ALIGNMENT(EngineCreateInfo);