Skip to content
Snippets Groups Projects
Commit 0e7278ad authored by Henry Weller's avatar Henry Weller
Browse files

StaticAssert: Avoid unused typedef messages from gcc

parent 0f49eb44
No related merge requests found
...@@ -67,12 +67,18 @@ class StaticAssertionTest {}; ...@@ -67,12 +67,18 @@ class StaticAssertionTest {};
#define StaticAssertMacro1(X,Y) StaticAssertMacro2(X,Y) #define StaticAssertMacro1(X,Y) StaticAssertMacro2(X,Y)
#define StaticAssertMacro2(X,Y) X##Y #define StaticAssertMacro2(X,Y) X##Y
#ifdef __GNUC__
#define StaticAssertUnusedTypedef __attribute__((unused))
#else
#define StaticAssertUnusedTypedef
#endif
//- Assert that some test is true at compile-time //- Assert that some test is true at compile-time
#define StaticAssert(Test) \ #define StaticAssert(Test) \
typedef ::Foam::StaticAssertionTest \ typedef ::Foam::StaticAssertionTest \
< \ < \
sizeof( ::Foam::StaticAssertionFailed<((Test) ? true : false)>) \ sizeof( ::Foam::StaticAssertionFailed<((Test) ? true : false)>) \
> StaticAssertMacro(StaticAssertionTest, __LINE__) > StaticAssertMacro(StaticAssertionTest, __LINE__) StaticAssertUnusedTypedef
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment