Merge pull request #434 from microsoft/dev/gcampbell/C++23
Add support for c++23
This commit is contained in:
Коммит
3a8430278a
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"license": "SEE LICENSE IN LICENSE.txt",
|
||||
"engines": {
|
||||
"vscode": "^1.30.0"
|
||||
"vscode": "^1.74.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/vscode-makefile-tools/issues",
|
||||
|
@ -748,7 +748,7 @@
|
|||
"@types/glob": "^7.1.1",
|
||||
"glob": "^7.1.6",
|
||||
"module-alias": "^2.2.2",
|
||||
"vscode-cpptools": "^5.0.0",
|
||||
"vscode-cpptools": "^6.1.0",
|
||||
"vscode-nls": "^5.0.0",
|
||||
"@vscode/extension-telemetry": "^0.6.2",
|
||||
"vscode-jsonrpc": "^3.6.2"
|
||||
|
|
|
@ -998,7 +998,7 @@ export async function parseCustomConfigProvider(cancel: vscode.CancellationToken
|
|||
// If the command is compiling the same extension or uses -TC/-TP, send all the source files in one batch.
|
||||
if (language) {
|
||||
// More standard validation and defaults, in the context of the whole command.
|
||||
let standard: util.StandardVersion = parseStandard(ext.extension.getCppToolsVersion(), standardStr, language);
|
||||
let standard: util.StandardVersion | undefined = parseStandard(ext.extension.getCppToolsVersion(), standardStr, language);
|
||||
|
||||
if (ext.extension) {
|
||||
onFoundCustomConfigProviderItem({ defines, includes, forcedIncludes, standard, intelliSenseMode, compilerFullPath, compilerArgs, files, windowsSDKVersion, currentPath, line });
|
||||
|
@ -1014,7 +1014,7 @@ export async function parseCustomConfigProvider(cancel: vscode.CancellationToken
|
|||
}
|
||||
|
||||
// More standard validation and defaults, in the context of each source file.
|
||||
let standard: util.StandardVersion = parseStandard(ext.extension.getCppToolsVersion(), standardStr, language);
|
||||
let standard: util.StandardVersion | undefined = parseStandard(ext.extension.getCppToolsVersion(), standardStr, language);
|
||||
|
||||
if (ext.extension) {
|
||||
onFoundCustomConfigProviderItem({ defines, includes, forcedIncludes, standard, intelliSenseMode, compilerFullPath, compilerArgs, files: [file], windowsSDKVersion, currentPath, line });
|
||||
|
@ -1492,9 +1492,10 @@ function getTargetArchitecture(compilerArgs: string): util.TargetArchitecture {
|
|||
return targetArch;
|
||||
}
|
||||
|
||||
function parseStandard(cppVersion: cpp.Version | undefined, std: string | undefined, language: util.Language): util.StandardVersion {
|
||||
export function parseStandard(cppVersion: cpp.Version | undefined, std: string | undefined, language: util.Language): util.StandardVersion | undefined {
|
||||
let canUseGnu: boolean = (cppVersion !== undefined && cppVersion >= cpp.Version.v4);
|
||||
let standard: util.StandardVersion;
|
||||
let canUseCxx23: boolean = (cppVersion !== undefined && cppVersion >= cpp.Version.v6);
|
||||
let standard: util.StandardVersion | undefined;
|
||||
if (cppVersion && cppVersion >= cpp.Version.v5 && std === undefined) {
|
||||
// C/C++ standard is optional for CppTools v5+ and is determined by CppTools.
|
||||
return undefined;
|
||||
|
@ -1508,7 +1509,7 @@ function parseStandard(cppVersion: cpp.Version | undefined, std: string | undefi
|
|||
return "c++17";
|
||||
}
|
||||
} else if (language === "cpp") {
|
||||
standard = parseCppStandard(std, canUseGnu);
|
||||
standard = parseCppStandard(std, canUseGnu, canUseCxx23);
|
||||
if (!standard) {
|
||||
logger.message(`Unknown C++ standard control flag: ${std}`, "Normal");
|
||||
}
|
||||
|
@ -1518,7 +1519,7 @@ function parseStandard(cppVersion: cpp.Version | undefined, std: string | undefi
|
|||
logger.message(`Unknown C standard control flag: ${std}`, "Normal");
|
||||
}
|
||||
} else if (language === undefined) {
|
||||
standard = parseCppStandard(std, canUseGnu);
|
||||
standard = parseCppStandard(std, canUseGnu, canUseCxx23);
|
||||
if (!standard) {
|
||||
standard = parseCStandard(std, canUseGnu);
|
||||
}
|
||||
|
@ -1532,9 +1533,15 @@ function parseStandard(cppVersion: cpp.Version | undefined, std: string | undefi
|
|||
return standard;
|
||||
}
|
||||
|
||||
function parseCppStandard(std: string, canUseGnu: boolean): util.StandardVersion {
|
||||
function parseCppStandard(std: string, canUseGnu: boolean, canUseCxx23: boolean): util.StandardVersion | undefined {
|
||||
const isGnu: boolean = canUseGnu && std.startsWith('gnu');
|
||||
if (std.endsWith('++2a') || std.endsWith('++20') || std.endsWith('++latest')) {
|
||||
if (std.endsWith('++23') || std.endsWith('++2b') || std.endsWith('++latest')) {
|
||||
if (canUseCxx23) {
|
||||
return isGnu ? 'gnu++23' : 'c++23';
|
||||
} else {
|
||||
return isGnu ? 'gnu++20' : 'c++20';
|
||||
}
|
||||
} else if (std.endsWith('++2a') || std.endsWith('++20')) {
|
||||
return isGnu ? 'gnu++20' : 'c++20';
|
||||
} else if (std.endsWith('++17') || std.endsWith('++1z')) {
|
||||
return isGnu ? 'gnu++17' : 'c++17';
|
||||
|
@ -1551,7 +1558,7 @@ function parseCppStandard(std: string, canUseGnu: boolean): util.StandardVersion
|
|||
}
|
||||
}
|
||||
|
||||
function parseCStandard(std: string, canUseGnu: boolean): util.StandardVersion {
|
||||
function parseCStandard(std: string, canUseGnu: boolean): util.StandardVersion | undefined {
|
||||
// GNU options from: https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options
|
||||
const isGnu: boolean = canUseGnu && std.startsWith('gnu');
|
||||
if (/(c|gnu)(90|89|iso9899:(1990|199409))/.test(std)) {
|
||||
|
|
|
@ -11,8 +11,9 @@ import * as path from 'path';
|
|||
import * as vscode from 'vscode';
|
||||
|
||||
// C/CPP standard versions
|
||||
export 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;
|
||||
export 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;
|
||||
|
||||
// Supported target architectures (for code generated by the compiler)
|
||||
export type TargetArchitecture = 'x86' | 'x64' | 'arm' | 'arm64' | undefined;
|
||||
|
|
|
@ -4752,10 +4752,10 @@ vsce@^1.95.0:
|
|||
yauzl "^2.3.1"
|
||||
yazl "^2.2.2"
|
||||
|
||||
vscode-cpptools@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-cpptools/-/vscode-cpptools-5.0.0.tgz#f1195736af1cfa10727482be57093a3997c8f63b"
|
||||
integrity sha512-TPG6/o9+DisDj2U4AiTOihtfjEzBb/4CErYaB1JIWFMZTQE7zlNTdsgCs+l4xIS2Y34us0RMBIC6On1mBuwxww==
|
||||
vscode-cpptools@^6.1.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-cpptools/-/vscode-cpptools-6.1.0.tgz#d89bb225f91da45dbee6acbf45f6940aa3926df1"
|
||||
integrity sha512-+40xMmzSlvaMwWEDIjhHl9+W1RH9xaEbiFAAgLWgyL1FXxQWBguWRHgS91qBJbuFAB9H4UBuK94iFMs+7BFclA==
|
||||
|
||||
vscode-jsonrpc@^3.6.2:
|
||||
version "3.6.2"
|
||||
|
|
Загрузка…
Ссылка в новой задаче