add /std:c++23preview support for cl#7106
Conversation
Summary of ChangesHello @Bush2021, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This change enhances the xmake build system by integrating support for the C++23 preview standard when using the Microsoft Visual C++ compiler ( Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for the /std:c++23preview flag for the MSVC compiler (cl). The change correctly adds this flag as a fallback for various C++23 standard aliases. My review includes a suggestion to refactor the duplicated flag definitions to improve code maintainability.
| , cxx23 = {"-std:c++23", "-std:c++23preview", "-std:c++latest"} | ||
| , gnuxx23 = {"-std:c++23", "-std:c++23preview", "-std:c++latest"} | ||
| , cxx2b = {"-std:c++23", "-std:c++23preview", "-std:c++latest"} | ||
| , gnuxx2b = {"-std:c++23", "-std:c++23preview", "-std:c++latest"} |
There was a problem hiding this comment.
This change is correct, but it adds to the existing code duplication by repeating the same array of flags four times. To improve maintainability, consider defining this array in a local variable before the _g.cxxmaps table and reusing it.
For example:
if _g.cxxmaps == nil then
local cxx23_flags = {"-std:c++23", "-std:c++23preview", "-std:c++latest"}
_g.cxxmaps = {
-- ...
cxx23 = cxx23_flags,
gnuxx23 = cxx23_flags,
cxx2b = cxx23_flags,
gnuxx2b = cxx23_flags,
-- ...
}
-- ...
endThis would make future updates easier and less error-prone. A similar refactoring could be applied to other duplicated flag sets in this file.
|
It will break c++ modules. #7164 (comment) |
Fix #6327