Diagnostic and Warning System for the Compiler
- Dominant language
- C#
- Stars
- 451
- Forks
- 49
- Avg merge
- 13h 59m
- Merged PRs (30d)
- 6
Description
### Summary
This issue created to handle proccess of implementing warnings. Previously, the compiler lacked a structured way to report non-fatal diagnostics, and this work establishes the architectural foundation for all future warning categories and reporting mechanisms.
### Specification
#### Command Line Interface (CLI)
The compiler must provide granular control over which diagnostics are emitted or silenced.
- Flag `-W`: Enables a specific set of warnings.
- Format: Kebab-case (e.g., `-Wunused-variable`, `-Wshadow`).
- Behavior: Can be specified multiple times to enable different WarningsSet groups.
- Flag `-w`: Global silent mode. Suppresses all warning output regardless of other flags.
- Flag `-Werror`: Promotes warnings to errors.
- `-Werror`: All enabled warnings become fatal.
- `-Werror=`: Only warnings within the specified group become fatal.
#### Warnings Sets
We aim for compatibility with standard GCC/Clang warning options where applicable.
Reference: GCC Warning Options (https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html)
### Goals & Tasks:
- [ ] CLI
- - [x] Implement `-W` option [#978]
- - [ ] Implement `-w` option
- - [ ] Implement `-Werror` and `-Werror=`
- [ ] Warning Groups Logic:
- - [x] Provide a basic mechanism to promote specific categories based on the compiler configuration. [#978]
- - [ ] Extend a basic mechanism to suppress particular warnings.
- - [ ] Treat warnings as errors: Handle `-Werror` with filters to produce error on all or particular warnings.
- [ ] Positional Info for Compiler Warnings: Research and implement a mechanism to provide meaningful location data (if applicable) for warnings generated during late-stage compilation/codegen. Provide a position to the CompilerWarning record.
Remark: For now the CompilerWarning record uses zero position. When we move on implemention positional info, we have to add `Position` field to this record.
Contributor guide
Assessment
This issue has not been assessed yet.