ken-sheppard / open-vcdiff

Automatically exported from code.google.com/p/open-vcdiff
Apache License 2.0
0 stars 0 forks source link

VCD_COMPILE_ASSERT warns with -Wunused-local-typedef #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Both gcc and clang warn on unused typedefs in recent versions. 
VCD_COMPILE_ASSERT triggers this. Please apply this patch to fix this for 
projects using c++11 (like e.g. chromium):

diff --git a/src/compile_assert.h b/src/compile_assert.h
index 3f4344f..86a1269 100644
--- a/src/compile_assert.h
+++ b/src/compile_assert.h
@@ -46,9 +46,13 @@ struct CompileAssert {

 }  // namespace open_vcdiff

+#if __cplusplus >= 201103L
+#define VCD_COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
+#else
 #define VCD_COMPILE_ASSERT(expr, msg) \
   typedef open_vcdiff::CompileAssert<static_cast<bool>(expr)> \
       msg[static_cast<bool>(expr) ? 1 : -1]
+#endif

 // Implementation details of VCD_COMPILE_ASSERT:
 //

Original issue reported on code.google.com by thakis@chromium.org on 23 Sep 2014 at 2:28

GoogleCodeExporter commented 9 years ago

Original comment by thakis@chromium.org on 23 Sep 2014 at 2:29