Skip to content

add /std:c++23preview support for cl#7106

Merged
waruqi merged 1 commit intoxmake-io:devfrom
Bush2021:c++23preview
Dec 8, 2025
Merged

add /std:c++23preview support for cl#7106
waruqi merged 1 commit intoxmake-io:devfrom
Bush2021:c++23preview

Conversation

@Bush2021
Copy link
Contributor

@Bush2021 Bush2021 commented Dec 7, 2025

Fix #6327

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 (cl). It allows developers to leverage upcoming C++23 features in their projects by specifying the appropriate language standard, thereby expanding the compiler options available for modern C++ development.

Highlights

  • C++23 Preview Support: This pull request adds support for the /std:c++23preview flag to the cl compiler configuration within xmake, enabling the use of C++23 preview features.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +284 to +287
, 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"}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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,
        -- ...
    }
    -- ...
end

This would make future updates easier and less error-prone. A similar refactoring could be applied to other duplicated flag sets in this file.

@waruqi waruqi added this to the v3.0.6 milestone Dec 8, 2025
@waruqi waruqi merged commit fb2a2e5 into xmake-io:dev Dec 8, 2025
33 checks passed
@waruqi
Copy link
Member

waruqi commented Dec 24, 2025

It will break c++ modules. #7164 (comment)

Sign up for free to 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.

Windows下同时使用clang-cl和C++23标准时,对于LLVM 20.1.0及之后的版本,使用-std:c++23preview而非-std:c++latest

2 participants