From fcc067e5154bedc92a2e8ab009718d97d1fc94e5 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Fri, 11 Oct 2024 18:50:26 +0100 Subject: [PATCH] [preproc] support C23 enum underlying type syntax (#2043) --- tools/preproc/asm_file.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/preproc/asm_file.cpp b/tools/preproc/asm_file.cpp index 4eda54a3aa..a82354cb5f 100644 --- a/tools/preproc/asm_file.cpp +++ b/tools/preproc/asm_file.cpp @@ -524,6 +524,17 @@ bool AsmFile::ParseEnum() long enumCounter = 0; long symbolCount = 0; + if (m_buffer[m_pos] == ':') // : + { + m_pos++; + std::string underlyingType; + do { + currentHeaderLine += SkipWhitespaceAndEol(); + underlyingType = ReadIdentifier(); + } while (!underlyingType.empty()); + currentHeaderLine += SkipWhitespaceAndEol(); + } + if (m_buffer[m_pos] != '{') // assume assembly macro, otherwise assume enum and report errors accordingly { m_pos = fallbackPosition - 4;