Suppressing warnings should be easy to do on a file / func / statement.
In IntelliJ, annotations are used to suppress warnings on file / class / method level, but can be suppressed by statement with a comment as well, in this manner:
// noinspection unchecked
Map<String, List<String>> nameMap = (Map)result.get("names");
For Xcode / Clang, it's much more complicated. You push the current state with a pragma, disable a warning and then have to pop it later. Very ugly:
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnusedValue"
lSeek += file_info.size_file_comment - uSizeRead;
#pragma clang diagnostic pop
I'd like for C2 to have a very easy way to suppress warnings in the manner of IntelliJ's comments.
Something like this:
// A.
lSeek += file_info.size_file_comment - uSizeRead; // $ignoreunused$
// B.
lSeek /* $ignoreunused$ */ += file_info.size_file_comment - uSizeRead;
// C.
// $ignoreunused$
lSeek += file_info.size_file_comment - uSizeRead;
// D.
// {unchecked:warn_unused}
lSeek += file_info.size_file_comment - uSizeRead;
Other styles are possible as well. The same should go for other scopes:
// {unchecked:warn_unused}
func i32 foo() {
...
}
// {unchecked:warn_unused}
type Foo struct {
...
}
For file scope it should be slightly different to avoid parsing ambiguity.