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

Superfluous semicolons trigger -Wextra-semi-stmt in clang 8.0.0 from C++ compiler on 1.11.0 #5482

Closed
wesm opened this issue Aug 15, 2019 · 2 comments · Fixed by #5483
Closed

Comments

@wesm
Copy link
Contributor

wesm commented Aug 15, 2019

Version 1.11.0 generates code like

inline void ObjectInfo::UnPackTo(ObjectInfoT *_o, const flatbuffers::resolver_function_t *_resolver) const {
  (void)_o;
  (void)_resolver;
  { auto _e = object_id(); if (_e) _o->object_id = _e->str(); };
  { auto _e = data_size(); _o->data_size = _e; };
  { auto _e = metadata_size(); _o->metadata_size = _e; };
  { auto _e = ref_count(); _o->ref_count = _e; };
  { auto _e = create_time(); _o->create_time = _e; };
  { auto _e = construct_duration(); _o->construct_duration = _e; };
  { auto _e = digest(); if (_e) _o->digest = _e->str(); };
  { auto _e = is_deletion(); _o->is_deletion = _e; };
}

This causes such warnings as

https://travis-ci.org/apache/arrow/jobs/572381802#L2864

Here's the Flatbuffers file that the above generated code originated from

https://github.com/apache/arrow/blob/master/cpp/src/plasma/format/common.fbs

@vglavnyy
Copy link
Contributor

Thank you for the report.
Indeed, the code generator adds the unnecessary ; to the end of each expression.

code_.SetValue("FIELD_NAME", Name(field));
auto prefix = " { auto _e = {{FIELD_NAME}}(); ";
auto check = IsScalar(field.value.type.base_type) ? "" : "if (_e) ";
auto postfix = " };";
code_ += std::string(prefix) + check + statement + postfix;

Care to make a PR for this?

@wesm
Copy link
Contributor Author

wesm commented Aug 16, 2019

Thanks for pointing me to the right line of code. Done

wesm added a commit to wesm/arrow that referenced this issue Aug 16, 2019
…8 to work around Flatbuffers bug, suppress other new LLVM 8 warnings

LLVM 8 introduces `-Wextra-semi-stmt` and Flatbuffers generates code with superfluous semicolons (upstream bug report google/flatbuffers#5482). This is breaking our macOS builds for the last few hours because conda-forge upgraded their compiler toolchain from Apple clang 4.0.1 to clang 8.0.0 this afternoon.

Closes apache#5096 from wesm/ARROW-6259 and squashes the following commits:

96cbba9 <Wes McKinney> Suppress -Wshadow-field and -Wc++2a-compat also
686339c <Wes McKinney> Add -Wno-extra-semi-stmt when compiling with clang 8 to work around Flatbuffers bug

Authored-by: Wes McKinney <wesm+git@apache.org>
Signed-off-by: Wes McKinney <wesm+git@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants