I'm writing unit tests for some contracts and in some of the tests I'm generating a warning on purpose and solc will display this warning when compiling.

Is there a way to disable warnings in solc for the purpose of a test.

Something equivalent to MSVC++

#pragma warning(push)
#pragma warning(disable : 44444)
#pragma warning(pop)
  • I think you can select update version pragma compiler..remove constant and put view.0.4.18 Jan 11, 2018 at 11:18
  • Solc, from my knowledge, only compiles the code. It does not deal with address checksum. Jan 12, 2018 at 3:41
  • It just seems like the address provided is not matching the checksum. The error tells you everything Jan 12, 2018 at 5:10
  • address constant a = "0x0123456789abcDEF0123456789abCDef01234568"; try this.. Jan 17, 2018 at 6:10
  • 2
    According to the solc's command-line help - no. Maybe you can "suppress" it by replacing the address with a uint256, and then replacing every other occurrence of a with address(a). Jan 17, 2018 at 15:52

2 Answers 2


As of 24/05/2018, there is no way to natively disable the warnings the solc compiler emits. There is, however, a way to bypass those warnings by creating a wrapper.

Simply create a Node.JS application that internally uses the solcjs plugin, which is a port of solc into Node, to compile your local .sol smart contracts and filter the output of the plugin.

This is, indeed, a very unorthodox approach and muting warnings should generally be avoided.

  • It is a unit test, it fails and I detect that situation and report as such. I'd want to disable it only for that case for cosmetic reasons. I never reported it because I think it is a bad feature for most users.
    – Ismael
    May 24, 2018 at 18:57

You could also use solidity-cli which disables the warnings by default.

  • 2
    I want to disable a single warning, not all warnings.
    – Ismael
    May 24, 2018 at 18:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.