#define DIAG_START_COMMON 0 // Sentinel value.
#define CATEGORY(NAME, PREV) \
if (DiagID > DIAG_START_##NAME) { \
- Offset += NUM_BUILTIN_##PREV##_DIAGNOSTICS - DIAG_START_##PREV; \
- ID -= DIAG_START_##NAME - DIAG_START_##PREV + 1; \
+ Offset += NUM_BUILTIN_##PREV##_DIAGNOSTICS - DIAG_START_##PREV - 1; \
+ ID -= DIAG_START_##NAME - DIAG_START_##PREV; \
}
CATEGORY(DRIVER, COMMON)
CATEGORY(FRONTEND, DRIVER)
if (ID + Offset >= StaticDiagInfoSize)
return 0;
+ assert(ID < StaticDiagInfoSize && Offset < StaticDiagInfoSize);
+
const StaticDiagInfoRec *Found = &StaticDiagInfo[ID + Offset];
// If the diag id doesn't match we found a different diag, abort. This can
// happen when this function is called with an ID that points into a hole in