Skip to content

Allow comments to ignore compiler warnings. #2691

Closed
@MicahZoltu

Description

@MicahZoltu

I would like the ability to disable compiler warnings on a per-line basis using something like comments or pragma. C++ has a mechanism to also disable comments across a block using #pragma push (disable: 1234) and #pragma pop. I'll leave it up to the language designers to decide the exact mechanism based on which one is most reasonable to implement. The key is that I need to be able to disable any single specific warning in the source code that is generating that warning.

With solc becoming more and more opinionated with its compiler warnings, there needs to be a way to disable them selectively. At the moment, we use solc compiler warnings/errors as a CI gate block but we are finding that some of the warnings should be ignored, yet we don't have a reasonable way to do this right now.

For example, we have a SafeMath library that leverages using SafeMath for <type>. This library does function overloading/shadowing so that it can have both add(uint256,uint256) and add(int256,int256) in the same library. I appreciate the warning, but I need the ability to disable it on a case-by-case basis. The same goes for a number of other warnings that have been added recently. In general I think are all very valuable, but may not be able to be applied exhaustively to all code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions