Add ANNOTATION_ID_DEFAULT_STATE to ANNOTATION_ID_CONSTANTS
ANNOTATION_ID_DEFAULT_STATE was missing, so add it. Make the order of
table entries match the declaration order of the enumerators so it's
easier to inspect.
Currently, stats-log-api-gen calls std::map::at with a missing key,
ANNOTATION_ID_DEFAULT_STATE, in java_writer.cpp's write_annotations().
When exceptions are disabled, the existing libc++ map::at has undefined
behavior (null dereference), but the program probably avoids crashing
because std::map::at merely returns an invalid std::string& near
nullptr -- it doesn't actually need to load memory. When
annotation->annotationId is ANNOTATION_ID_DEFAULT_STATE,
and annotation->type is ANNOTATION_TYPE_INT, write_annotations()
doesn't actually use the invalid std::string&.
After upgrading libc++, when exceptions are disabled, std::map::at
calls abort, so stats-log-api-gen aborts.
Bug: http://b/175635923
Test: treehugger
Change-Id: Id23f9b0b5b8d05319a2ae7cd18fdc3cd7a5cc142
2 files changed