Avoid Windows ERROR macro collision in idl.h#9016
Open
steadytao wants to merge 2 commits intogoogle:masterfrom
Open
Avoid Windows ERROR macro collision in idl.h#9016steadytao wants to merge 2 commits intogoogle:masterfrom
steadytao wants to merge 2 commits intogoogle:masterfrom
Conversation
Rename IDLOptions::ProtoIdGapAction::ERROR to ERROR_ so flatbuffers/idl.h still parses when Windows headers define ERROR as a macro. Update the two internal references in flatc.cpp and idl_gen_fbs.cpp.
Collaborator
|
while this does fix the reported issue (and may be sufficient to merge as is), when I started to look into this there are several other enumerations in the flatbuffers headers which also have this collision. I went to fix them but I believe there are some that are speciified by grpc which felt problematic to change. |
Author
|
I took a look and agree there are a few other |
Rename the remaining FlatBuffers-owned public-header ERROR enumerators to ERROR_ and update internal CodeGenerator::Status users accordingly.
Author
|
Ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Avoid a Windows macro collision in
flatbuffers/idl.h.Problem
IDLOptions::ProtoIdGapActioncurrently defines an enumerator namedERROR.On Windows,
ERRORis commonly defined as a macro by system headers such aswingdi.hwhich causesflatbuffers/idl.hto fail to parse when both are included in the same translation unit.Fix
IDLOptions::ProtoIdGapAction::ERRORtoERROR_Testing
flatcERRORdefined as a macro before includingflatbuffers/idl.hFixes #8483.