Skip to content

EZC: Compiler warnings system #1176

@SchoolyB

Description

@SchoolyB

Compiler Warnings

Smart warnings that catch bugs before they happen. All warnings on by default, suppressible with `#suppress(Wxxx)`.

Checklist

Variable warnings

  • W2001: Unused variable — declared but never read
  • W2002: Unused parameter — function parameter never used
  • W2003: Shadowed variable — inner scope redefines outer variable name
  • W2004: Unused import — module imported but no function called from it

Control flow warnings

  • W3001: Unreachable code — statements after return/break/continue
  • W3002: Missing return — non-void function doesn't return on all code paths
  • W3003: Empty block — if/for/while with empty body
  • W3004: Constant condition — `if true {` or `as_long_as false {`

Type warnings

  • W4001: Implicit narrowing — assigning int to i8 without cast
  • W4002: Comparison always true/false — e.g. unsigned < 0
  • W4003: Division by zero — literal divisor is 0
  • W4004: Integer overflow — literal value exceeds type bounds

Suppress mechanism

  • Parse `#suppress(Wxxx)` on statements and declarations
  • File-level suppression with `#suppress(Wxxx)` at top of file
  • `--warn-error` flag to treat all warnings as errors

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesterror-messagesRelated to improving error messagesezcEZC compiler tool (EZ → C → native binary)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions