supertux icon indicating copy to clipboard operation
supertux copied to clipboard

Big number of compiler warnings

Open HybridDog opened this issue 1 year ago • 4 comments

SuperTux Version

5a5057859

System Information

Arch Linux

Expected Behavior

When compiling SuperTux with -DWARNINGS=ON, there should be no warnings except those caused by myself if I change code. The CI should fail at Pull Requests if a warning appears, which is documented at INSTALL.md. I think this is broken.

Actual Behavior

If I compile SuperTux with -DWARNINGS=ON, it shows a lot of warning messages. Most of them are related to simplesquirrel. If I change source code, I want to see warnings to figure out if I have made an accidental mistake. The unrelated warnings make it difficult to find the relevant ones. Here's a small excerpt of the warnings:

[3/356] Building CXX object CMakeFiles/supertux2_lib.dir/src/badguy/captainsnowball.cpp.o
In file included from external/simplesquirrel/include/simplesquirrel/vm.hpp:3,
                 from src/squirrel/squirrel_environment.hpp:24,
                 from src/supertux/sector_base.hpp:22,
                 from src/supertux/sector.hpp:20,
                 from src/badguy/captainsnowball.cpp:20:
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning: 'class ssq::Exception' has pointer data members [-Weffc++]
   12 |     class Exception: public std::exception {
      |           ^~~~~~~~~
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning:   but does not declare 'ssq::Exception(const ssq::Exception&)' [-Weffc++]
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning:   or 'operator=(const ssq::Exception&)' [-Weffc++]
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:14:21: note: pointer member 'ssq::Exception::vm' declared here
   14 |         HSQUIRRELVM vm;
      |                     ^~
[4/356] Building CXX object CMakeFiles/supertux2_lib.dir/src/badguy/crystallo.cpp.o
In file included from external/simplesquirrel/include/simplesquirrel/vm.hpp:3,
                 from src/squirrel/squirrel_environment.hpp:24,
                 from src/supertux/sector_base.hpp:22,
                 from src/supertux/sector.hpp:20,
                 from src/badguy/crystallo.cpp:20:
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning: 'class ssq::Exception' has pointer data members [-Weffc++]
   12 |     class Exception: public std::exception {
      |           ^~~~~~~~~
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning:   but does not declare 'ssq::Exception(const ssq::Exception&)' [-Weffc++]
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning:   or 'operator=(const ssq::Exception&)' [-Weffc++]
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:14:21: note: pointer member 'ssq::Exception::vm' declared here
   14 |         HSQUIRRELVM vm;
      |                     ^~
[5/356] Building CXX object CMakeFiles/supertux2_lib.dir/src/badguy/corrupted_granito_big.cpp.o
In file included from external/simplesquirrel/include/simplesquirrel/vm.hpp:3,
                 from src/squirrel/squirrel_environment.hpp:24,
                 from src/supertux/sector_base.hpp:22,
                 from src/supertux/sector.hpp:20,
                 from src/object/sticky_object.hpp:23,
                 from src/object/shard.hpp:20,
                 from src/badguy/corrupted_granito_big.cpp:23:
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning: 'class ssq::Exception' has pointer data members [-Weffc++]
   12 |     class Exception: public std::exception {
      |           ^~~~~~~~~
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning:   but does not declare 'ssq::Exception(const ssq::Exception&)' [-Weffc++]
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:12:11: warning:   or 'operator=(const ssq::Exception&)' [-Weffc++]
external/simplesquirrel/include/simplesquirrel/exceptions.hpp:14:21: note: pointer member 'ssq::Exception::vm' declared here
   14 |         HSQUIRRELVM vm;
      |                     ^~

Steps To Reproduce Actual Behavior

Compile SuperTux, e.g. with

mkdir build && cd build
cmake .. -DWARNINGS=ON -DCMAKE_CXX_FLAGS="-pipe -march=native -Os -fdiagnostics-color=always" -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
chrt --idle 0 ionice -c idle ninja

Additional Information

No response

Guidelines For Reporting Issues

  • [X] I have read https://github.com/SuperTux/supertux/blob/master/CONTRIBUTING.md#bug-reports.
  • [X] I have verified this isn't an issue that's already been reported.
  • [X] I have verified this isn't a discussion, or an issue about a crash or a feature request, but rather an actual bug ─ that is, the game did something not intended.
  • [X] I have verified this issue is not about wrong translations (use Transifex for those), or anything unsupported (e.g. third-party add-ons).
  • [X] In this report, I have only included details about one (1) bug.
  • [X] If I make a mistake while submitting this report, I agree to use the "Edit" feature to correct it, instead of closing this issue and opening a new one.

HybridDog avatar Jul 30 '24 16:07 HybridDog