-
Notifications
You must be signed in to change notification settings - Fork 6k
[CI] add C++20 compile probe #79445
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
base: develop
Are you sure you want to change the base?
[CI] add C++20 compile probe #79445
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,11 @@ limitations under the License. */ | |
| REGISTER_LOG_SIMPLY_STR(std::string); | ||
| COMMON_DECLARE_int32(call_stack_level); | ||
| namespace { | ||
| // C++20 compile probe: consteval is C++20-only, and this file is built into | ||
| // common and common_static. | ||
| consteval bool PaddleCxx20CompileProbe() { return true; } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Bug 这里无条件使用
建议修复方式:如果 Paddle 基线已经切到 C++20,请同步修改 |
||
| static_assert(PaddleCxx20CompileProbe()); | ||
|
|
||
|
Comment on lines
+26
to
+30
|
||
| class StrSizeCmp { | ||
| public: | ||
| bool operator()(const std::string& lhs, const std::string& rhs) const { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里无条件使用
consteval会破坏仓库当前仍显式保留的 C++17 构建路径。cmake/flags.cmake里 GCC < 11 仍会追加-std=c++17,Windows 分支也设置CMAKE_CXX_STANDARD 17;同时paddle/common/CMakeLists.txt会把本文件编入common和common_static。在这些路径下,本行会直接语法失败(例如c++ -std=c++17 -I. -fsyntax-only paddle/common/enforce.cc会报consteval does not name a type),导致现有受支持构建无法通过。处理要求:请针对该评论修复并提交新的 commit。
请在同一个 PR 中先统一构建策略,再保留这个探针。可选方向之一是正式移除这些 C++17 fallback 并让配置阶段直接失败,例如:
如果 GCC < 11 / Windows 的 C++17 路径还需要继续保留,则这个探针不能无条件放在会被这些路径编译的公共源文件中,需要先加条件或改放到只覆盖 C++20 目标的构建检查里。