Open ivucica opened 5 years ago
I also hit this issue today. Is there an easy workaround?
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago.
While I have not tested this recently, presumably it has not been addressed and this indeed should remain active, and enum fields named NULL
should be renamed by protoc
to something else in C++ code. Same as should be for other language-specific keywords.
Seems to be the same for VOID
. We've got an enum to mark an invoice as VOID
and this breaks the compilation too.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.
This issue should not be closed.
Message ID: @.***>
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.
This issue should not be closed.
What version of protobuf and what language are you using? Version: $ protoc --version # libprotoc 3.6.1
Language: C++
What operating system (Linux, Windows, ...) and version? Debian stretch
What runtime / compiler are you using (e.g., python version or gcc version) gcc 6.4.0
What did you do? Steps to reproduce the behavior:
Have an enum in an annotation proto message containing a field named
NULL
.https://github.com/grpc-ecosystem/grpc-gateway/blob/3ad0fb96ecfdf73fa2eddb3de116ae98360dbb35/protoc-gen-swagger/options/openapiv2.proto#L218
Use
protoc --cpp_out=.......
with the proto file.Attempt to compile the resulting output file
g++ -C -o tmp.o protoc-gen-swagger/options/openapiv2.pb.cc
What did you expect to see No errors building.
What did you see instead? Due to a conflict with
#define NULL __null
somewhere in the compiler or standard headers, the compiler is not happy:Anything else we should know about your project / environment As enum fields named
NULL
were seemingly broken until now, I propose renaming them just before the code is generated. This does not seem to have been an issue in other languages, and I don't believe this is forbidden by either proto2 or proto3 syntax.This was reported in https://github.com/grpc-ecosystem/grpc-gateway/issues/1031 -- the annotations there are used in generating OpenAPI v2 ("swagger") JSON description of the
.proto
-defined API. We can perhaps work around this, but this is still an issue inprotoc
generator for C++.