Skip to content

Commit

Permalink
Workaround TRUE and FALSE macro definitions on WIN32
Browse files Browse the repository at this point in the history
One of the [GCP proto files](https://github.com/googleapis/googleapis/blob/master/google/cloud/asset/v1/assets.proto) defines `TRUE` and `FALSE` as enum values ([permalink](https://github.com/googleapis/googleapis/blob/a4f2de456480c0a4ed9feeeaa1f8ee620bbef23a/google/cloud/asset/v1/assets.proto#L782-L786)).  These cause trouble on WIN32, where `TRUE` and `FALSE` are also macro definitions.

For more details, see googleapis/google-cloud-cpp#8145.

PiperOrigin-RevId: 507831036
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Feb 7, 2023
1 parent 3cb8949 commit e349ef9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/google/protobuf/port_def.inc
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and
#undef STRICT
#pragma push_macro("timezone")
#undef timezone
#pragma push_macro("TRUE")
#undef TRUE
#pragma push_macro("FALSE")
#undef FALSE
#endif // _WIN32

#ifdef __APPLE__
Expand Down
2 changes: 2 additions & 0 deletions src/google/protobuf/port_undef.inc
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
#pragma pop_macro("STRICT")
#pragma pop_macro("STATUS_PENDING")
#pragma pop_macro("timezone")
#pragma pop_macro("TRUE")
#pragma pop_macro("FALSE")
#endif

#ifdef __APPLE__
Expand Down

0 comments on commit e349ef9

Please sign in to comment.