From: Ben Pfaff Date: Sun, 30 May 2021 22:49:42 +0000 (-0700) Subject: identifier: Remove TOKEN_N_TYPES from enum token_type. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=6e0b939b8b107b911275b616f2cef6773a523d9f identifier: Remove TOKEN_N_TYPES from enum token_type. --- diff --git a/src/data/identifier.c b/src/data/identifier.c index e3b33a3382..07c7675bd5 100644 --- a/src/data/identifier.c +++ b/src/data/identifier.c @@ -46,7 +46,6 @@ token_type_to_name (enum token_type type) #define TOKEN_TYPE(TYPE) case T_##TYPE: return #TYPE; TOKEN_TYPES #undef TOKEN_TYPE - case TOKEN_N_TYPES: default: return "unknown token type"; } @@ -144,9 +143,6 @@ token_type_to_string (enum token_type token) case T_EXP: return "**"; - - case TOKEN_N_TYPES: - NOT_REACHED (); } NOT_REACHED (); diff --git a/src/data/identifier.h b/src/data/identifier.h index 1fc63b4808..abb16d5645 100644 --- a/src/data/identifier.h +++ b/src/data/identifier.h @@ -66,10 +66,13 @@ enum token_type { #define TOKEN_TYPE(TYPE) T_##TYPE, TOKEN_TYPES - TOKEN_N_TYPES #undef TOKEN_TYPE }; +#define TOKEN_TYPE(TYPE) + 1 +enum { TOKEN_N_TYPES = TOKEN_TYPES }; +#undef TOKEN_TYPE + const char *token_type_to_name (enum token_type); const char *token_type_to_string (enum token_type);