Skip to content

[fix](be) remove duplicate default argument on clear_blocks forward declaration - #67459

Open
damokelis wants to merge 1 commit into
apache:masterfrom
damokelis:fix/be-clear-blocks-duplicate-default-arg
Open

[fix](be) remove duplicate default argument on clear_blocks forward declaration#67459
damokelis wants to merge 1 commit into
apache:masterfrom
damokelis:fix/be-clear-blocks-duplicate-default-arg

Conversation

@damokelis

Copy link
Copy Markdown

What problem does this PR solve?

Under Unity Build, be/src/exec/sink/writer/async_result_writer.cpp fails to compile:

error: redeclaration of `clear_blocks` may not have default arguments

clear_blocks<T>() is declared twice with the same default argument for memory_used_counter:

C++ forbids repeating a default argument across declarations of the same function template ([dcl.fct.default]/4). Separate translation units never see both, so a normal build is fine — but Unity Build concatenates sources into one TU, both declarations land together, and -Werror turns it into a hard error.

Fix

Drop the default from the forward declaration in async_result_writer.cpp. The one in local_exchanger.h still applies at every call site that sees that header, so no call site changes.

Release note

None

Check List

  • Test

    • No need to test or manual test. Explain why:
      • Compile-only fix; no behavior change. The removed token is a default argument on a declaration, and every existing call site passes the argument explicitly or sees the header-declared default.
  • Behavior changed:

    • No.
  • Does this need documentation?

    • No.

…eclaration
Upstream commit 6922ab5 ([opt](build) 1/4: Speed up BE full build
~22% by cutting hot-header include edges (apache#66400)) added a forward
declaration of clear_blocks<T>() in async_result_writer.cpp to avoid
pulling in exec/exchange/local_exchanger.h, which already declares the
same template with a default argument for memory_used_counter. C++
forbids a default argument from being repeated across declarations of
the same function/template, so under Unity Build both declarations
land in the same translation unit and -Werror turns this into a hard
"redeclaration ... may not have default arguments" error. Drop the
default from this file's forward declaration; the one in
local_exchanger.h still applies at call sites that see both headers.
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@damokelis@hello-stephen