From 0e7278ad5b6cf23689731bad23bf612f8af63e3d Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Fri, 4 Mar 2016 11:29:37 +0000 Subject: [PATCH] StaticAssert: Avoid unused typedef messages from gcc --- src/OpenFOAM/db/error/StaticAssert.H | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/error/StaticAssert.H b/src/OpenFOAM/db/error/StaticAssert.H index c6cf1e7b231..58fa86c170d 100644 --- a/src/OpenFOAM/db/error/StaticAssert.H +++ b/src/OpenFOAM/db/error/StaticAssert.H @@ -67,12 +67,18 @@ class StaticAssertionTest {}; #define StaticAssertMacro1(X,Y) StaticAssertMacro2(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 #define StaticAssert(Test) \ typedef ::Foam::StaticAssertionTest \ < \ sizeof( ::Foam::StaticAssertionFailed<((Test) ? true : false)>) \ - > StaticAssertMacro(StaticAssertionTest, __LINE__) + > StaticAssertMacro(StaticAssertionTest, __LINE__) StaticAssertUnusedTypedef // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -- GitLab