]> https://gitweb.dealii.org/ - dealii.git/commitdiff
AssertNothrow: use the 'if (false)' trick.
authorDavid Wells <drwells@email.unc.edu>
Fri, 23 May 2025 17:01:46 +0000 (13:01 -0400)
committerDavid Wells <drwells@email.unc.edu>
Fri, 23 May 2025 17:01:46 +0000 (13:01 -0400)
This should handle unused variable warnings for all presently supported
compilers - it is the same trick we now use for Assert().

include/deal.II/base/exception_macros.h

index 9ad8f04afae46f624c3d1d15a1391d5cf8c10af0..3aa130c6dae48a9aea2f0e8cb058a8e355b7ab79 100644 (file)
 #  define AssertNothrow(cond, exc) \
     do                             \
       {                            \
+        if (false)                 \
+          if (!(cond))             \
+            {                      \
+            }                      \
       }                            \
     while (false)
 #endif

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.