9839 {
9841
9842 char*
error = header_reader.VerifyVersion();
9843 if (
error !=
nullptr) {
9845 }
9846
9847 const char* features = nullptr;
9848 intptr_t features_length = 0;
9849 error = header_reader.ReadFeatures(&features, &features_length);
9850 if (
error !=
nullptr) {
9852 }
9853
9854 ASSERT(features[features_length] ==
'\0');
9855 const char* cursor = features;
9856 while (*cursor != '\0') {
9857 while (*cursor == ' ') {
9858 cursor++;
9859 }
9860
9861 const char*
end = strstr(cursor,
" ");
9862 if (end == nullptr) {
9863 end = features + features_length;
9864 }
9865
9866#define SET_FLAG(name) \
9867 if (strncmp(cursor, #name, end - cursor) == 0) { \
9868 FLAG_##name = true; \
9869 cursor = end; \
9870 continue; \
9871 } \
9872 if (strncmp(cursor, "no-" #name, end - cursor) == 0) { \
9873 FLAG_##name = false; \
9874 cursor = end; \
9875 continue; \
9876 }
9877
9878#define CHECK_FLAG(name, mode) \
9879 if (strncmp(cursor, #name, end - cursor) == 0) { \
9880 if (!FLAG_##name) { \
9881 return header_reader.BuildError("Flag " #name \
9882 " is true in snapshot, " \
9883 "but " #name \
9884 " is always false in " mode); \
9885 } \
9886 cursor = end; \
9887 continue; \
9888 } \
9889 if (strncmp(cursor, "no-" #name, end - cursor) == 0) { \
9890 if (FLAG_##name) { \
9891 return header_reader.BuildError("Flag " #name \
9892 " is false in snapshot, " \
9893 "but " #name \
9894 " is always true in " mode); \
9895 } \
9896 cursor = end; \
9897 continue; \
9898 }
9899
9900#define SET_P(name, T, DV, C) SET_FLAG(name)
9901
9902#if defined(PRODUCT)
9903#define SET_OR_CHECK_R(name, PV, T, DV, C) CHECK_FLAG(name, "product mode")
9904#else
9905#define SET_OR_CHECK_R(name, PV, T, DV, C) SET_FLAG(name)
9906#endif
9907
9908#if defined(PRODUCT)
9909#define SET_OR_CHECK_C(name, PCV, PV, T, DV, C) CHECK_FLAG(name, "product mode")
9910#elif defined(DART_PRECOMPILED_RUNTIME)
9911#define SET_OR_CHECK_C(name, PCV, PV, T, DV, C) \
9912 CHECK_FLAG(name, "the precompiled runtime")
9913#else
9914#define SET_OR_CHECK_C(name, PV, T, DV, C) SET_FLAG(name)
9915#endif
9916
9917#if !defined(DEBUG)
9918#define SET_OR_CHECK_D(name, T, DV, C) CHECK_FLAG(name, "non-debug mode")
9919#else
9920#define SET_OR_CHECK_D(name, T, DV, C) SET_FLAG(name)
9921#endif
9922
9924
9925#undef SET_OR_CHECK_D
9926#undef SET_OR_CHECK_C
9927#undef SET_OR_CHECK_R
9928#undef SET_P
9929#undef CHECK_FLAG
9930#undef SET_FLAG
9931
9933 }
9934
9935 return nullptr;
9936}
#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)