Skip to content

THRIFT-6213: Define the TConfiguration default constants in the library - #3973

Merged
Jens-G merged 1 commit into
apache:masterfrom
slachiewicz:THRIFT-6213
Oct 28, 2026
Merged

Jens-G merged 1 commit into
apache:masterfrom
slachiewicz:THRIFT-6213

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Adds TConfiguration.cpp with out-of-line definitions of DEFAULT_MAX_MESSAGE_SIZE, DEFAULT_MAX_FRAME_SIZE and DEFAULT_RECURSION_DEPTH, so binding one to a reference links before C++17. The new test takes each constant's address through a volatile pointer, which needs the definitions at any optimisation level; on master it fails to link even in a Release build.

Verified: Ubuntu 24.04 arm64, GCC 13, C++11 — Debug build of UnitTests links and passes 141/141 (fails to link on master); TTransportFactoryConfigTest 11/11 in Debug and Release.

@mergeable mergeable Bot added c++ Pull requests that update C++ code build and general CI cmake, automake and build system changes labels Sep 28, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review September 28, 2026 18:10
@Jens-G

Jens-G commented Oct 18, 2026

Copy link
Copy Markdown
Member

Code review

No blocking issues found. Checked for bugs and CLAUDE.md compliance.

One suggestion, below the bar for an issue but verified:

  • The comment says binding one of these constants to a reference "needs a definition before C++17". The header declares them const static int, and C++17 made only constexpr static data members implicitly inline, so an odr-use needs these definitions in every standard for as long as the header keeps that declaration. The commit message states the right condition ("drop it only once the constants become inline constexpr"), and the comment could say the same.

// Binding one of these constants to a reference, as std::make_shared or
// std::min do, needs a definition before C++17.
const int TConfiguration::DEFAULT_MAX_MESSAGE_SIZE;
const int TConfiguration::DEFAULT_MAX_FRAME_SIZE;
const int TConfiguration::DEFAULT_RECURSION_DEPTH;

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 26, 2026 20:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@slachiewicz

Copy link
Copy Markdown
Member Author

The comment and the commit message now say the definition is needed in every standard for as long as the constants are static const.

Client: cpp

An odr-used static const data member needs this out-of-line definition in
every C++ standard; drop it only once the constants become inline
constexpr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 01:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@Jens-G
Jens-G merged commit a1c8b78 into apache:master Oct 28, 2026
109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build and general CI cmake, automake and build system changes c++ Pull requests that update C++ code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants