Browse Source

Configurable binary support

dev/git-series/gccdum
Matt Godbolt 7 years ago
parent
commit
0e55624881
  1. 4
      app.js
  2. 1
      etc/config/c++.defaults.properties
  3. 1
      etc/config/d.defaults.properties
  4. 1
      etc/config/go.defaults.properties
  5. 1
      etc/config/rust.defaults.properties
  6. 12
      static/compiler.js
  7. 3
      static/index.html

4
app.js

@ -142,6 +142,7 @@ function clientOptionsHandler(compilers, fileSources) {
compilers: compilers,
defaultCompiler: compilerProps('defaultCompiler', ''),
compileOptions: compilerProps("options"),
supportsBinary: !!compilerProps("supportsBinary"),
sources: sources
};
var text = "var OPTIONS = " + JSON.stringify(options) + ";";
@ -270,8 +271,7 @@ function configuredCompilers() {
alias: compilerProps(base + ".alias"),
versionFlag: compilerProps(base + ".versionFlag"),
is6g: !!compilerProps(base + ".is6g", false),
intelAsm: compilerProps(base + ".intelAsm", ""),
supportsBinary: !!compilerProps(base + ".supportsBinary", false)
intelAsm: compilerProps(base + ".intelAsm", "")
});
}));
}

1
etc/config/c++.defaults.properties

@ -4,6 +4,7 @@ compileFilename=example.cpp
postProcess=c++filt
#androidNdk=/opt/google/android-ndk-r9c
options=-O2
supportsBinary=true
binaryHideFuncRe=^(_.*|(de)?register_tm_clones|frame_dummy)$
stubRe=\bmain\b
stubText=int main(int,char**){/*stub provided by Compiler Explorer*/}

1
etc/config/d.defaults.properties

@ -1,3 +1,4 @@
compilers=/usr/bin/gdc:/usr/bin/gdc-4.4:/usr/bin/gdc-4.6
compileFilename=example.d
postProcess=d/demangle
supportsBinary=false

1
etc/config/go.defaults.properties

@ -1,4 +1,5 @@
compileFilename=file.go
supportsBinary=true
binaryHideFuncRe=^(_.*|(de)?register_tm_clones|frame_dummy|.*@plt)$
stubRe=\bfunc\s+main\b
stubText=func main() {/*stub provided by Compiler Explorer*/}

1
etc/config/rust.defaults.properties

@ -2,6 +2,7 @@ compilers=/usr/local/bin/rustc
options=-O --crate-type staticlib
compileFilename=example.rs
compileToAsm=--emit asm --crate-type staticlib
supportsBinary=true
stubRe=\bmain\b
stubText=pub fn main() {/*stub provided by Compiler Explorer*/}
binaryHideFuncRe=^(_.*|(de)?register_tm_clones|frame_dummy|.*@plt.*)$

12
static/compiler.js

@ -43,6 +43,12 @@ function clearBackground(cm) {
}
}
function patchUpFilters(filters) {
if (!OPTIONS.supportsBinary && filters.binary)
filters.binary = false;
return filters;
}
const NumRainbowColours = 12;
function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback, lang) {
@ -53,7 +59,7 @@ function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback, lan
var cppEditor = null;
var lastRequest = null;
var currentAssembly = null;
var filters = origFilters;
var filters = patchUpFilters(origFilters);
var ignoreChanges = true; // Horrible hack to avoid onChange doing anything on first starting, ie before we've set anything up.
var cmMode;
@ -343,7 +349,7 @@ function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback, lan
var compiler = compilersById[$('.compiler').val()];
if (compiler === undefined)
return;
var supportsIntel = compiler.asm || filters.binary; // TODO: separate binary so it has its own buttons and then this problem goes away
var supportsIntel = compiler.asm || (filters.binary); // TODO: separate binary so it has its own buttons and then this problem goes away
domRoot.find('.filter button.btn[value="intel"]').toggleClass("disabled", !supportsIntel);
$(".compilerVersion").text(compiler.name + " (" + compiler.version + ")");
}
@ -376,7 +382,7 @@ function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback, lan
}
function setFilters(f) {
filters = f;
filters = patchUpFilters(f);
onChange();
}

3
static/index.html

@ -115,12 +115,12 @@
<table><tbody><tr><td>Filter:&nbsp;</td>
<td>
<div class="btn-group filter">
<button class="btn" type="button" value="binary">Binary</button>
<button class="btn active" type="button" value="labels">Unused labels</button>
<button class="btn active" type="button" value="directives">Directives</button>
<button class="btn active" type="button" value="commentOnly">Comment-only lines</button>
<button class="btn" type="button" value="intel">Intel syntax</button>
<button class="btn" type="button" value="colouriseAsm">Colourise</button>
<button class="btn" type="button" value="binary">Binary</button>
</div>
</td></table>
</form>
@ -199,6 +199,7 @@ func main() {}
.attr('useMap', '#ghm')
.appendTo(document.body)
}
$('.filter button.btn[value="binary"]').toggle(OPTIONS.supportsBinary);
})();
</script>
</body>

Loading…
Cancel
Save