-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
enhancementNew feature or requestNew feature or requesterror-messagesRelated to improving error messagesRelated to improving error messagesezcEZC compiler tool (EZ → C → native binary)EZC compiler tool (EZ → C → native binary)
Description
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
- Requires type checker (EZC: Type checker implementation #1175) for most warnings
- W3001 (unreachable code) and W3003 (empty block) can be done without type checker
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesterror-messagesRelated to improving error messagesRelated to improving error messagesezcEZC compiler tool (EZ → C → native binary)EZC compiler tool (EZ → C → native binary)