Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parentheses in FLATBUFFERS_MAX_BUFFER_SIZE, FLATBUFFERS_MAX_64_BUFFER_SIZE to avoid preprocessor definition collision #8377

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

mspanc
Copy link
Contributor

@mspanc mspanc commented Aug 19, 2024

In case when flatbuffers are being used along with other project that defines "max" preprocessor macro, the ::max() in FLATBUFFERS_MAX_BUFFER_SIZE and FLATBUFFERS_MAX_64_BUFFER_SIZE is incorrectly being expanded to the macro. Adding parentheses enforces function-like interpretation.

The previous PR 8375 about the same issue was invalid, I apologise for inconvenience.

…FFER_SIZE to avoid preprocessor definition collision

In case when flatbuffers are being used along with other project that defines "max" preprocessor macro, the ::max() in FLATBUFFERS_MAX_BUFFER_SIZE and FLATBUFFERS_MAX_64_BUFFER_SIZE is incorrectly being expanded to the macro. Adding parentheses enforces function-like interpretation.
@github-actions github-actions bot added the c++ label Aug 19, 2024
@mspanc
Copy link
Contributor Author

mspanc commented Aug 19, 2024

Buildkite seems to be failing due to unrelated errors:

In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:301:36: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
    : std::integral_constant<bool, __has_trivial_destructor(T)

@dbaileychess dbaileychess enabled auto-merge (squash) August 19, 2024 23:47
@dbaileychess dbaileychess merged commit baddf90 into google:master Aug 19, 2024
49 checks passed
jochenparm pushed a commit to jochenparm/flatbuffers that referenced this pull request Oct 29, 2024
…FFER_SIZE to avoid preprocessor definition collision (google#8377)

In case when flatbuffers are being used along with other project that defines "max" preprocessor macro, the ::max() in FLATBUFFERS_MAX_BUFFER_SIZE and FLATBUFFERS_MAX_64_BUFFER_SIZE is incorrectly being expanded to the macro. Adding parentheses enforces function-like interpretation.

Co-authored-by: Derek Bailey <derekbailey@google.com>
jochenparm pushed a commit to jochenparm/flatbuffers that referenced this pull request Oct 29, 2024
…FFER_SIZE to avoid preprocessor definition collision (google#8377)

In case when flatbuffers are being used along with other project that defines "max" preprocessor macro, the ::max() in FLATBUFFERS_MAX_BUFFER_SIZE and FLATBUFFERS_MAX_64_BUFFER_SIZE is incorrectly being expanded to the macro. Adding parentheses enforces function-like interpretation.

Co-authored-by: Derek Bailey <derekbailey@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants