Skip to content

Diagnostic and Warning System for the Compiler #988

Description

@evgTSV

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<group>: 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=<group>: 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
    • Implement -w option
    • Implement -Werror and -Werror=<group>
  • Warning Groups Logic:
    • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions