Stop MSVC from complaining about flexible array members.
Fixes #99.
Change-Id: I44bd11902440bd0a74e22ac90aae0d9550dd056a
Reviewed-on: https://code-review.googlesource.com/5161
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/dfa.cc b/re2/dfa.cc
index b2a162e..483f678 100644
--- a/re2/dfa.cc
+++ b/re2/dfa.cc
@@ -726,7 +726,12 @@
mutex_.AssertHeld();
// Look in the cache for a pre-existing state.
- State state = {inst, ninst, flag};
+ // We have to initialise the struct like this because otherwise
+ // MSVC will complain about the flexible array member. :(
+ State state;
+ state.inst_ = inst;
+ state.ninst_ = ninst;
+ state.flag_ = flag;
StateSet::iterator it = state_cache_.find(&state);
if (it != state_cache_.end()) {
if (DebugDFA)
diff --git a/util/util.h b/util/util.h
index 1e78aa3..c75fad0 100644
--- a/util/util.h
+++ b/util/util.h
@@ -58,6 +58,8 @@
#define strtoull _strtoui64
#define vsnprintf vsnprintf_s
+#pragma warning(disable: 4200) // zero-sized array
+
#endif
namespace re2 {