Solidity: Be able to disable all warnings for certain files

Created on 1 Aug 2017  路  9Comments  路  Source: ethereum/solidity

When developing, we often include 3rd party contracts, which have been audited and deployed to mainnet, but don't play well with solc's latest warnings policy. Warnings for those files are annoying and useless.

For example if I develop dapp that facilitates ENS contracts and strings library, this is amount of warnings I get on single project compilation. All comes from AbstractENS.sol and strings.sol, which are verified and safe contracts. Makes other compiler output practically unreadable.

ens/AbstractENS.sol:7:37: Warning: This declaration shadows an existing declaration.
    function setOwner(bytes32 node, address owner);
                                    ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:8:59: Warning: This declaration shadows an existing declaration.
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner);
                                                          ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:9:40: Warning: This declaration shadows an existing declaration.
    function setResolver(bytes32 node, address resolver);
                                       ^--------------^
The shadowed declaration is here: ens/AbstractENS.sol:5:5:
    function resolver(bytes32 node) constant returns(address);
    ^--------------------------------------------------------^

ens/AbstractENS.sol:10:35: Warning: This declaration shadows an existing declaration.
    function setTTL(bytes32 node, uint64 ttl);
                                  ^--------^
The shadowed declaration is here: ens/AbstractENS.sol:6:5:
    function ttl(bytes32 node) constant returns(uint64);
    ^--------------------------------------------------^

ens/AbstractENS.sol:13:65: Warning: This declaration shadows an existing declaration.
    event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
                                                                ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:16:42: Warning: This declaration shadows an existing declaration.
    event Transfer(bytes32 indexed node, address owner);
                                         ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:19:45: Warning: This declaration shadows an existing declaration.
    event NewResolver(bytes32 indexed node, address resolver);
                                            ^--------------^
The shadowed declaration is here: ens/AbstractENS.sol:5:5:
    function resolver(bytes32 node) constant returns(address);
    ^--------------------------------------------------------^

ens/AbstractENS.sol:22:40: Warning: This declaration shadows an existing declaration.
    event NewTTL(bytes32 indexed node, uint64 ttl);
                                       ^--------^
The shadowed declaration is here: ens/AbstractENS.sol:6:5:
    function ttl(bytes32 node) constant returns(uint64);
    ^--------------------------------------------------^

ens/ENS.sol:57:37: Warning: This declaration shadows an existing declaration.
    function setOwner(bytes32 node, address owner) only_owner(node) {
                                    ^-----------^
The shadowed declaration is here: ens/ENS.sol:33:5:
    function owner(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:69:59: Warning: This declaration shadows an existing declaration.
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner) only_owner(node) {
                                                          ^-----------^
The shadowed declaration is here: ens/ENS.sol:33:5:
    function owner(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:80:40: Warning: This declaration shadows an existing declaration.
    function setResolver(bytes32 node, address resolver) only_owner(node) {
                                       ^--------------^
The shadowed declaration is here: ens/ENS.sol:40:5:
    function resolver(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:90:35: Warning: This declaration shadows an existing declaration.
    function setTTL(bytes32 node, uint64 ttl) only_owner(node) {
                                  ^--------^
The shadowed declaration is here: ens/ENS.sol:47:5:
    function ttl(bytes32 node) constant returns (uint64) {
    ^
Spanning multiple lines.

strings.sol:156:5: Warning: This declaration shadows an existing declaration.
    function len(slice self) internal returns (uint) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:160:14: Warning: This declaration shadows an existing declaration.
        for (uint len = 0; ptr < end; len++) {
             ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:250:9: Warning: This declaration shadows an existing declaration.
        uint len;
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:284:5: Warning: This declaration shadows an existing declaration.
    function nextRune(slice self) internal returns (slice ret) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:242:5:
    function nextRune(slice self, slice rune) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:299:9: Warning: This declaration shadows an existing declaration.
        uint len;
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:600:5: Warning: This declaration shadows an existing declaration.
    function split(slice self, slice needle) internal returns (slice token) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:577:5:
    function split(slice self, slice needle, slice token) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:636:5: Warning: This declaration shadows an existing declaration.
    function rsplit(slice self, slice needle) internal returns (slice token) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:614:5:
    function rsplit(slice self, slice needle, slice token) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:646:64: Warning: This declaration shadows an existing declaration.
    function count(slice self, slice needle) internal returns (uint count) {
                                                               ^--------^
The shadowed declaration is here: strings.sol:646:5:
    function count(slice self, slice needle) internal returns (uint count) {
    ^
Spanning multiple lines.

strings.sol:692:9: Warning: This declaration shadows an existing declaration.
        uint len = self._len * (parts.length - 1);
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:300:9: Warning: Variable is shadowed in inline assembly by an instruction of the same name
        uint div = 2 ** 248;
        ^------^
strings.sol:474:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(exit, eq(and(mload(ptr), mask), needledata))
                    ^---^
strings.sol:476:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(loop, lt(sub(ptr, 1), end))
                    ^---^
strings.sol:511:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(ret, eq(and(mload(ptr), mask), needledata))
                    ^---^
strings.sol:513:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(loop, gt(add(ptr, 1), selfptr))
                    ^---^
strings.sol:515:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jump(exit)
                    ^--^
ens/AbstractENS.sol:7:37: Warning: This declaration shadows an existing declaration.
    function setOwner(bytes32 node, address owner);
                                    ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:8:59: Warning: This declaration shadows an existing declaration.
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner);
                                                          ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:9:40: Warning: This declaration shadows an existing declaration.
    function setResolver(bytes32 node, address resolver);
                                       ^--------------^
The shadowed declaration is here: ens/AbstractENS.sol:5:5:
    function resolver(bytes32 node) constant returns(address);
    ^--------------------------------------------------------^

ens/AbstractENS.sol:10:35: Warning: This declaration shadows an existing declaration.
    function setTTL(bytes32 node, uint64 ttl);
                                  ^--------^
The shadowed declaration is here: ens/AbstractENS.sol:6:5:
    function ttl(bytes32 node) constant returns(uint64);
    ^--------------------------------------------------^

ens/AbstractENS.sol:13:65: Warning: This declaration shadows an existing declaration.
    event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
                                                                ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:16:42: Warning: This declaration shadows an existing declaration.
    event Transfer(bytes32 indexed node, address owner);
                                         ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:19:45: Warning: This declaration shadows an existing declaration.
    event NewResolver(bytes32 indexed node, address resolver);
                                            ^--------------^
The shadowed declaration is here: ens/AbstractENS.sol:5:5:
    function resolver(bytes32 node) constant returns(address);
    ^--------------------------------------------------------^

ens/AbstractENS.sol:22:40: Warning: This declaration shadows an existing declaration.
    event NewTTL(bytes32 indexed node, uint64 ttl);
                                       ^--------^
The shadowed declaration is here: ens/AbstractENS.sol:6:5:
    function ttl(bytes32 node) constant returns(uint64);
    ^--------------------------------------------------^

ens/ENS.sol:57:37: Warning: This declaration shadows an existing declaration.
    function setOwner(bytes32 node, address owner) only_owner(node) {
                                    ^-----------^
The shadowed declaration is here: ens/ENS.sol:33:5:
    function owner(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:69:59: Warning: This declaration shadows an existing declaration.
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner) only_owner(node) {
                                                          ^-----------^
The shadowed declaration is here: ens/ENS.sol:33:5:
    function owner(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:80:40: Warning: This declaration shadows an existing declaration.
    function setResolver(bytes32 node, address resolver) only_owner(node) {
                                       ^--------------^
The shadowed declaration is here: ens/ENS.sol:40:5:
    function resolver(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:90:35: Warning: This declaration shadows an existing declaration.
    function setTTL(bytes32 node, uint64 ttl) only_owner(node) {
                                  ^--------^
The shadowed declaration is here: ens/ENS.sol:47:5:
    function ttl(bytes32 node) constant returns (uint64) {
    ^
Spanning multiple lines.

strings.sol:156:5: Warning: This declaration shadows an existing declaration.
    function len(slice self) internal returns (uint) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:160:14: Warning: This declaration shadows an existing declaration.
        for (uint len = 0; ptr < end; len++) {
             ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:250:9: Warning: This declaration shadows an existing declaration.
        uint len;
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:284:5: Warning: This declaration shadows an existing declaration.
    function nextRune(slice self) internal returns (slice ret) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:242:5:
    function nextRune(slice self, slice rune) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:299:9: Warning: This declaration shadows an existing declaration.
        uint len;
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:600:5: Warning: This declaration shadows an existing declaration.
    function split(slice self, slice needle) internal returns (slice token) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:577:5:
    function split(slice self, slice needle, slice token) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:636:5: Warning: This declaration shadows an existing declaration.
    function rsplit(slice self, slice needle) internal returns (slice token) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:614:5:
    function rsplit(slice self, slice needle, slice token) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:646:64: Warning: This declaration shadows an existing declaration.
    function count(slice self, slice needle) internal returns (uint count) {
                                                               ^--------^
The shadowed declaration is here: strings.sol:646:5:
    function count(slice self, slice needle) internal returns (uint count) {
    ^
Spanning multiple lines.

strings.sol:692:9: Warning: This declaration shadows an existing declaration.
        uint len = self._len * (parts.length - 1);
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:300:9: Warning: Variable is shadowed in inline assembly by an instruction of the same name
        uint div = 2 ** 248;
        ^------^
strings.sol:474:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(exit, eq(and(mload(ptr), mask), needledata))
                    ^---^
strings.sol:476:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(loop, lt(sub(ptr, 1), end))
                    ^---^
strings.sol:511:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(ret, eq(and(mload(ptr), mask), needledata))
                    ^---^
strings.sol:513:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(loop, gt(add(ptr, 1), selfptr))
                    ^---^
strings.sol:515:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jump(exit)
                    ^--^
strings.sol:156:5: Warning: This declaration shadows an existing declaration.
    function len(slice self) internal returns (uint) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:160:14: Warning: This declaration shadows an existing declaration.
        for (uint len = 0; ptr < end; len++) {
             ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:250:9: Warning: This declaration shadows an existing declaration.
        uint len;
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:284:5: Warning: This declaration shadows an existing declaration.
    function nextRune(slice self) internal returns (slice ret) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:242:5:
    function nextRune(slice self, slice rune) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:299:9: Warning: This declaration shadows an existing declaration.
        uint len;
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:600:5: Warning: This declaration shadows an existing declaration.
    function split(slice self, slice needle) internal returns (slice token) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:577:5:
    function split(slice self, slice needle, slice token) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:636:5: Warning: This declaration shadows an existing declaration.
    function rsplit(slice self, slice needle) internal returns (slice token) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:614:5:
    function rsplit(slice self, slice needle, slice token) internal returns (slice) {
    ^
Spanning multiple lines.

strings.sol:646:64: Warning: This declaration shadows an existing declaration.
    function count(slice self, slice needle) internal returns (uint count) {
                                                               ^--------^
The shadowed declaration is here: strings.sol:646:5:
    function count(slice self, slice needle) internal returns (uint count) {
    ^
Spanning multiple lines.

strings.sol:692:9: Warning: This declaration shadows an existing declaration.
        uint len = self._len * (parts.length - 1);
        ^------^
The shadowed declaration is here: strings.sol:81:5:
    function len(bytes32 self) internal returns (uint) {
    ^
Spanning multiple lines.

strings.sol:300:9: Warning: Variable is shadowed in inline assembly by an instruction of the same name
        uint div = 2 ** 248;
        ^------^
strings.sol:474:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(exit, eq(and(mload(ptr), mask), needledata))
                    ^---^
strings.sol:476:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(loop, lt(sub(ptr, 1), end))
                    ^---^
strings.sol:511:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(ret, eq(and(mload(ptr), mask), needledata))
                    ^---^
strings.sol:513:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(loop, gt(add(ptr, 1), selfptr))
                    ^---^
strings.sol:515:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jump(exit)
                    ^--^
ens/AbstractENS.sol:7:37: Warning: This declaration shadows an existing declaration.
    function setOwner(bytes32 node, address owner);
                                    ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:8:59: Warning: This declaration shadows an existing declaration.
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner);
                                                          ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:9:40: Warning: This declaration shadows an existing declaration.
    function setResolver(bytes32 node, address resolver);
                                       ^--------------^
The shadowed declaration is here: ens/AbstractENS.sol:5:5:
    function resolver(bytes32 node) constant returns(address);
    ^--------------------------------------------------------^

ens/AbstractENS.sol:10:35: Warning: This declaration shadows an existing declaration.
    function setTTL(bytes32 node, uint64 ttl);
                                  ^--------^
The shadowed declaration is here: ens/AbstractENS.sol:6:5:
    function ttl(bytes32 node) constant returns(uint64);
    ^--------------------------------------------------^

ens/AbstractENS.sol:13:65: Warning: This declaration shadows an existing declaration.
    event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
                                                                ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:16:42: Warning: This declaration shadows an existing declaration.
    event Transfer(bytes32 indexed node, address owner);
                                         ^-----------^
The shadowed declaration is here: ens/AbstractENS.sol:4:5:
    function owner(bytes32 node) constant returns(address);
    ^-----------------------------------------------------^

ens/AbstractENS.sol:19:45: Warning: This declaration shadows an existing declaration.
    event NewResolver(bytes32 indexed node, address resolver);
                                            ^--------------^
The shadowed declaration is here: ens/AbstractENS.sol:5:5:
    function resolver(bytes32 node) constant returns(address);
    ^--------------------------------------------------------^

ens/AbstractENS.sol:22:40: Warning: This declaration shadows an existing declaration.
    event NewTTL(bytes32 indexed node, uint64 ttl);
                                       ^--------^
The shadowed declaration is here: ens/AbstractENS.sol:6:5:
    function ttl(bytes32 node) constant returns(uint64);
    ^--------------------------------------------------^

ens/ENS.sol:57:37: Warning: This declaration shadows an existing declaration.
    function setOwner(bytes32 node, address owner) only_owner(node) {
                                    ^-----------^
The shadowed declaration is here: ens/ENS.sol:33:5:
    function owner(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:69:59: Warning: This declaration shadows an existing declaration.
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner) only_owner(node) {
                                                          ^-----------^
The shadowed declaration is here: ens/ENS.sol:33:5:
    function owner(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:80:40: Warning: This declaration shadows an existing declaration.
    function setResolver(bytes32 node, address resolver) only_owner(node) {
                                       ^--------------^
The shadowed declaration is here: ens/ENS.sol:40:5:
    function resolver(bytes32 node) constant returns (address) {
    ^
Spanning multiple lines.

ens/ENS.sol:90:35: Warning: This declaration shadows an existing declaration.
    function setTTL(bytes32 node, uint64 ttl) only_owner(node) {
                                  ^--------^
The shadowed declaration is here: ens/ENS.sol:47:5:
    function ttl(bytes32 node) constant returns (uint64) {
    ^

solc 0.4.14+commit.c2215d46.Darwin.appleclang

Thanks

feature

Most helpful comment

I am a strong advocate of providing a mechanism for ignoring warnings. I personally prefer per line warnings like in #2691 but warnings do need a way of being ignored. The reasoning for this is because if you don't give people a way to ignore specific warnings, they will end up ignoring _all_ warnings just to silence a few. We want to encourage people to treat warnings as errors for the purpose of CI and release, but we can only do that if we give them a way to ignore specific warnings when it is appropriate. In a large project with thousands of lines of code, there is likely one or two places where the warning should be suppressed. If the only option to the user is to ignore all warnings in CI in order to get a build pushed through, then we have just created a vector for introducing bugs in a project that otherwise would have followed a good procedure for minimizing risk.

All 9 comments

I understand that this is quite annoying. On the other hand, I guess we owe it to our users to constantly improve all code, including library code.

Can you think of some kind of "middle ground" between these two extremes?

Without having reviewed everything, the warnings about using jumps may be actually cover bugs:

strings.sol:474:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(exit, eq(and(mload(ptr), mask), needledata))
                    ^---^
strings.sol:476:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(loop, lt(sub(ptr, 1), end))
                    ^---^
strings.sol:511:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(ret, eq(and(mload(ptr), mask), needledata))
                    ^---^
strings.sol:513:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jumpi(loop, gt(add(ptr, 1), selfptr))
                    ^---^
strings.sol:515:21: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch" or "for" statements instead.
                    jump(exit)
                    ^--^

This shouldn't be a warning though:

strings.sol:636:5: Warning: This declaration shadows an existing declaration.
    function rsplit(slice self, slice needle) internal returns (slice token) {
    ^
Spanning multiple lines.
The shadowed declaration is here: strings.sol:614:5:
    function rsplit(slice self, slice needle, slice token) internal returns (slice) {
    ^
Spanning multiple lines.

I think compiler and linter shouldn't be one thing without option to run each one separately. Turning off linter for 3rd party libraries is not extreme option. We don't run it on node_modules files, when we develop JS project, do we?

On the other hand, I guess we owe it to our users to constantly improve all code, including library code.

It's pretty naive to think people will happily start to make changes to 3rd party code when compiler makes them feel annoyed. They'll just use grep to filter out useless warnings. I wouldn't touch 3rd party code that's been audited and deployed on mainnet even if compiler warnings want me to.

@Madvas doesn't that defeat the purpose of a Dapp and ethereum in general? Or am I confused about the point of a decentralized application framework? I know RNGs can be hard to make securely in the ethereum environment and someone has done it -- but do you really want to deploy a roll-your-own version or a even copy of that RNG contract to the mainnet along side whatever contracts you've built that need it and maintain it? Aside from inundating the blockchain with repeated or similarly purposed contracts and code, you'll end up making your applications' code base fatter than it needs to be. I thought programmers were supposed to be reducing and reusing repeated code. Or am I thoroughly misinformed? My apologies if I'm out of bounds or off topic.

Function overloads wrongly considered as shadowing is tracked in #2676.

I am a strong advocate of providing a mechanism for ignoring warnings. I personally prefer per line warnings like in #2691 but warnings do need a way of being ignored. The reasoning for this is because if you don't give people a way to ignore specific warnings, they will end up ignoring _all_ warnings just to silence a few. We want to encourage people to treat warnings as errors for the purpose of CI and release, but we can only do that if we give them a way to ignore specific warnings when it is appropriate. In a large project with thousands of lines of code, there is likely one or two places where the warning should be suppressed. If the only option to the user is to ignore all warnings in CI in order to get a build pushed through, then we have just created a vector for introducing bugs in a project that otherwise would have followed a good procedure for minimizing risk.

One option could be to take .soliumignore into account

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leviadam picture leviadam  路  4Comments

hiqua picture hiqua  路  4Comments

walter-weinmann picture walter-weinmann  路  4Comments

VoR0220 picture VoR0220  路  4Comments

AnthonyAkentiev picture AnthonyAkentiev  路  3Comments