Giter Site home page Giter Site logo

Comments (5)

certik avatar certik commented on June 4, 2024

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.

from cpp-terminal.

MCWertGaming avatar MCWertGaming commented on June 4, 2024

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?).

from cpp-terminal.

MCWertGaming avatar MCWertGaming commented on June 4, 2024

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.

from cpp-terminal.

MCWertGaming avatar MCWertGaming commented on June 4, 2024

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.

from cpp-terminal.

MCWertGaming avatar MCWertGaming commented on June 4, 2024

replaced by #182.

from cpp-terminal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.