diff options
author | Matt Godbolt <matt@godbolt.org> | 2022-12-28 11:42:14 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-28 11:42:14 -0600 |
commit | 749319f7912ff479d25d9afb1e751f4ea704b0e2 (patch) | |
tree | 6f1504440fcdaf033dc406d454bb00299b0d8fa6 /lib/compilers | |
parent | b597095f6ee657e6b1fde4b02f9bb2f61457d225 (diff) | |
download | compiler-explorer-749319f7912ff479d25d9afb1e751f4ea704b0e2.tar.gz compiler-explorer-749319f7912ff479d25d9afb1e751f4ea704b0e2.zip |
Slightly more controversial bumpings (#4503)gh-5552
- latest sentry, tar-stream, which, some yamljs versions
- latest eslint-* stuff
- latest webpack manifest
- Applies all the automatic fixes for newer lint rules
- Bump the webpack version
applies new tslint stuff
Diffstat (limited to 'lib/compilers')
-rw-r--r-- | lib/compilers/ada.ts | 6 | ||||
-rw-r--r-- | lib/compilers/clang.ts | 8 | ||||
-rw-r--r-- | lib/compilers/clean.js | 10 | ||||
-rw-r--r-- | lib/compilers/dotnet.ts | 2 | ||||
-rw-r--r-- | lib/compilers/flang.ts | 6 | ||||
-rw-r--r-- | lib/compilers/java.js | 14 | ||||
-rw-r--r-- | lib/compilers/ldc.js | 2 | ||||
-rw-r--r-- | lib/compilers/nvcc.js | 12 | ||||
-rw-r--r-- | lib/compilers/pascal-win.js | 6 | ||||
-rw-r--r-- | lib/compilers/pascal.js | 12 | ||||
-rw-r--r-- | lib/compilers/ptxas.js | 6 | ||||
-rw-r--r-- | lib/compilers/python.ts | 6 | ||||
-rw-r--r-- | lib/compilers/rga.ts | 6 | ||||
-rw-r--r-- | lib/compilers/ruby.ts | 8 | ||||
-rw-r--r-- | lib/compilers/wsl-vc.js | 6 | ||||
-rw-r--r-- | lib/compilers/z88dk.ts | 26 | ||||
-rw-r--r-- | lib/compilers/zig.ts | 6 |
17 files changed, 71 insertions, 71 deletions
diff --git a/lib/compilers/ada.ts b/lib/compilers/ada.ts index 45a1d1079..89f500f4b 100644 --- a/lib/compilers/ada.ts +++ b/lib/compilers/ada.ts @@ -95,7 +95,9 @@ export class AdaCompiler extends BaseCompiler { inputFilename, ); - if (!filters.binary) { + if (filters.binary) { + gnatmake_opts.push('-o', outputFilename); + } else { gnatmake_opts.push( '-S', // Generate ASM '-c', // Compile only @@ -110,8 +112,6 @@ export class AdaCompiler extends BaseCompiler { gnatmake_opts.push(opt); } } - } else { - gnatmake_opts.push('-o', outputFilename); } // Spread the options coming from outside (user, backend or config options) diff --git a/lib/compilers/clang.ts b/lib/compilers/clang.ts index 3343c8419..6a7554749 100644 --- a/lib/compilers/clang.ts +++ b/lib/compilers/clang.ts @@ -160,7 +160,7 @@ export class ClangCompiler extends BaseCompiler { return disassembleResult.stderr; } - return fs.readFileSync(llvmirFile, 'utf-8'); + return fs.readFileSync(llvmirFile, 'utf8'); } else { return '<error: no llvm-dis found to disassemble bitcode>'; } @@ -203,10 +203,10 @@ export class ClangCudaCompiler extends ClangCompiler { const objResult = await this.exec(this.compiler.objdumper, args, execOptions); result.asm = objResult.stdout; - if (objResult.code !== 0) { - result.asm = `<No output: nvdisasm returned ${objResult.code}>`; - } else { + if (objResult.code === 0) { result.objdumpTime = objResult.execTime; + } else { + result.asm = `<No output: nvdisasm returned ${objResult.code}>`; } return result; } diff --git a/lib/compilers/clean.js b/lib/compilers/clean.js index 26dfc28c6..c159ba1d5 100644 --- a/lib/compilers/clean.js +++ b/lib/compilers/clean.js @@ -128,7 +128,11 @@ export class CleanCompiler extends BaseCompiler { result.stdout = utils.parseOutput(this.preprocessOutput(result.stdout), inputFilename); result.stderr = utils.parseOutput(this.preprocessOutput(result.stderr), inputFilename); - if (!options.includes('-S')) { + if (options.includes('-S')) { + if (await fs.pathExists(this.getOutputFilename(tmpDir))) { + result.code = 0; + } + } else { const aOut = path.join(tmpDir, 'a.out'); if (await fs.pathExists(aOut)) { await fs.copyFile(aOut, this.getOutputFilename(tmpDir)); @@ -136,10 +140,6 @@ export class CleanCompiler extends BaseCompiler { } else { result.code = 1; } - } else { - if (await fs.pathExists(this.getOutputFilename(tmpDir))) { - result.code = 0; - } } return result; } diff --git a/lib/compilers/dotnet.ts b/lib/compilers/dotnet.ts index 5b1af77fc..cd7700725 100644 --- a/lib/compilers/dotnet.ts +++ b/lib/compilers/dotnet.ts @@ -274,7 +274,7 @@ class DotNetCompiler extends BaseCompiler { ...this.getEmptyExecutionResult(), stdout: err.stdout ? utils.parseOutput(err.stdout) : [], stderr: err.stderr ? utils.parseOutput(err.stderr) : [], - code: err.code !== undefined ? err.code : -1, + code: err.code === undefined ? -1 : err.code, }; } } diff --git a/lib/compilers/flang.ts b/lib/compilers/flang.ts index 429dfcce8..9ff8fc226 100644 --- a/lib/compilers/flang.ts +++ b/lib/compilers/flang.ts @@ -36,10 +36,10 @@ export class FlangCompiler extends FortranCompiler { if (this.compiler.intelAsm && filters.intel && !filters.binary) { options = options.concat(this.compiler.intelAsm.split(' ')); } - if (!filters.binary) { - options = options.concat('-S'); - } else { + if (filters.binary) { options = options.concat('-g'); + } else { + options = options.concat('-S'); } return options; } diff --git a/lib/compilers/java.js b/lib/compilers/java.js index b321fffe1..383f56013 100644 --- a/lib/compilers/java.js +++ b/lib/compilers/java.js @@ -81,10 +81,10 @@ export class JavaCompiler extends BaseCompiler { asm: objResult.stdout, }; - if (objResult.code !== 0) { - oneResult.asm = '<No output: javap returned ' + objResult.code + '>'; - } else { + if (objResult.code === 0) { oneResult.objdumpTime = objResult.execTime; + } else { + oneResult.asm = '<No output: javap returned ' + objResult.code + '>'; } return oneResult; }), @@ -328,11 +328,11 @@ export class JavaCompiler extends BaseCompiler { currentInstr < method.instructions.length && method.instructions[currentInstr].instrOffset !== instrOffset ) { - if (currentSourceLine !== -1) { + if (currentSourceLine === -1) { + logger.error('Skipping over instruction even though currentSourceLine == -1'); + } else { // instructions without explicit line number get assigned the last explicit/same line number method.instructions[currentInstr].sourceLine = currentSourceLine; - } else { - logger.error('Skipping over instruction even though currentSourceLine == -1'); } currentInstr++; } @@ -343,7 +343,7 @@ export class JavaCompiler extends BaseCompiler { method.instructions[currentInstr].sourceLine = currentSourceLine; } - if (typeof method.startLine === 'undefined') { + if (method.startLine === undefined) { method.startLine = sourceLine; } // method.instructions.push({sourceLine: instrOffset}); diff --git a/lib/compilers/ldc.js b/lib/compilers/ldc.js index 0583a0284..277d2979b 100644 --- a/lib/compilers/ldc.js +++ b/lib/compilers/ldc.js @@ -102,7 +102,7 @@ export class LDCCompiler extends BaseCompiler { // Demangling is not needed. const astFilename = output.inputFilename.concat('.cg'); try { - return await fs.readFile(astFilename, 'utf-8'); + return await fs.readFile(astFilename, 'utf8'); } catch (e) { if (e instanceof Error && e.code === 'ENOENT') { logger.warn(`LDC AST file ${astFilename} requested but it does not exist`); diff --git a/lib/compilers/nvcc.js b/lib/compilers/nvcc.js index ef527e5ce..d87e4a8b4 100644 --- a/lib/compilers/nvcc.js +++ b/lib/compilers/nvcc.js @@ -94,11 +94,11 @@ export class NvccCompiler extends BaseCompiler { const {code, execTime, stdout} = await this.exec(nvdisasm, args, {maxOutput, customCwd: result.dirPath}); - if (code !== 0) { - result.asm = `<No output: ${Path.basename(nvdisasm)} returned ${code}>`; - } else { + if (code === 0) { result.objdumpTime = execTime; result.asm = this.postProcessObjdumpOutput(stdout); + } else { + result.asm = `<No output: ${Path.basename(nvdisasm)} returned ${code}>`; } return result; } @@ -113,9 +113,9 @@ export class NvccCompiler extends BaseCompiler { const maxSize = this.env.ceProps('max-asm-size', 64 * 1024 * 1024); const optPromise = result.hasOptOutput ? this.processOptOutput(result.optPath) : Promise.resolve(''); const asmPromise = ( - !filters.binary - ? fs.readFile(outputFilename, {encoding: 'utf8'}) - : this.objdump(outputFilename, {}, maxSize, filters.intel, filters.demangle, filters) + filters.binary + ? this.objdump(outputFilename, {}, maxSize, filters.intel, filters.demangle, filters) + : fs.readFile(outputFilename, {encoding: 'utf8'}) ).then(asm => { result.asm = typeof asm === 'string' ? asm : asm.asm; return result; diff --git a/lib/compilers/pascal-win.js b/lib/compilers/pascal-win.js index 11c4d54dc..5c7eafae1 100644 --- a/lib/compilers/pascal-win.js +++ b/lib/compilers/pascal-win.js @@ -94,10 +94,10 @@ export class PascalWinCompiler extends BaseCompiler { let args = ['-d', outputFilename]; if (intelAsm) args = args.concat(['-M', 'intel']); return this.exec(this.compiler.objdumper, args, {maxOutput: 1024 * 1024 * 1024}).then(objResult => { - if (objResult.code !== 0) { - result.asm = '<No output: objdump returned ' + objResult.code + '>'; - } else { + if (objResult.code === 0) { result.asm = objResult.stdout; + } else { + result.asm = '<No output: objdump returned ' + objResult.code + '>'; } return result; diff --git a/lib/compilers/pascal.js b/lib/compilers/pascal.js index c1d48098e..7a8c3cb53 100644 --- a/lib/compilers/pascal.js +++ b/lib/compilers/pascal.js @@ -111,11 +111,11 @@ export class FPCCompiler extends BaseCompiler { const relevantAsmStartsAt = input.indexOf('...', systemInitOffset); if (relevantAsmStartsAt !== -1) { const lastLinefeedBeforeStart = input.lastIndexOf('\n', relevantAsmStartsAt); - if (lastLinefeedBeforeStart !== -1) { + if (lastLinefeedBeforeStart === -1) { + input = input.substr(0, input.indexOf('00000000004')) + '\n' + input.substr(relevantAsmStartsAt); + } else { input = input.substr(0, input.indexOf('00000000004')) + '\n' + input.substr(lastLinefeedBeforeStart + 1); - } else { - input = input.substr(0, input.indexOf('00000000004')) + '\n' + input.substr(relevantAsmStartsAt); } } return input; @@ -214,10 +214,10 @@ export class FPCCompiler extends BaseCompiler { valueInBrackets = valueInBrackets.substr(1); } - if (!isNaN(valueInBrackets)) { - return ` .loc ${currentFileId} ${valueInBrackets} 0`; - } else { + if (isNaN(valueInBrackets)) { return ` .file ${currentFileId} "${valueInBrackets}"`; + } else { + return ` .loc ${currentFileId} ${valueInBrackets} 0`; } } else if (asm.startsWith('.Le')) { return ' .cfi_endproc'; diff --git a/lib/compilers/ptxas.js b/lib/compilers/ptxas.js index ede18ccb8..26c63e864 100644 --- a/lib/compilers/ptxas.js +++ b/lib/compilers/ptxas.js @@ -112,10 +112,10 @@ export class PtxAssembler extends BaseCompiler { let args = ['-c', '-g', '-hex', outputFilename]; const objResult = await this.exec(this.compiler.objdumper, args, {maxOutput: maxSize, customCwd: dirPath}); result.asm = objResult.stdout; - if (objResult.code !== 0) { - result.asm = '<No output: objdump returned ' + objResult.code + '>'; - } else { + if (objResult.code === 0) { result.objdumpTime = objResult.execTime; + } else { + result.asm = '<No output: objdump returned ' + objResult.code + '>'; } return result; } diff --git a/lib/compilers/python.ts b/lib/compilers/python.ts index 1036f2222..eaf1092d7 100644 --- a/lib/compilers/python.ts +++ b/lib/compilers/python.ts @@ -60,11 +60,11 @@ export class PythonCompiler extends BaseCompiler { const lineno = parseInt(match[1]); sourceLoc = {line: lineno, file: null}; lastLineNo = lineno; - } else if (!line) { + } else if (line) { + sourceLoc = {line: lastLineNo, file: null}; + } else { sourceLoc = {line: undefined, file: null}; lastLineNo = undefined; - } else { - sourceLoc = {line: lastLineNo, file: null}; } bytecodeResult.push({text: line, source: sourceLoc}); diff --git a/lib/compilers/rga.ts b/lib/compilers/rga.ts index 71d62a252..c3f57fbb2 100644 --- a/lib/compilers/rga.ts +++ b/lib/compilers/rga.ts @@ -200,7 +200,7 @@ Please supply an ASIC from the following options:`, // architecture and appends the shader type (with underscore separators). Here, // we rename the generated file to the output file Compiler Explorer expects. - const files = await readdir(outputDir, {encoding: 'utf-8'}); + const files = await readdir(outputDir, {encoding: 'utf8'}); for (const file of files) { if (file.startsWith((asicSelection.asic as string) + '_output')) { await rename(path.join(outputDir, file), outputFile); @@ -209,9 +209,9 @@ Please supply an ASIC from the following options:`, // The register analysis file contains a legend, and register liveness data // for each line of disassembly. Interleave those lines into the final output // as assembly comments. - const asm = await readFile(outputFile, 'utf-8'); + const asm = await readFile(outputFile, 'utf8'); const asmLines = asm.split(/\r?\n/); - const analysis = await readFile(registerAnalysisFile, 'utf-8'); + const analysis = await readFile(registerAnalysisFile, 'utf8'); const analysisLines = analysis.split(/\r?\n/); // The first few lines of the register analysis are the legend. Emit those lines diff --git a/lib/compilers/ruby.ts b/lib/compilers/ruby.ts index 41ac4f40d..d84f6025a 100644 --- a/lib/compilers/ruby.ts +++ b/lib/compilers/ruby.ts @@ -62,15 +62,15 @@ export class RubyCompiler extends BaseCompiler { if (match) { lastLineNo = parseInt(match[1]); - } else if (!line) { - lastFile = null; - lastLineNo = null; - } else { + } else if (line) { const fileMatch = line.match(fileRe); if (fileMatch) { lastFile = fileMatch[1]; lastLineNo = parseInt(fileMatch[2]); } + } else { + lastFile = null; + lastLineNo = null; } const file = lastFile === baseFile ? null : lastFile; diff --git a/lib/compilers/wsl-vc.js b/lib/compilers/wsl-vc.js index edc3b8062..5e1f24d8c 100644 --- a/lib/compilers/wsl-vc.js +++ b/lib/compilers/wsl-vc.js @@ -69,10 +69,10 @@ export class WslVcCompiler extends Win32VcCompiler { options.env = Object.assign({}, options.env); let old_env = options.env['WSLENV']; - if (!old_env) { - old_env = ''; - } else { + if (old_env) { old_env = ':' + old_env; + } else { + old_env = ''; } options.env['WSLENV'] = 'INCLUDE:LIB' + old_env; diff --git a/lib/compilers/z88dk.ts b/lib/compilers/z88dk.ts index c7b0b7ecf..b5d73dd1a 100644 --- a/lib/compilers/z88dk.ts +++ b/lib/compilers/z88dk.ts @@ -83,10 +83,10 @@ export class z88dkCompiler extends BaseCompiler { } protected override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string): string[] { - if (!filters.binary) { - return ['-S']; - } else { + if (filters.binary) { return ['-o', outputFilename + '.s', '-create-app']; + } else { + return ['-S']; } } @@ -121,15 +121,15 @@ export class z88dkCompiler extends BaseCompiler { outputFilename = this.getObjdumpOutputFilename(outputFilename); // sometimes (with +z80 for example) the .bin file is written and the .s file is empty - if (!(await utils.fileExists(outputFilename + '.bin'))) { - if (!(await utils.fileExists(outputFilename + '.s'))) { + if (await utils.fileExists(outputFilename + '.bin')) { + outputFilename += '.bin'; + } else { + if (await utils.fileExists(outputFilename + '.s')) { + outputFilename += '.s'; + } else { result.asm = '<No output file ' + outputFilename + '.s>'; return result; - } else { - outputFilename += '.s'; } - } else { - outputFilename += '.bin'; } const args = [outputFilename]; @@ -149,12 +149,12 @@ export class z88dkCompiler extends BaseCompiler { }; const objResult = await this.exec(this.compiler.objdumper, args, execOptions); - if (objResult.code !== 0) { - logger.error(`Error executing objdump ${this.compiler.objdumper}`, objResult); - result.asm = `<No output: objdump returned ${objResult.code}>`; - } else { + if (objResult.code === 0) { result.objdumpTime = objResult.execTime; result.asm = this.postProcessObjdumpOutput(objResult.stdout); + } else { + logger.error(`Error executing objdump ${this.compiler.objdumper}`, objResult); + result.asm = `<No output: objdump returned ${objResult.code}>`; } } diff --git a/lib/compilers/zig.ts b/lib/compilers/zig.ts index eed8a4bce..4862e8c87 100644 --- a/lib/compilers/zig.ts +++ b/lib/compilers/zig.ts @@ -120,10 +120,10 @@ export class ZigCompiler extends BaseCompiler { const outputDir = path.dirname(outputFilename); options.push('--cache-dir', outputDir, '--name', name); - if (!filters.binary) { - options.push('-fno-emit-bin', '-femit-asm=' + desiredName); - } else { + if (filters.binary) { options.push('-femit-bin=' + desiredName); + } else { + options.push('-fno-emit-bin', '-femit-asm=' + desiredName); } return options; } |