diff options
author | Matt Godbolt <matt@godbolt.org> | 2021-05-27 23:25:37 -0500 |
---|---|---|
committer | Matt Godbolt <matt@godbolt.org> | 2021-05-27 23:25:37 -0500 |
commit | 5c5bc4dd50f4e278a723a8f8494f74148fdad8f1 (patch) | |
tree | 0e52091935f935533ca9e8041233d0305e5f22c7 /lib | |
parent | 4e36d206b4f9d63a8cf6aca4835d734a4a3beb72 (diff) | |
download | compiler-explorer-5c5bc4dd50f4e278a723a8f8494f74148fdad8f1.tar.gz compiler-explorer-5c5bc4dd50f4e278a723a8f8494f74148fdad8f1.zip |
Dont array push multiple times
Diffstat (limited to 'lib')
-rw-r--r-- | lib/buildenvsetup/cliconan.js | 23 | ||||
-rw-r--r-- | lib/compilers/assembly.js | 3 | ||||
-rw-r--r-- | lib/compilers/java.js | 3 | ||||
-rw-r--r-- | lib/compilers/pascal.js | 4 | ||||
-rw-r--r-- | lib/compilers/ptxas.js | 7 | ||||
-rw-r--r-- | lib/exec.js | 3 | ||||
-rw-r--r-- | lib/tooling/clang-query-tool.js | 3 | ||||
-rw-r--r-- | lib/tooling/pvs-studio-tool.js | 29 |
8 files changed, 34 insertions, 41 deletions
diff --git a/lib/buildenvsetup/cliconan.js b/lib/buildenvsetup/cliconan.js index 52a3cf898..3b045c029 100644 --- a/lib/buildenvsetup/cliconan.js +++ b/lib/buildenvsetup/cliconan.js @@ -33,7 +33,9 @@ import { logger } from '../logger'; import { BuildEnvSetupBase } from './base'; export class BuildEnvSetupCliConan extends BuildEnvSetupBase { - static get key() { return 'cliconan'; } + static get key() { + return 'cliconan'; + } constructor(compilerInfo, env, execCompilerCachedFunc) { super(compilerInfo, env, execCompilerCachedFunc); @@ -83,16 +85,17 @@ export class BuildEnvSetupCliConan extends BuildEnvSetupBase { const stdver = ''; const flagcollection = ''; - let args = ['install', '.']; + const args = ['install', '.']; if (this.remote) args.push('-r', this.remote); - args.push('-s', 'os=Linux'); - args.push('-s', 'build_type=Debug'); - args.push('-s', `compiler=${this.compilerTypeOrGCC}`); - args.push('-s', `compiler.version=${this.compiler.id}`); - args.push('-s', `compiler.libcxx=${libcxx}`); - args.push('-s', `arch=${arch}`); - args.push('-s', `stdver=${stdver}`); - args.push('-s', `flagcollection=${flagcollection}`); + args.push( + '-s', 'os=Linux', + '-s', 'build_type=Debug', + '-s', `compiler=${this.compilerTypeOrGCC}`, + '-s', `compiler.version=${this.compiler.id}`, + '-s', `compiler.libcxx=${libcxx}`, + '-s', `arch=${arch}`, + '-s', `stdver=${stdver}`, + '-s', `flagcollection=${flagcollection}`); logger.info('Conan install: ', args); return exec.execute(this.exe, args, {customCwd: dirPath}); diff --git a/lib/compilers/assembly.js b/lib/compilers/assembly.js index fe6e59439..40e0042bd 100644 --- a/lib/compilers/assembly.js +++ b/lib/compilers/assembly.js @@ -111,8 +111,7 @@ export class AssemblyCompiler extends BaseCompiler { const options = ['-o', outputFilename]; if (inputArch === 'x86') { - options.push('-m'); - options.push('elf_i386'); + options.push('-m', 'elf_i386'); } else if (inputArch === 'x86_64') { // default target } else { diff --git a/lib/compilers/java.js b/lib/compilers/java.js index 1a7c22672..2d90856eb 100644 --- a/lib/compilers/java.js +++ b/lib/compilers/java.js @@ -158,8 +158,7 @@ export class JavaCompiler extends BaseCompiler { parseds.forEach((parsed, classNumber) => { if (classNumber > 0) { // Separate classes with two line breaks - segments.push({text: '', source: null}); - segments.push({text: '', source: null}); + segments.push({text: '', source: null}, {text: '', source: null}); } for (let i = 0; i < parsed.textsBeforeMethod.length; i++) { // Line-based highlighting doesn't work if some segments span multiple lines, diff --git a/lib/compilers/pascal.js b/lib/compilers/pascal.js index a637cce02..1497bd5b0 100644 --- a/lib/compilers/pascal.js +++ b/lib/compilers/pascal.js @@ -139,9 +139,7 @@ export class FPCCompiler extends BaseCompiler { await this.saveDummyProjectFile(projectFile); options.pop(); - options.push('-FE' + dirPath); - options.push('-B'); - options.push(projectFile); + options.push('-FE' + dirPath, '-B', projectFile); return this.parseOutput(await this.exec(compiler, options, execOptions), inputFilename, dirPath); } diff --git a/lib/compilers/ptxas.js b/lib/compilers/ptxas.js index 1d94ead55..87cec8df0 100644 --- a/lib/compilers/ptxas.js +++ b/lib/compilers/ptxas.js @@ -31,7 +31,9 @@ import * as utils from '../utils'; import { BaseParser } from './argument-parsers'; export class PtxAssembler extends BaseCompiler { - static get key() { return 'ptxas'; } + static get key() { + return 'ptxas'; + } constructor(info, env) { super(info, env); @@ -88,8 +90,7 @@ export class PtxAssembler extends BaseCompiler { execOptions = this.getDefaultExecOptions(); } const dirPath = path.dirname(inputFilename); - options.push('-o'); - options.push(this.getOutputFilename(dirPath, this.outputFilebase)); + options.push('-o', this.getOutputFilename(dirPath, this.outputFilebase)); execOptions.customCwd = path.dirname(inputFilename); const result = await this.exec(compiler, options, execOptions); diff --git a/lib/exec.js b/lib/exec.js index 68bffd0fa..4ac9662b7 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -418,8 +418,7 @@ function executeFirejail(command, args, options) { options.env = applyWineEnv(options.env); args = [command, ...args]; command = execProps('wine'); - baseOptions.push('--profile=etc/firejail/wine.profile'); - baseOptions.push(`--join=${wineSandboxName}`); + baseOptions.push('--profile=etc/firejail/wine.profile', `--join=${wineSandboxName}`); delete options.customCwd; baseOptions.push(command); return executeDirect(firejail, baseOptions.concat(args), options); diff --git a/lib/tooling/clang-query-tool.js b/lib/tooling/clang-query-tool.js index 0f2f88035..990de7042 100644 --- a/lib/tooling/clang-query-tool.js +++ b/lib/tooling/clang-query-tool.js @@ -52,8 +52,7 @@ export class ClangQueryTool extends BaseTool { await fs.writeFile(path.join(dir, 'compile_flags.txt'), compileFlags.join('\n')); await fs.writeFile(path.join(dir, query_commands_file), stdin); - args.push('-f'); - args.push(query_commands_file); + args.push('-f', query_commands_file); const toolResult = await super.runTool(compilationInfo, sourcefile, args); if (toolResult.stdout.length > 0) { diff --git a/lib/tooling/pvs-studio-tool.js b/lib/tooling/pvs-studio-tool.js index 6573d9274..a20a31526 100644 --- a/lib/tooling/pvs-studio-tool.js +++ b/lib/tooling/pvs-studio-tool.js @@ -71,20 +71,18 @@ export class PvsStudioTool extends BaseTool { args = []; // Necessary arguments - args.push('analyze'); - args.push('--source-file', inputFilepath); + args.push('analyze', '--source-file', inputFilepath); const outputFilePath = path.join(sourceDir, 'pvs-studio-log.log'); - args.push('--output-file', outputFilePath); - - // Exclude directories from analysis - args.push('-e', '/opt'); - args.push('-e', '/usr'); - - args.push('--pvs-studio-path', path.dirname(this.tool.exe) + '/pvs-studio'); - - // TODO: expand this to switch() for all supported compilers: - // visualcpp, clang, gcc, bcc, bcc_clang64, iar, keil5, keil5_gnu - args.push('--preprocessor'); + args.push( + '--output-file', outputFilePath, + // Exclude directories from analysis + '-e', '/opt', + '-e', '/usr', + '--pvs-studio-path', path.dirname(this.tool.exe) + '/pvs-studio', + // TODO: expand this to switch() for all supported compilers: + // visualcpp, clang, gcc, bcc, bcc_clang64, iar, keil5, keil5_gnu + '--preprocessor', + ); if (compilationInfo.compiler.group.includes('clang')) args.push('clang'); else @@ -96,10 +94,7 @@ export class PvsStudioTool extends BaseTool { } else { args.push('--cxx'); } - args.push(compilationInfo.compiler.exe); - - // Let the tool know the compilation options - args.push('--cl-params'); + args.push(compilationInfo.compiler.exe, '--cl-params'); args = args.concat(compileFlags); // If you are to modify this code, |