Index: util/misc/initialization_state_dcheck.h |
diff --git a/util/misc/initialization_state_dcheck.h b/util/misc/initialization_state_dcheck.h |
index 88f7ac1e9a946da993f348078a30c5ec111c2cd5..dd717709e0ac68c092e72bcbbc1c0b93a8e48aab 100644 |
--- a/util/misc/initialization_state_dcheck.h |
+++ b/util/misc/initialization_state_dcheck.h |
@@ -18,7 +18,9 @@ |
//! \file |
#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
#include "base/logging.h" |
+#include "build/build_config.h" |
#include "util/misc/initialization_state.h" |
namespace crashpad { |
@@ -154,6 +156,11 @@ class InitializationStateDcheck : public InitializationState { |
#else |
+#if defined(COMPILER_MSVC) |
+// bool[0] (below) is not accepted by MSVC. |
+struct InitializationStateDcheck { |
+}; |
+#else |
// Since this is to be used as a DCHECK (for debugging), it should be |
// non-intrusive in non-DCHECK (non-debug, release) builds. An empty struct |
// would still have a nonzero size (rationale: |
@@ -163,6 +170,7 @@ class InitializationStateDcheck : public InitializationState { |
// and they can be “initialized” with the same () syntax used to initialize |
// objects of the DCHECK_IS_ON InitializationStateDcheck class above. |
using InitializationStateDcheck = bool[0]; |
+#endif // COMPILER_MSVC |
namespace internal { |
Mark Mentovai
2015/02/11 21:37:54
Delete this whole thing now too, it’s unused.
scottmg
2015/02/11 21:38:55
Done.
|
@@ -175,18 +183,14 @@ inline bool EatInitializationState(const InitializationStateDcheck*) { |
} // namepspace internal |
-// The contents of these DCHECKs will never be evaluated, but they make use of |
-// initialization_state_dcheck to avoid triggering -Wunused-private-field |
-// warnings. |
+// Avoid triggering warnings by repurposing these macros when DCHECKs are |
+// disabled. |
#define INITIALIZATION_STATE_SET_INITIALIZING(initialization_state_dcheck) \ |
- DCHECK(::crashpad::internal::EatInitializationState( \ |
- &(initialization_state_dcheck))) |
+ ALLOW_UNUSED_LOCAL(initialization_state_dcheck) |
#define INITIALIZATION_STATE_SET_VALID(initialization_state_dcheck) \ |
- DCHECK(::crashpad::internal::EatInitializationState( \ |
- &(initialization_state_dcheck))) |
+ ALLOW_UNUSED_LOCAL(initialization_state_dcheck) |
#define INITIALIZATION_STATE_DCHECK_VALID(initialization_state_dcheck) \ |
- DCHECK(::crashpad::internal::EatInitializationState( \ |
- &(initialization_state_dcheck))) |
+ ALLOW_UNUSED_LOCAL(initialization_state_dcheck) |
#endif |