Fix a number of compiler warnings found by turning on -Werror.

#321 Merged at 96c80bb
  1. Nathan Goldbaum

This fixes a number of warning messages generated when I compile Enzo with -Werror. A lot of these are innocuous and have to do with ambiguous control flow when using if/else blocks without braces, but a decent fraction look to me like real bugs. Hopefully this will also be useful to others who want to detect bugs using -Werror in new code but don't want to wade through the large number of existing compiler warnings in Enzo.

For the record, I'm using the following compiler flags:

-Werror -Wno-c++11-compat-deprecated-writable-strings -Wno-format -Wno-deprecated-declarations -Wno-implicit-function-declaration -Wno-undefined-inline

I whitelisted some warnings because they would generate a large number of innocuous false positives or because I don't understand how to fix the issues indicated by the warnings.

Comments (11)

  1. John Wise

    @ngoldbaum This is all great! Thanks for going through the entire code and fixing these things. I looked through all of your changes, and there were indeed some actual bugs that were caught with these warning flags.

    Once it passes the test suite, I will approve.

  2. Brian OShea

    Thanks, @ngoldbaum . I'm traveling right now, but will run the test suite by Thurs. morning. Sorry for the delay!

    1. Brian OShea

      Hi @ngoldbaum - a quick followup on this. When I run the test suite, more than half of the tests fail:

      FAILED (errors=21)
      Testing complete.
      Sims not finishing: 0
      Number of errors: 964
      Number of failures: 0
      Number of successes: 891

      These are not simple differences in values - many of the tests are failing outright. Did you run the test suite prior to issuing the PR? And, if so, did you see anything like this? The errors I'm seeing are:

        1. Nathan Goldbaum author

          @bwoshea it's hard to tell from the log you linked to - can you tell me the names of a few tests that are failing?

        1. Brian OShea

          @ngoldbaum : that fix worked - the tests all pass. I also looked through the changes, and everything makes sense to me. Nice job with this one!