cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

Remove GCC warnings

Open jarzec opened this issue 3 years ago • 3 comments
trafficstars

Long story short: This PR removes all GCC warnings from cppfront.

The long story: I love C++. I've been coding C++ since high school when c++11 was still c++0x. As with any true love you learn to put up with the flaws of a loved one. Nevertheless, with a language that allows you to shoot yourself in the foot you need to figure out good foot protection. One that I believe is very simple to use and has already helped me fix bugs in existing code is to ask the compiler to show all warnings, disallow them, and be pedantic about this. When I recently saw the CppCon presentation of cppfront and I was somewhat ecstatic. Finally an attempt not to replace C++ but to just face-lift the syntax to make it modern while being faithful to the core of language itself. I had to give it a try. The first thing I did was compiling it using: g++-11 source/cppfront.cpp -I./include --std=c++20 -Wall -Werror --pedantic -o cppfront

jarzec avatar Nov 20 '22 23:11 jarzec

See #121 which also makes some of these changes.

gregmarr avatar Nov 21 '22 17:11 gregmarr

Oh, sorry, my bad. I will close this and try the otherone.

JarekGlobus avatar Nov 21 '22 17:11 JarekGlobus

I think it doesn't have all of them, and also has some others that you don't have, so some coordination may be required.

gregmarr avatar Nov 21 '22 17:11 gregmarr

@jarzec @JarekGlobus Thanks for the kind words! I'm glad you like the project.

Below I'll paste the same note I put in #121 which I also just closed now -- but please reopen a new issue/PR if you think I missed something! Thanks.


Hi, and thanks!

I just did a pass through the sources to compile cleanly under MSVC -W4, g++-10 -Wall, and clang++-12 -Wall. The commit is here: b9a0b2161bc207a6010ad02f20591da671a288c1

I think this should address all the issues in this PR, so I'll close it.

If there is anything else that commit didn't correct that you think I should look at, please open a new issue!

Note: I didn't do -Wextra for the reasons I mentioned in the commit note... they generated two or three -Wmissing-field-initializers per compiler, and for GCC also one -Wimplicit-fallthrough that was intentional (and commented as intentional) and on rereading still looked right. I see you mentioned -Wmissing-field-initializer examples above, but I don't think they are incorrect, right? IIUC the compiler is being pedantic, and the default ctor will still be correctly calls. If you think I'm making a mistake and there's an actual bug there please let me know in a new issue.

Again, thanks!

hsutter avatar Dec 13 '22 01:12 hsutter