BaseTools: Add support for GCC preprocessor line directives

This change adds support for GCC-style preprocessor line
directives as documented in:
https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html

On Windows systems, one can use line-markers to see  which .vfr
file was used to generate a *.i file in the Build directory.
This is useful for debugging VFR compilation failures.

With this change, the VfrCompiler will not generate compilation
errors if the *.i file contains GCC-style line-markers. Without
this change, one must disable the pre-processor's emission of
line-markers, removing the debug aid they provide.

Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
This commit is contained in:
Nate DeSimone 2025-04-25 15:54:18 -07:00 committed by mergify[bot]
parent 091bd7958b
commit bf99048365
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/*++ @file
Vfr Syntax
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2025, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
--*/
@ -111,6 +111,7 @@ VfrParserStart (
#token CloseBracket("]") "\]"
#token LineDefinition "#line\ [0-9]+\ \"~[\"]+\"[\ \t]*\n" << gCVfrErrorHandle.ParseFileScopeRecord (begexpr (), line ()); skip (); newline (); >>
#token GccLineDefinition "#\ [0-9]+\ \"~[\"]+\"[\ \t]*([1234][\ \t]*)*\n" << gCVfrErrorHandle.ParseFileScopeRecord (begexpr (), line ()); skip (); newline (); >>
#token DevicePath("devicepath") "devicepath"
#token FormSet("formset") "formset"
#token FormSetId("formsetid") "formsetid"