@@ -22,7 +22,7 @@ const localize: nls.LocalizeFunc = nls.loadMessageBundle();
2222const log = createLogger ( 'cpptools' ) ;
2323
2424type Architecture = 'x86' | 'x64' | 'arm' | 'arm64' | undefined ;
25- type StandardVersion = "c89" | "c99" | "c11" | "c17" | "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "c++23" | " gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | "gnu++23 " | undefined ;
25+ type StandardVersion = "c89" | "c99" | "c11" | "c17" | "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | undefined ;
2626type IntelliSenseMode = "linux-clang-x86" | "linux-clang-x64" | "linux-clang-arm" | "linux-clang-arm64" | "linux-gcc-x86" | "linux-gcc-x64" | "linux-gcc-arm" | "linux-gcc-arm64" | "macos-clang-x86" | "macos-clang-x64" | "macos-clang-arm" | "macos-clang-arm64" | "macos-gcc-x86" | "macos-gcc-x64" | "macos-gcc-arm" | "macos-gcc-arm64" | "windows-clang-x86" | "windows-clang-x64" | "windows-clang-arm" | "windows-clang-arm64" | "windows-gcc-x86" | "windows-gcc-x64" | "windows-gcc-arm" | "windows-gcc-arm64" | "windows-msvc-x86" | "windows-msvc-x64" | "windows-msvc-arm" | "windows-msvc-arm64" | "msvc-x86" | "msvc-x64" | "msvc-arm" | "msvc-arm64" | "gcc-x86" | "gcc-x64" | "gcc-arm" | "gcc-arm64" | "clang-x86" | "clang-x64" | "clang-arm" | "clang-arm64" | undefined ;
2727
2828export interface DiagnosticsCpptools {
@@ -64,15 +64,11 @@ interface TargetDefaults {
6464 defines ?: string [ ] ;
6565}
6666
67- function parseCppStandard ( std : string , canUseGnu : boolean , canUseCxx23 : boolean ) : StandardVersion {
67+ function parseCppStandard ( std : string , canUseGnu : boolean ) : StandardVersion {
6868 const isGnu = canUseGnu && std . startsWith ( 'gnu' ) ;
69- if ( std . endsWith ( '++23' ) || std . endsWith ( '++2b' ) || std . endsWith ( '++latest' ) ) {
70- if ( canUseCxx23 ) {
71- return isGnu ? 'gnu++23' : 'c++23' ;
72- } else {
73- return isGnu ? 'gnu++20' : 'c++20' ;
74- }
75- } else if ( std . endsWith ( '++20' ) || std . endsWith ( '++2a' ) ) {
69+ if ( std === 'c++latest' || std . endsWith ( '++26' ) || std . endsWith ( '++2c' ) ||
70+ std . endsWith ( '++23' ) || std . endsWith ( '++2b' ) ||
71+ std . endsWith ( '++20' ) || std . endsWith ( '++2a' ) ) {
7672 return isGnu ? 'gnu++20' : 'c++20' ;
7773 } else if ( std . endsWith ( '++17' ) || std . endsWith ( '++1z' ) ) {
7874 return isGnu ? 'gnu++17' : 'c++17' ;
@@ -98,7 +94,7 @@ function parseCStandard(std: string, canUseGnu: boolean): StandardVersion {
9894 return isGnu ? 'gnu99' : 'c99' ;
9995 } else if ( / ( c | g n u ) ( 1 1 | 1 x | i s o 9 8 9 9 : 2 0 1 1 ) / . test ( std ) ) {
10096 return isGnu ? 'gnu11' : 'c11' ;
101- } else if ( / ( c | g n u ) ( 1 7 | 1 8 | 2 x | i s o 9 8 9 9 : ( 2 0 1 7 | 2 0 1 8 ) ) / . test ( std ) ) {
97+ } else if ( / ( c | g n u ) ( 1 7 | 1 8 | 2 3 | 2 x | i s o 9 8 9 9 : ( 2 0 1 7 | 2 0 1 8 | 2 0 2 4 ) ) / . test ( std ) ) {
10298 if ( canUseGnu ) {
10399 // cpptools supports 'c17' in same version it supports GNU std.
104100 return isGnu ? 'gnu17' : 'c17' ;
@@ -155,7 +151,6 @@ function parseTargetArch(target: string): Architecture {
155151export function parseCompileFlags ( cptVersion : cpptools . Version , args : string [ ] , lang ?: string ) : CompileFlagInformation {
156152 const requireStandardTarget = ( cptVersion < cpptools . Version . v5 ) ;
157153 const canUseGnuStd = ( cptVersion >= cpptools . Version . v4 ) ;
158- const canUseCxx23 = ( cptVersion >= cpptools . Version . v6 ) ;
159154 // No need to parse language standard for CppTools API v6 and above
160155 const extractStdFlag = ( cptVersion < cpptools . Version . v6 ) ;
161156 const iter = args [ Symbol . iterator ] ( ) ;
@@ -206,7 +201,7 @@ export function parseCompileFlags(cptVersion: cpptools.Version, args: string[],
206201 } else if ( extractStdFlag && ( value . startsWith ( '-std=' ) || lower . startsWith ( '-std:' ) || lower . startsWith ( '/std:' ) ) ) {
207202 const std = value . substring ( 5 ) ;
208203 if ( lang === 'CXX' || lang === 'OBJCXX' || lang === 'CUDA' ) {
209- const s = parseCppStandard ( std , canUseGnuStd , canUseCxx23 ) ;
204+ const s = parseCppStandard ( std , canUseGnuStd ) ;
210205 if ( ! s ) {
211206 log . warning ( localize ( 'unknown.control.gflag.cpp' , 'Unknown C++ standard control flag: {0}' , value ) ) ;
212207 } else {
@@ -220,7 +215,7 @@ export function parseCompileFlags(cptVersion: cpptools.Version, args: string[],
220215 standard = s ;
221216 }
222217 } else if ( lang === undefined ) {
223- let s = parseCppStandard ( std , canUseGnuStd , canUseCxx23 ) ;
218+ let s = parseCppStandard ( std , canUseGnuStd ) ;
224219 if ( ! s ) {
225220 s = parseCStandard ( std , canUseGnuStd ) ;
226221 }
0 commit comments