On Thu, Dec 14, 2017 at 12:03:56PM +0000, Leif Lindholm wrote:
> On Thu, Dec 14, 2017 at 10:44:04AM +0800, Ni, Ruiyu wrote:
> > Can we just move the definitions to UefiBaseTypes.h?
> 
> There is nothing in UefiBaseTypes.h that is fundamentally easier to
> deal with than what is in UefiMultiPhase.h to begin with.
> 
> > Even vfrcompiler still complains, the syntax enhancement to
> > vfrcompiler should be simple.
> 
> It's (probably) not VfrCompile that would need to change.
> The problem is that the build runs the C preprocessor on the .vfr
> source files before passing them to VfrCompile. #defines that just
> replace text work fine, but typedefs and struct definitions make no
> sense in vfr source.
> 
> It runs the preprocessor in C mode (for gpp, -x c) which means we
> cannot use __ASSEMBLER__ to filter out typedefs and struct
> definitions.
> 
> We could perhaps switch to -x assembler-with-cpp (and filter
> UefiMultiPhase.h on __ASSEMBLER__), like we do for DTC.
> It _seems_ to work in my test, but I do not know what a corresponding
> change for VS would be.

Well, this turns out to be unworkable anyway, since the affected
.vfr source files depend on certain typedefs and struct definitions.
I was under the misconception that only #defines were used in .vfr.

So, yes, the better solution would be to teach VfrCompile to
understand enums and other things, but I wouldn't really know where to
start (and I'm about to disappear for a month).

Symptoms when building MdeModulePkg DriverSampleDxe with
UefiMultiPhase.h include

ERROR 12288: EFI_GUID
        : undefined
ERROR 12288: enum
        : unexpected token

If I then add UefiBaseTypes.h, we insted have issues from the
inclusion of ProcessorBind.h:

ERROR 12288: unsigned
        : unexpected token
ERROR 12288: long
        : unexpected token

and so on.

An alternative less invasive solution, which would avoid adding new
files, would be to add #ifndef VFRCOMPILE around everything other
than the EFI_VARIABLE_* #defines in UefiMultiPhase.h.

Would you be happier with that as a temporary measure until someone
gets around to looking at VfrCompile?

/
    Leif
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to