2639 Commits
Author SHA1 Message Date
Patrick Quist bd9e2d4cbc fix remote libraries listing backend and frontend (#7688) 2025-05-16 16:53:40 +02:00
Partouf ca5e088d1f skip stdver matching 2025-05-13 21:58:58 +02:00
narpfel 703b13ae01 Fix Rust edition argument parser (#7652)
* For `nightly` Rust (and 1.88+), the output format of `--help` was
changed in https://github.com/rust-lang/rust/pull/140152.
This PR changes the parser to parse the new format, so that edition
overrides are selectable for `nightly` Rust. Note the `<>`:
  ```
          --edition <2015|2018|2021|2024|future>
Specify which edition of the compiler to use when
compiling code. The default is 2015 and the latest
                          stable edition is 2024.
  ```
* Rust <= 1.34 (and >= 1.31) support the 2018 edition, but the help
message only includes `--edition` in verbose mode.
2025-05-12 12:54:48 -05:00
Abhilash Majumder 4649b3dd0e Add PTX as a separate module from assembler (#7615) 2025-05-12 12:51:03 -05:00
Matt GodboltandClaude 54c942ba76 Replace nopt with commander.js for argument parsing (#7673)
- Replace nopt with commander.js for better command-line argument parsing
- Add automatic help generation with detailed descriptions
- Maintain backward compatibility with existing arguments
- Remove unused nopt dependency from package.json

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-12 12:49:28 -05:00
Matt Godbolt 59aceae9c4 Simplify and extract types (#7680)
- prevents anything importing from `app.js`
- generally tidies up and removes unused stuff
- makes typing a bit more correct
2025-05-12 10:28:51 -05:00
Matt Godbolt eaa083edc3 Simplify noscript handling, and add types (#7677) 2025-05-12 08:32:21 -05:00
narpfel 1150078f7d Treat opt output as LLVM IR (#7670)
Resolves #7669.

`processAsm` didn’t recognise that `opt` generates LLVM IR, so it
invoked the generic `AsmParser` instead.
2025-05-11 23:38:31 -05:00
Matt GodboltandClaude 2f892583ba Remove global handler_config variable (#7675)
The global handler_config was being used to allow compilers to find
other compilers. This change replaces that global with a proper method
on the CompilationEnvironment class, allowing compilers to find other
compilers through the environment instead of using a global variable.

🤖 PR description generated with [Claude Code](https://claude.ai/code) -
code by @mattgodbolt though :)

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-11 19:47:58 -05:00
Matt GodboltandClaude ad5bec7626 Remove top-level global for base directory (#7674)
This PR removes the top-level global variable for the base directory and replaces it with a module-level variable managed through a setter function. Key changes include removing the global declaration in lib/global.ts, introducing a local ce_base_directory variable and setBaseDirectory function in lib/assert.ts, and updating app.ts to use the new setter.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-11 19:28:04 -05:00
Matt Godbolt 9a7e0d4ed8 Fix up import order 2025-05-11 16:15:21 -05:00
Rucadi aa5c02fa70 Add Nix Language (#6198) 2025-05-11 16:07:40 -05:00
partouf 50d044407b fixes for running CE on osx 2025-05-08 16:52:32 +02:00
Patrick Quist b7a35dedf6 Fix loading projects from zip file (#7639) 2025-05-07 19:32:18 +02:00
Anton Baliasnikov e5c982e7d9 Add solx, new Solidity LLVM-based compiler (#7633) 2025-05-05 13:05:17 +02:00
Matt Godbolt 04bcf21900 Bump to latest sentry; preload etc (#7617)
New node sentry prefers some node.js "preload" nonsense. I use this
"hack" to avoid having to make a lock-step change to the runner: tested
locally and then deployed to staging and tested there with both
server-side and client-side errors.
2025-04-26 13:36:11 -05:00
Detjon Mataj c79e41f77a Remove dependency on request and replace it with node's builtin fetch (#6800)
resolves #5289
2025-04-25 21:24:07 -05:00
Patrick Quist afdea17163 fix sway std path and build command (#7597) 2025-04-23 15:53:49 +02:00
c3ca289a05 Specifically allow OPTIONS for browser preflight CORS checks. (#7596)
Google AI suggested too (independently, I did this first then searched
and got:

---

1. Using Middleware
A middleware function can intercept OPTIONS requests and set the
appropriate CORS headers.

```js
app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS");
  res.header("Access-Control-Allow-Headers", "Content-Type, Authorization");
  if (req.method === 'OPTIONS') {
    res.sendStatus(200);
  } else {
    next();
  }
});
```
---

Tested locally with curl on GET, OPTIONS, and POST and correctly lets
OPTIONS return an empty CORS block, etc. And the site works too :)

---------

Co-authored-by: Mats Jun Larsen <mats@jun.codes>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-22 21:29:04 -05:00
narpfel 355d49ec63 [c2rust]: allow passing arguments to clang (#7583)
To pass arguments to `clang` (such as `-std=...`), `--` must be used to
separate these arguments from the arguments to `c2rust`:

```console
$ ./c2rust-transpile --help
transpile 0.20.0
[...]
USAGE:
    c2rust-transpile [OPTIONS] [COMPILE_COMMANDS]... [-- <EXTRA_CLANG_ARGS>...]
```

However, when doing this, the input file must be passed *before* the
`--`. Also, when libraries are enabled, the include and link flags must
be passed to `clang` (but duplicate `--` are not allowed).

Example for passing command line arguments:
https://godbolt.org/z/eqfa3T7WY
Example for activating a library: https://godbolt.org/z/srh55Y1hY
2025-04-22 13:55:17 -05:00
Andy Soffer 45af54f180 Make the Bronto Refactor Tool available for C++ compilations (#7555)
"Bronto Refactor" is a tool that reads annotations in C++ source code
and generates edits based on those annotations. For CE specifically, it
outputs a copy of the primary file with the modifications applied.
Documentation can be found
[here](https://github.com/brontosource/bronto/blob/main/include/bronto/bronto.hpp)
and will also be made available at http://brontosource.dev in a nicer
format before this PR is merged.

I've attached a screenshot which hopefully conveys the idea.

One question I have is about how to actually deliver the tool. It is not
publicly available, but we do want folks to be able to play around with
it. We're happy to have you build it from source or we can deliver a
prebuilt binary, whatever is preferable.

This is my first time contributing here. I think I've got everything set
up appropriately (including sibling PR
https://github.com/compiler-explorer/infra/pull/1569 to the infra
repository) but please let me know if I'm missing anything.


<img width="1723" alt="BrontoRefactorToolScreenshot"
src="https://github.com/user-attachments/assets/cd605358-b7f2-49e8-9845-b6f3056fa4ef"
/>
2025-04-22 13:48:57 -05:00
Patrick Quist ad6b2e6731 Execution fixes (when using architectures that cant run) (#7588) 2025-04-22 19:31:09 +02:00
Matt Godbolt 20048616da Migrate to express 5 (#7572)
Main changes:
- type checker cares about the return value (`void`) of handlers, so no
more `return res.send("...")` as that returns `express` type.
- regexes on slugs no longer supported, but we weren't really using them
in any meaningful way. The two places that had to be updated:
- `/clientstate/:clientstate64` - now uses a regex directly and tests added (thanks @partouf for spotting #4844)
- `/bits/:bits.html` - was some `\w+` but I believe that's unnecessary
for the same reasons
- actually call the Sentry handler. I don't know if this actually worked
before but the API checks suggest not.
2025-04-19 14:34:41 -05:00
Matt Godbolt 6400235a18 Drop dependency on fs-extra (we removed it a while back) 2025-04-19 13:56:20 -05:00
Ofek 2d74bb24aa Fix #7573: Handle catchswitch, catchret and cleanupret LLVM-IR block terminators (#7574) 2025-04-18 06:39:16 +03:00
Tim HuttandMatt Godbolt d1d0883a86 Add support for the Sail language (#7304)
This adds support for the [Sail
language](https://github.com/rems-project/sail) - a DSL for defining
ISAs.

It's not quite ready but I need some help. These are the main remaining
issues:

1. When you "link to binary" it does disassemble the binary properly,
but the syntax highlighting and line numbers are broken.


![image](https://github.com/user-attachments/assets/2f4fe12c-49b4-4b26-9cb0-7e1666a7b3a2)

2. If you try to execute the code without a `function main() -> unit =
...` then it gives this error in the compiler output:

```
Internal Compiler Explorer error: Error: spawn /tmp/compiler-explorer-compiler2025025-31052-c8gern.pf8t/model.c EACCES
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Compiler returned: -1
```

This is weird - it should give a linker with an undefined reference to
`zmain`.

3. Sail compiles to C, and then I added extra steps to compile that to
binary (if you select `Execute the code`), but as you can see I had to
move the binary back over the C file, so in this case `model.c` is
actually an ELF file. It works but that seems very weird. There is a
`getExecutableFilename()` method I could override, but doing that seems
to make it even more confused.

4. I also had to have a fake flag for `binary` because the `filters`
don't seem to get set correctly when passed to `runCompiler()`. E.g.
`buildExecutable()` doesn't pass them at all. Not sure what is going on
there. Seems to work though.

Any help appreciated!

PS: Sail is a cool language. It has lightweight dependent type for
integers and bit vectors, which I haven't demonstrated in the examples
yet, but they're neat.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-04-17 17:22:18 -05:00
narpfelandMatt Godbolt 98c91227fa Fix go-to label with position-independent code (#7522)
Resolves #7521.

With this PR, `@...` suffixes are included in the clickable area for
go-to label.

This also affects PowerPC, where `@...` suffixes are a bit more common
(`@ha` and `@l` will also be marked as clickable).

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-04-17 12:25:28 -05:00
Adrien Bertrand 9e7808b13c Add (e)z80-clang compilers. (#7546)
These clang + LLVM backends are not upstreamed but [a community
effort](https://github.com/CE-Programming/llvm-project/), so it's a bit
customized.

This requires https://github.com/compiler-explorer/infra/pull/1566

_Edit: tested locally, works fine._
2025-04-14 15:17:39 -05:00
Ofek 36715c9369 Support opt remarks for rustc-nightly (#7561)
Closes #7525.
2025-04-12 11:29:38 +03:00
Partouf 949b80234b restore heaptrack pipe magic 2025-04-01 00:09:45 +02:00
Mats Jun Larsen 1e4f0cbb49 Revert noThisInStatic Biome rule for argument-parsers.ts (#7529) 2025-03-29 15:33:40 +01:00
Steve 948382018e .NET: Add multiple architectures support for NativeAOT (#7496)
Depends on https://github.com/compiler-explorer/dotnet-builder/pull/25
2025-03-27 13:52:41 -05:00
Jan 7634079704 use OSACA v0.7.0 as tool (#7519)
Updated OSACA to version 0.7.0 that finally includes support for Intel
syntax assembly.
Therefore, I increased the version numbers in the `*.amazon.properties`
files and removed the check and error message for Intel syntax in
`osaca-tool.ts`.
Successfully tested with `make check` and manually with a local instance
2025-03-27 12:59:10 -05:00
Matt Godbolt 90aee8f04d Implement a no-op parser for handling rust 2025-03-27 12:15:39 -05:00
Patrick Quist 1956067efe Dont change original library versioninfo object (#7517) 2025-03-27 11:49:49 -05:00
Nicole LeGare 73196b9441 Turns out getOutputFilename was necessary 2025-03-18 13:46:24 -07:00
Nicole LeGare d0c91b07f8 Remove unnecessary function overrides 2025-03-18 13:46:24 -07:00
Nicole LeGare e74adc5c28 Remove unnecessary comment 2025-03-18 13:46:24 -07:00
Nicole LeGare 800a015c49 Invoke main c2rust binary instead of c2rust-transpile
This gives us the correct version string, rather than getting the version for just the c2rust-transpile binary.
2025-03-18 13:46:24 -07:00
Nicole LeGare 8f56587bae Add support for c2rust as a C compiler 2025-03-18 13:46:24 -07:00
kevinjeon-g 3ea4baa363 Correctly handle missing .dex file for R8 (#7498)
R8 will not produce a .dex file if there are no entry points into the
.class file code. This change updates R8/D8 so that a missing .dex file
returns a message to the user in the compiler output window, instead of
logging a warning/error.
2025-03-15 00:31:18 +00:00
Partouf 4a38793943 redirect output of clippy 2025-03-14 17:32:53 +01:00
Partouf 61715be49a fix rust clippy tool 2025-03-14 16:59:27 +01:00
narpfel 6a793ecce0 [rust] don’t use a separate tempdir for clippy (#7497) 2025-03-13 18:37:27 +01:00
narpfel 95979128ac Add clippy for Rust (#7477) 2025-03-12 22:45:15 +01:00
Joshua BattyandMatt Godbolt 8c6ce602d1 Add support for pre-installed Sway std library (#7456)
This PR updates the Sway compiler to use pre-installed std libraries
rather than fetching from GitHub. It:

Dynamically adds the std library path to `Forc.toml` when using
versioned compilers
Sets the `--offline` flag at the group level to prevent network access
Works with the std library package added in compiler-explorer/infra#1539

This resolves the issue where Sway was attempting to fetch libraries
from the internet, which is blocked in the Compiler Explorer
environment. see [this
comment](https://github.com/compiler-explorer/compiler-explorer/pull/7409#issuecomment-2679284531)

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-03-10 12:58:07 -05:00
Marc Auberer bae3b714ee [Spice] Short cli flag -obj was removed (#7467)
The short flag `-obj` was removed from the compiler cli.
The long version (`--dump-object-file`) was already available before and
thus also works for older compiler versions.
2025-02-28 23:48:04 +01:00
Matt Godbolt a66cf13ff5 Improvements to r8/d8 dex stuff (#7460)
- better handling of missing files (doesn't crash)
- better error reporting.
2025-02-26 14:09:24 -06:00
Matt Godbolt 9a3661416a Don't cleanup build dirs until after processAsm (#7459)
- `d8` and `r8`'s `processAsm` looks in the build output folder for
`.smali` and `.cfg` files.
- it used to do this _synchronously_ and so worked (maybe accidentally)
- changes recently made that async, and so some of the time the files
would be cleaned up before it read them (or even during...)
2025-02-26 14:03:43 -06:00
Matt Godbolt a4995a9c1c Move to using async file reads (#7433)
Remove most, if not all, of the synchronous file reads. Hopefully this
will help a little with performance and "event loop lag". Mostly, it's
"try not to use third party packages when builtins now do the work".

Local testing seems OK - but needs a good poke around on staging to
exercise all the paths.
2025-02-26 11:11:12 -06:00