diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-08-31 09:47:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-31 09:47:45 +0000 |
commit | ebb127f2aed32f21a37b31e8a5330defc6bfe5e7 (patch) | |
tree | 9b0e09403fd4d39353bcd87ac2ee1364d8720ac0 /gcc/rust/backend | |
parent | 45f80a2d86c3cb6210f00547eee3e9af59a62fdf (diff) | |
parent | 2a607410e5911638747c1f472d92c563115b410c (diff) | |
parent | fc82b68cc1ee2778f2bfc53c5de47e5b36ac8b7c (diff) | |
parent | 702bb4bb01b93bb7c0f070883baf547ffdbebd17 (diff) | |
download | gcc-ebb127f2aed32f21a37b31e8a5330defc6bfe5e7.zip gcc-ebb127f2aed32f21a37b31e8a5330defc6bfe5e7.tar.gz gcc-ebb127f2aed32f21a37b31e8a5330defc6bfe5e7.tar.bz2 |
Merge #1408 #1503 #1511
1408: Experiment: add optional error codes to diagnostics r=CohenArthur a=davidmalcolm
rustc has error codes to identify specific errors, with URLs documenting each error.
In GCC 13 I've extended GCC's diagnostic subsystem so that a diagnostic can be associated with zero or more `diagnostic_metadata::rule` instances, which have a textual description and a URL. I meant this for rules in coding standards and specifications, but it struck me that potentially gccrs could reuse the same error codes as rustc.
The following pull request implements an experimental form of this; I picked a single error at random: [E0054](https://doc.rust-lang.org/error-index.html#E0054).
With this patch, gccrs emits e.g.:
```
bad_as_bool_char.rs:8:19: error: invalid cast [u8] to [bool] [E0054]
8 | let nb = 0u8 as bool;
| ~ ^
```
where the trailing [E0054] is colorized, and, in a suitably capable terminal is a clickable URL to https://doc.rust-lang.org/error-index.html#E0054.
The error code is after the diagnostic message, whereas rustc puts it after the word "error". I could change that in gcc's diagnostic.cc, perhaps.
I'm not sure if this is a good idea (e.g. is it OK and maintainable to share error codes with rustc?), but thought it was worth sharing.
1503: Add overflow traps r=CohenArthur a=CohenArthur
Opening as a draft since the code is really ugly and some tests still fail. I am looking for feedback on the implementation and my approximative use of functions like `temporary_variable` which I feel I might be using the wrong way.
I'll open up an issue of what still needs to be done, namely:
- [x] Properly handle sub and mul operations
- [ ] Disable the check in `release` mode (`-frust-disable-overflow-checks`)
- [ ] Handle specific rust overflow attribute (needs checkup on the name)
I'll open up some PRs to clean up some parts of the backend as well.
1511: lint: Do not emit unused warnings for public items r=CohenArthur a=CohenArthur
This fixes the overzealous warnings on public items from the unused pass
Co-authored-by: David Malcolm <dmalcolm@redhat.com>
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>