GeneralPurpose-CompilerWarnings

Fix all compiler warnings and errors

Required inputs: IR

Compiler warnings indicate problems with the source code and should thus be taken seriously.
Bad code:
int f() {
    int x; // WARNING: variable "x" was declared but never referenced
    int y;
    return y; // WARNING: variable "y" is used before its value is set
}
Good code:
int f() {
    int x;
    (void)x; // OK: Discarded value expression uses variable "x"
    int y = 0; // OK: Initialize variable "y" before use
    return y;
}

Possible Messages

Key

Text

Severity

Disabled

cafe_message

{}

None

False

Options

message_predicate

message_predicate : typing.Callable[[Cafe_Message], bool] | None = None

If provided, a custom predicate to filter relevant messages. Receives the message node and should return True for messages to report.
 

reported_messages

reported_messages : set[int] | None = None

If provided, only messages of these types are reported.
 

reported_severities

reported_severities : set[str] = {'error', 'warning'}

List of severities to display.
 

show_error_number

show_error_number : bool = False

Whether to show the error number in the message text if use_error_number is false.
 

suppressed_messages

suppressed_messages : set[int] | None = None

Exclude specific messages from large sets of reported messages.
 

use_error_number

use_error_number : bool = True

Whether the error number from the frontend should be used.
 

use_rule_severity

use_rule_severity : bool = False

Whether the rule's severity or the compiler's severity should be used.