Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big number of compiler warnings #3029

Open
6 tasks done
HybridDog opened this issue Jul 30, 2024 · 4 comments
Open
6 tasks done

Big number of compiler warnings #3029

HybridDog opened this issue Jul 30, 2024 · 4 comments
Labels

Comments

@HybridDog
Copy link
Contributor

SuperTux Version

5a50578

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

  • I have read https://github.com/SuperTux/supertux/blob/master/CONTRIBUTING.md#bug-reports.
  • I have verified this isn't an issue that's already been reported.
  • 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.
  • I have verified this issue is not about wrong translations (use Transifex for those), or anything unsupported (e.g. third-party add-ons).
  • In this report, I have only included details about one (1) bug.
  • 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.
@tobbi
Copy link
Member

tobbi commented Aug 9, 2024

I'm assuming you're compiling with gcc, right?

I don't get those warnings on clang. Guess we need to unify the warning flags.

@bruhmoent
Copy link
Member

Happens in Visual Studio too.

@tobbi
Copy link
Member

tobbi commented Aug 9, 2024

@HybridDog Can you check out my changes from #3029, please?

@HybridDog
Copy link
Contributor Author

I use gcc version 14.1.1 20240720 (GCC).
With the changes from #3042, it still shows a big number of -Weffc++ warnings about class ssq::Exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants