9787 {
9789
9790 char*
error = header_reader.VerifyVersion();
9791 if (
error !=
nullptr) {
9793 }
9794
9795 const char* features = nullptr;
9796 intptr_t features_length = 0;
9797 error = header_reader.ReadFeatures(&features, &features_length);
9798 if (
error !=
nullptr) {
9800 }
9801
9802 ASSERT(features[features_length] ==
'\0');
9803 const char* cursor = features;
9804 while (*cursor != '\0') {
9805 while (*cursor == ' ') {
9806 cursor++;
9807 }
9808
9809 const char*
end = strstr(cursor,
" ");
9810 if (
end ==
nullptr) {
9811 end = features + features_length;
9812 }
9813
9814#define SET_FLAG(name) \
9815 if (strncmp(cursor, #name, end - cursor) == 0) { \
9816 FLAG_##name = true; \
9817 cursor = end; \
9818 continue; \
9819 } \
9820 if (strncmp(cursor, "no-" #name, end - cursor) == 0) { \
9821 FLAG_##name = false; \
9822 cursor = end; \
9823 continue; \
9824 }
9825
9826#define CHECK_FLAG(name, mode) \
9827 if (strncmp(cursor, #name, end - cursor) == 0) { \
9828 if (!FLAG_##name) { \
9829 return header_reader.BuildError("Flag " #name \
9830 " is true in snapshot, " \
9831 "but " #name \
9832 " is always false in " mode); \
9833 } \
9834 cursor = end; \
9835 continue; \
9836 } \
9837 if (strncmp(cursor, "no-" #name, end - cursor) == 0) { \
9838 if (FLAG_##name) { \
9839 return header_reader.BuildError("Flag " #name \
9840 " is false in snapshot, " \
9841 "but " #name \
9842 " is always true in " mode); \
9843 } \
9844 cursor = end; \
9845 continue; \
9846 }
9847
9848#define SET_P(name, T, DV, C) SET_FLAG(name)
9849
9850#if defined(PRODUCT)
9851#define SET_OR_CHECK_R(name, PV, T, DV, C) CHECK_FLAG(name, "product mode")
9852#else
9853#define SET_OR_CHECK_R(name, PV, T, DV, C) SET_FLAG(name)
9854#endif
9855
9856#if defined(PRODUCT)
9857#define SET_OR_CHECK_C(name, PCV, PV, T, DV, C) CHECK_FLAG(name, "product mode")
9858#elif defined(DART_PRECOMPILED_RUNTIME)
9859#define SET_OR_CHECK_C(name, PCV, PV, T, DV, C) \
9860 CHECK_FLAG(name, "the precompiled runtime")
9861#else
9862#define SET_OR_CHECK_C(name, PV, T, DV, C) SET_FLAG(name)
9863#endif
9864
9865#if !defined(DEBUG)
9866#define SET_OR_CHECK_D(name, T, DV, C) CHECK_FLAG(name, "non-debug mode")
9867#else
9868#define SET_OR_CHECK_D(name, T, DV, C) SET_FLAG(name)
9869#endif
9870
9872
9873#undef SET_OR_CHECK_D
9874#undef SET_OR_CHECK_C
9875#undef SET_OR_CHECK_R
9876#undef SET_P
9877#undef CHECK_FLAG
9878#undef SET_FLAG
9879
9881 }
9882
9883 return nullptr;
9884}
#define SET_OR_CHECK_R(name, PV, T, DV, C)
#define SET_P(name, T, DV, C)
#define SET_OR_CHECK_C(name, PV, T, DV, C)
#define SET_OR_CHECK_D(name, T, DV, C)
const uint8_t uint32_t uint32_t GError ** error
#define VM_GLOBAL_FLAG_LIST(P, R, C, D)