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

CI: Enable all warnings on all compilers and turn them into errors #33

Closed
certik opened this issue Oct 10, 2019 · 5 comments
Closed

CI: Enable all warnings on all compilers and turn them into errors #33

certik opened this issue Oct 10, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@certik
Copy link
Collaborator

certik commented Oct 10, 2019

That way the CI will fail if any compiler issues a warning, so that we can catch any regressions.

@certik
Copy link
Collaborator Author

certik commented Feb 12, 2021

But keep them as just warnings when not in the CI, that way users will not get errors if they upgrade a compiler that introduces some new warnings.

@MCWertGaming
Copy link
Collaborator

I have checked on that:
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Option-Summary.html
There are many warnings available. We would have to test them with both clang and gcc on at least windows and linux. I would suggest doing that after we moved the library into seperate files, because we can turn on the warnings and errors on the library tearget directly (wich improves the debugging a lot).
I would also suggest to add all flags, that disable non-c++ stuff, like gnu keywords and disable stuff like "weak functions".
The abbility to turn off the compile options could be done with the same cmake options, that can turn off the example program targets. That would be a good thing to include in the wiki later on (like a simple compile with cmake section. But I would prefer to make it optional and not recommended).
Also the sompile flags are only turned on on the specified targets. That means, that projects that depend on cpp-terminal don't use the extra flags at all (only if they are adding those themselves) but cpp-terminal gets compiled with those independently.

I'll create a list with all compile flags, I would suggest / recommend. We can decide then, what we use and what not. As I said, I would probably use all that are either regarding to C++ or x64/x86 architectures. (Are we even supporting x32? and / or other ones like arm64/aarch64/armV7 and so on?).

@MCWertGaming
Copy link
Collaborator

I havent looked for MSVC yet. Will do that probably after we implemented the flags for linux / gcc. We have to do both seperately anyway.

@MCWertGaming
Copy link
Collaborator

MCWertGaming commented Feb 13, 2021

I have looked into it. There are many warning that we shouldn't enable, like -Wdouble-promotions, because it warns of a problem that occurs on really old 32bit pcs. So I wouldn't go with -w (wich enables all warnings). I created a list and will will go into that later.

-fno-gnu-keywords
-Wabi-tag
-Wcomma-subscript
-Wctor-dtor-privacy
-Wall
-Wextra
-Wnoexcept
-Wnoexcept-type
-Wclass-memaccess
-Wregister
-Wredundant-tags
-Wstrict-null-sentinel
-Wold-style-cast
-Woverloaded-virtual
-Wsign-promo
-Wtemplates
-Wmismatched-tags
-Wmultiple-inheritance
-Wvirtual-inheritance
-Wvolatile
-Wzero-as-null-pointer-constant
-Wextra-semi
-Wsuggest-final-types
-Wuseless-cast
-Wnull-dereference
-fdelete-null-pointer-checks
-Wmissing-include-dirs
-Wswitch-default
-Wuninitialized
-Wunused-macros
-Wundef
-Winline
// limits max errors
-fmax-errors=30
// all warnings to errors
-Werror
// only allow ISO c++
-Wpedantic

Needs testing:

// may argue about standard headers
-Weffc++
// maybe too strict
-Wunused-const-variable=2
-Wswitch-enum
-Wcatch-value=3
-Waligned-new=all
-Wconditionally-supported
-Wsuggest-final-methods
-Wsuggest-override
-Wformat=2
-Wformat-overflow=2
-Wformat-nonliteral
-Wformat-security
-Wformat-signedness
-Wformat-truncation=2
-Wformat-y2k
-Wshift-overflow=2
-Wstrict-overflow=5
-Wshadow
-Wunsafe-loop-optimizations
// Warn about code affected by ABI changes and I don't understand what that is.
-Wabi

And some analysing (haven't used that yet, can't tell if it's to be used at compiletime or just for checking, like clang-tidy does):

-Wanalyzer-too-complex 
-fanalyzer 
-fanalyzer-call-summaries 
-fanalyzer 
-fanalyzer-call-summaries 
-fanalyzer-checker=name 
-fanalyzer-fine-grained 
-fanalyzer-state-merge 
-fanalyzer-state-purge 
-fanalyzer-transitivity 
-fanalyzer-verbose-edges 
-fanalyzer-verbose-state-changes 
-fdump-analyzer 
-fdump-analyzer-stderr 
-fdump-analyzer-callgraph 
-fdump-analyzer-exploded-graph
-fdump-analyzer-exploded-nodes-3 
-fdump-analyzer-state-purge 
-fdump-analyzer-supergraph 

Hope that works. I have not included warnings, that are turned on by -Wall and -Wextra. Also I have included no C related options.

@MCWertGaming MCWertGaming mentioned this issue Mar 16, 2021
42 tasks
@MCWertGaming MCWertGaming added the enhancement New feature or request label Dec 7, 2021
@MCWertGaming MCWertGaming added this to the V1.X.X milestone Dec 7, 2021
@MCWertGaming MCWertGaming mentioned this issue Aug 22, 2022
27 tasks
@MCWertGaming
Copy link
Collaborator

replaced by #182.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants