From fd5d8c1949ddf07b803e3bc1747365ba84a415f8 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 10 Aug 2019 16:04:05 -0700 Subject: [PATCH] Remove __packed We can use the new C++11 enum type feature to stop using this non-portable __packed. --- config_cmake.h.in | 4 ---- src/parse_constants.h | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/config_cmake.h.in b/config_cmake.h.in index 76ae2a230..c7ce044a4 100644 --- a/config_cmake.h.in +++ b/config_cmake.h.in @@ -168,11 +168,7 @@ #ifndef __sentinel #define __sentinel __attribute__ ((sentinel)) #endif -#ifndef __packed -#define __packed __attribute__ ((packed)) -#endif #else #define __warn_unused #define __sentinel -#define __packed #endif diff --git a/src/parse_constants.h b/src/parse_constants.h index 2c916ac5e..b9145b2ce 100644 --- a/src/parse_constants.h +++ b/src/parse_constants.h @@ -13,7 +13,7 @@ } while (0) // IMPORTANT: If the following enum table is modified you must also update token_enum_map below. -enum parse_token_type_t { +enum parse_token_type_t : uint8_t { token_type_invalid = 1, // Non-terminal tokens symbol_job_list, @@ -71,7 +71,7 @@ enum parse_token_type_t { LAST_TOKEN_OR_SYMBOL = parse_token_type_terminate, FIRST_PARSE_TOKEN_TYPE = parse_token_type_string, LAST_PARSE_TOKEN_TYPE = parse_token_type_end -} __packed; +}; const enum_map token_enum_map[] = { {parse_special_type_comment, L"parse_special_type_comment"}, @@ -96,7 +96,7 @@ const enum_map token_enum_map[] = { // array below. // // IMPORTANT: These enums must start at zero. -enum parse_keyword_t { +enum parse_keyword_t : uint8_t { parse_keyword_and, parse_keyword_begin, parse_keyword_builtin, @@ -115,7 +115,7 @@ enum parse_keyword_t { parse_keyword_or, parse_keyword_switch, parse_keyword_while, -} __packed; +}; const enum_map keyword_enum_map[] = {{parse_keyword_exclam, L"!"}, {parse_keyword_and, L"and"},