Skip to content

Add a pragma to suppress warnings #528

@jimbxb

Description

@jimbxb

Ideally, this suppression should be scoped. That is, a suppression should apply to a whole file, a module within that file, or even to a single proc. These pragmas should be extendable to support different classes of warnings, though my motivating example is for unused parameters.

pragma suppress(unused) # suppress "unused" warnings for the current file

module mod {
    pragma suppress(unused) # only in mod
}

def foo(unused_param:T) {
    pragma supress(unused) # only in foo
}

I'm not sure I like the pragma being inside foo, but I want to distinguish it from a file/module-level suppression. Perhaps we should warn if such a suppression is not the first "statement" in a module.

Implementation wise, I think we should still generate these warnings, and then only when we are printing warnings should we decide if a warning should or should not be suppressed. That would keep the concern of generating the warning separate from the suppression. Each warning should then be tagged with a "class" of warning, along with its module, to decide to suppress it or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesterror messagedetection and reporting of errors in Wybe code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions