Skip to content

Commit

Permalink
Slightly more controversial bumpings (#4503)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
mattgodbolt committed Dec 28, 2022
1 parent b597095 commit 749319f
Show file tree
Hide file tree
Showing 67 changed files with 1,218 additions and 790 deletions.
8 changes: 5 additions & 3 deletions app.js
Expand Up @@ -388,7 +388,7 @@ function startListening(server) {
if (ss) {
// ms (5 min default)
const idleTimeout = process.env.IDLE_TIMEOUT;
const timeout = (typeof idleTimeout !== 'undefined' ? idleTimeout : 300) * 1000;
const timeout = (idleTimeout === undefined ? 300 : idleTimeout) * 1000;
if (idleTimeout) {
const exit = () => {
logger.info('Inactivity timeout reached, exiting.');
Expand Down Expand Up @@ -598,7 +598,7 @@ async function main() {
}
});

const sponsorConfig = loadSponsorsFromString(fs.readFileSync(configDir + '/sponsors.yaml', 'utf-8'));
const sponsorConfig = loadSponsorsFromString(fs.readFileSync(configDir + '/sponsors.yaml', 'utf8'));

loadSiteTemplates(configDir);

Expand Down Expand Up @@ -646,7 +646,7 @@ async function main() {
mobileViewer: isMobileViewer(req),
config: config,
metadata: metadata,
storedStateId: req.params.id ? req.params.id : false,
storedStateId: req.params.id || false,
},
req.query,
),
Expand Down Expand Up @@ -833,6 +833,8 @@ function terminationHandler(name, code) {
};
}

// Once we move to modules, we can remove this and use a top level await.
// eslint-disable-next-line unicorn/prefer-top-level-await
main().catch(err => {
logger.error('Top-level error (shutting down):', err);
process.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion lib/assert.ts
Expand Up @@ -47,7 +47,7 @@ function get_diagnostic() {
const relative = check_path(global.ce_base_directory, invoker_frame.fileName);
if (relative) {
try {
const file = fs.readFileSync(invoker_frame.fileName, 'utf-8');
const file = fs.readFileSync(invoker_frame.fileName, 'utf8');
const lines = file.split('\n');
return {
file: relative,
Expand Down
105 changes: 52 additions & 53 deletions lib/base-compiler.ts
Expand Up @@ -426,12 +426,12 @@ export class BaseCompiler implements ICompiler {
};
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}>`;
}
}

Expand Down Expand Up @@ -501,7 +501,7 @@ export class BaseCompiler implements ICompiler {
...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,
};
}
}
Expand Down Expand Up @@ -616,8 +616,7 @@ export class BaseCompiler implements ICompiler {
foundLib.versions,
(o: LibraryVersion, versionId: string): boolean => {
if (versionId === selectedLib.version) return true;
if (o.alias && o.alias.includes(selectedLib.version)) return true;
return false;
return !!(o.alias && o.alias.includes(selectedLib.version));
},
);

Expand Down Expand Up @@ -793,7 +792,7 @@ export class BaseCompiler implements ICompiler {
protected getSharedLibraryPathsAsLdLibraryPaths(libraries) {
let paths = '';
if (!this.alwaysResetLdPath) {
paths = process.env.LD_LIBRARY_PATH ? process.env.LD_LIBRARY_PATH : '';
paths = process.env.LD_LIBRARY_PATH || '';
}
return _.union(
paths.split(path.delimiter).filter(p => !!p),
Expand All @@ -805,7 +804,7 @@ export class BaseCompiler implements ICompiler {
getSharedLibraryPathsAsLdLibraryPathsForExecution(libraries) {
let paths = '';
if (!this.alwaysResetLdPath) {
paths = process.env.LD_LIBRARY_PATH ? process.env.LD_LIBRARY_PATH : '';
paths = process.env.LD_LIBRARY_PATH || '';
}
return _.union(
paths.split(path.delimiter).filter(p => !!p),
Expand Down Expand Up @@ -1040,7 +1039,7 @@ export class BaseCompiler implements ICompiler {
async processIrOutput(output, filters: ParseFiltersAndOutputOptions) {
const irPath = this.getIrOutputFilename(output.inputFilename, filters);
if (await fs.pathExists(irPath)) {
const output = await fs.readFile(irPath, 'utf-8');
const output = await fs.readFile(irPath, 'utf8');
// uses same filters as main compiler
return this.llvmIr.process(output, filters);
}
Expand Down Expand Up @@ -1075,7 +1074,7 @@ export class BaseCompiler implements ICompiler {
return {
error: 'Clang invocation timed out',
results: {},
clangTime: output.execTime ? output.execTime : compileEnd - compileStart,
clangTime: output.execTime || compileEnd - compileStart,
};
}

Expand Down Expand Up @@ -1176,7 +1175,7 @@ export class BaseCompiler implements ICompiler {
return [{text: `Failed to run compiler to get Rust ${outputFriendlyName}`}];
}
if (await utils.fileExists(outputFilename)) {
const content = await fs.readFile(outputFilename, 'utf-8');
const content = await fs.readFile(outputFilename, 'utf8');
return content.split('\n').map(line => ({
text: line,
}));
Expand All @@ -1200,7 +1199,7 @@ export class BaseCompiler implements ICompiler {
return [{text: 'Failed to run compiler to get Rust MIR'}];
}
if (await utils.fileExists(mirPath)) {
const content = await fs.readFile(mirPath, 'utf-8');
const content = await fs.readFile(mirPath, 'utf8');
return content.split('\n').map(line => ({
text: line,
}));
Expand All @@ -1213,7 +1212,7 @@ export class BaseCompiler implements ICompiler {
return [{text: 'Failed to run compiler to get Haskell Core'}];
}
if (await utils.fileExists(outpath)) {
const content = await fs.readFile(outpath, 'utf-8');
const content = await fs.readFile(outpath, 'utf8');
// output file starts with
//
// ==================== <HEADER> ====================
Expand Down Expand Up @@ -1302,19 +1301,19 @@ export class BaseCompiler implements ICompiler {
// very usefull to debug error message.

if (contentDebugExpanded.length === 0)
if (result.code !== 0) {
contentDebugExpanded.push({text: 'GNAT exited with an error and did not create the expanded code'});
} else {
if (result.code === 0) {
contentDebugExpanded.push({
text: 'GNAT exited successfully but the expanded code is missing, something is wrong',
});
} else {
contentDebugExpanded.push({text: 'GNAT exited with an error and did not create the expanded code'});
}

if (contentDebugTree.length === 0)
if (result.code !== 0) {
contentDebugTree.push({text: 'GNAT exited with an error and did not create the Tree'});
} else {
if (result.code === 0) {
contentDebugTree.push({text: 'GNAT exited successfully but the Tree is missing, something is wrong'});
} else {
contentDebugTree.push({text: 'GNAT exited with an error and did not create the Tree'});
}

return {
Expand Down Expand Up @@ -1617,21 +1616,21 @@ export class BaseCompiler implements ICompiler {
stdout: [],
timedOut: false,
};
} else {
if (!(await utils.fileExists(buildResult.executableFilename))) {
const verboseResult = {
code: -1,
didExecute: false,
buildResult,
stderr: [{text: 'Executable not found'}],
stdout: [],
timedOut: false,
};
}

if (!(await utils.fileExists(buildResult.executableFilename))) {
const verboseResult = {
code: -1,
didExecute: false,
buildResult,
stderr: [{text: 'Executable not found'}],
stdout: [],
timedOut: false,
};

verboseResult.buildResult.stderr.push({text: 'Compiler did not produce an executable'});
verboseResult.buildResult.stderr.push({text: 'Compiler did not produce an executable'});

return verboseResult;
}
return verboseResult;
}

if (!this.compiler.supportsExecute) {
Expand Down Expand Up @@ -2003,7 +2002,13 @@ export class BaseCompiler implements ICompiler {
const outputFilename = this.getExecutableFilename(path.join(dirPath, 'build'), this.outputFilebase, key);

let fullResult = await this.loadPackageWithExecutable(cacheKey, dirPath);
if (!fullResult) {
if (fullResult) {
fullResult.fetchedFromCache = true;

delete fullResult.inputFilename;
delete fullResult.executableFilename;
delete fullResult.dirPath;
} else {
let writeSummary;
try {
writeSummary = await this.writeAllFilesCMake(dirPath, cacheKey.source, files, cacheKey.filters);
Expand Down Expand Up @@ -2095,12 +2100,6 @@ export class BaseCompiler implements ICompiler {
});

await this.storePackageWithExecutable(cacheKey, dirPath, fullResult);
} else {
fullResult.fetchedFromCache = true;

delete fullResult.inputFilename;
delete fullResult.executableFilename;
delete fullResult.dirPath;
}

fullResult.result.dirPath = dirPath;
Expand Down Expand Up @@ -2293,7 +2292,9 @@ export class BaseCompiler implements ICompiler {
this.doTempfolderCleanup(result.buildResult);
}

if (!backendOptions.skipAsm) {
if (backendOptions.skipAsm) {
result.asm = [];
} else {
if (!result.externalParserUsed) {
if (result.okToCache) {
const res = this.processAsm(result, filters, options);
Expand All @@ -2312,15 +2313,13 @@ export class BaseCompiler implements ICompiler {
// TODO rephrase this so we don't need to reassign
result = filters.demangle ? await this.postProcessAsm(result, filters) : result;
if (this.compiler.supportsCfg && backendOptions.produceCfg) {
if (!options.includes('-emit-llvm')) {
result.cfg = cfg.generateStructure(this.compiler.compilerType, this.compiler.version, result.asm);
} else {
if (options.includes('-emit-llvm')) {
// for now do not generate a cfg for llvm ir
result.cfg = {};
} else {
result.cfg = cfg.generateStructure(this.compiler.compilerType, this.compiler.version, result.asm);
}
}
} else {
result.asm = [];
}

if (!backendOptions.skipPopArgs) result.popularArguments = this.possibleArguments.getPopularArguments(options);
Expand Down Expand Up @@ -2364,7 +2363,7 @@ export class BaseCompiler implements ICompiler {
const output: any[] = [];

const optStream = fs
.createReadStream(optPath, {encoding: 'utf-8'})
.createReadStream(optPath, {encoding: 'utf8'})
.pipe(new compilerOptInfo.LLVMOptTransformer());

for await (const opt of optStream) {
Expand Down Expand Up @@ -2497,7 +2496,7 @@ export class BaseCompiler implements ICompiler {
output.currentPassOutput = '';

if (dumpFileName && (await fs.pathExists(dumpFileName)))
output.currentPassOutput = await fs.readFile(dumpFileName, 'utf-8');
output.currentPassOutput = await fs.readFile(dumpFileName, 'utf8');
// else leave the currentPassOutput empty. Can happen when some
// UI options are changed and a now disabled pass is still
// requested.
Expand Down Expand Up @@ -2674,17 +2673,17 @@ but nothing was dumped. Possible causes are:

this.initialiseLibraries(clientOptions);

if (!isPrediscovered) {
const initResult = await this.getArgumentParser().parse(this);
logger.info(`${compiler} ${version} is ready`);
return initResult;
} else {
if (isPrediscovered) {
logger.info(`${compiler} ${version} is ready`);
if (this.compiler.cachedPossibleArguments) {
this.possibleArguments.populateOptions(this.compiler.cachedPossibleArguments);
delete this.compiler.cachedPossibleArguments;
}
return this;
} else {
const initResult = await this.getArgumentParser().parse(this);
logger.info(`${compiler} ${version} is ready`);
return initResult;
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/buildenvsetup/base.ts
Expand Up @@ -46,7 +46,7 @@ export class BuildEnvSetupBase {

this.compilerOptionsArr = utils.splitArguments(this.compiler.options);
this.compilerArch = this.getCompilerArch();
this.compilerTypeOrGCC = compilerInfo.compilerType ? compilerInfo.compilerType : 'gcc';
this.compilerTypeOrGCC = compilerInfo.compilerType || 'gcc';
if (this.compilerTypeOrGCC === 'clang-intel') this.compilerTypeOrGCC = 'gcc';
this.compilerSupportsX86 = !this.compilerArch;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/buildenvsetup/ceconan.ts
Expand Up @@ -196,7 +196,7 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {

_.each(libraryDetails, (details, libId) => {
if (this.hasBinariesToLink(details)) {
const lookupversion = details.lookupversion ? details.lookupversion : details.version;
const lookupversion = details.lookupversion || details.version;
allLibraryBuilds.push({
id: libId,
version: details.version,
Expand All @@ -209,7 +209,7 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
const buildProperties = await this.getConanBuildProperties(key);

for (const libVerBuilds of allLibraryBuilds) {
const lookupversion = libVerBuilds.lookupversion ? libVerBuilds.lookupversion : libVerBuilds.version;
const lookupversion = libVerBuilds.lookupversion || libVerBuilds.version;
const libVer = `${libVerBuilds.id}/${lookupversion}`;
const possibleBuilds = await libVerBuilds.possibleBuilds;
if (possibleBuilds) {
Expand Down
12 changes: 8 additions & 4 deletions lib/cache/from-config.ts
Expand Up @@ -49,20 +49,24 @@ function createInternal(name: string, config: string): Cache {
if (!match) throw new Error(`Unable to parse '${config}'`);
const params = match[2].split(',');
switch (match[1]) {
case 'InMemory':
case 'InMemory': {
if (params.length !== 1) throw new Error(`Bad params: ${config}`);
return new InMemoryCache(name, paramInt(config, params[0]));
}

case 'OnDisk':
case 'OnDisk': {
if (params.length !== 2) throw new Error(`Bad params: ${config}`);
return new OnDiskCache(name, params[0], paramInt(config, params[1]));
}

case 'S3':
case 'S3': {
if (params.length !== 3) throw new Error(`Bad params: ${config}`);
return new S3Cache(name, params[0], params[1], params[2]);
}

default:
default: {
throw new Error(`Unrecognised cache type '${match[1]}'`);
}
}
}

Expand Down
17 changes: 12 additions & 5 deletions lib/cfg.js
Expand Up @@ -83,8 +83,11 @@ const gcc = {
getInstructionType: inst => {
if (inst.includes('jmp') || inst.includes(' b ')) return InstructionType_jmp;
else if (gcc.isJmpInstruction(inst)) return InstructionType_conditionalJmpInst;
else if (!inst.includes(' ret')) return InstructionType_notRetInst;
else return InstructionType_retInst;
else if (inst.includes(' ret')) {
return InstructionType_retInst;
} else {
return InstructionType_notRetInst;
}
},

extractNodeName: inst => inst.match(/\.L\d+/) + ':',
Expand Down Expand Up @@ -114,8 +117,11 @@ const clang = {
getInstructionType: function (inst) {
if (inst.includes('jmp') || inst.includes(' b ')) return InstructionType_jmp;
else if (clang.isJmpInstruction(inst)) return InstructionType_conditionalJmpInst;
else if (!inst.includes(' ret')) return InstructionType_notRetInst;
else return InstructionType_retInst;
else if (inst.includes(' ret')) {
return InstructionType_retInst;
} else {
return InstructionType_notRetInst;
}
},

extractNodeName: inst => inst.match(/\.LBB\d+_\d+/) + ':',
Expand Down Expand Up @@ -294,8 +300,9 @@ function makeEdges(asmArr, arrOfCanonicalBasicBlock, rules) {
}
break;
}
case InstructionType_retInst:
case InstructionType_retInst: {
break;
}
}
});
logger.debug(edges);
Expand Down

0 comments on commit 749319f

Please sign in to comment.