audit gcc warnings (adding new ones which 'help' our project)
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
From external discussion in #3608 If this is deemed not a big deal, then we can simply close this issue.
To start with, I will make a build turning on ALL the listed warnings, and just give it a shot, lol).
I wonder why it's not enabled by -Wall or the like.
Not sure, but -Wall is anything but 'all' ;) From this page (not dox, but it does put things into 1 place)
https://stackoverflow.com/questions/2408038/what-does-wall-in-g-wall-test-cpp-o-test-do
See man gcc.
-Wall turns on these warnings:
-Waddress -Warray-bounds (only with -O2) -Wc++0x-compat -Wchar-subscripts
-Wenum-compare (in C/Objc; this is on by default in C++) -Wimplicit-int (C and
Objective-C only) -Wimplicit-function-declaration (C and Objective-C only)
-Wcomment -Wformat -Wmain (only for C/ObjC and unless -ffreestanding)
-Wmissing-braces -Wnonnull -Wparentheses -Wpointer-sign -Wreorder -Wreturn-type
-Wsequence-point -Wsign-compare (only in C++) -Wstrict-aliasing
-Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized -Wunknown-pragmas
-Wunused-function -Wunused-label -Wunused-value -Wunused-variable
-Wvolatile-register-var
-Wextra contains:
-Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers
-Wmissing-parameter-type (C only) -Wold-style-declaration (C only) -Woverride-init
-Wsign-compare -Wtype-limits -Wuninitialized -Wunused-parameter (only with -Wunused
or -Wall) -Wunused-but-set-parameter (only with -Wunused or -Wall)
There are many more warnings which you have to turn on explicitly.
-Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wdisabled-optimization -Wdiv-by-zero
-Wendif-labels -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit
-Wimport -Winit-self -Winline -Winvalid-pch -Wjump-misses-init -Wlogical-op -Werror=missing-braces
-Wmissing-declarations -Wno-missing-format-attribute -Wmissing-include-dirs -Wmultichar -Wpacked
-Wpointer-arith -Wreturn-type -Wsequence-point -Wsign-compare -Wstrict-aliasing -Wstrict-aliasing=2
-Wswitch -Wswitch-default -Werror=undef -Wno-unused -Wvariadic-macros -Wwrite-strings -Wc++-compat
-Werror=declaration-after-statement -Werror=implicit-function-declaration -Wmissing-prototypes
-Werror=nested-externs -Werror=old-style-definition -Werror=strict-prototypes
So even if we do turn on -Wpointer-arith (which we should) there are still dozens of 'potential' warnings we are not accounting for.
NOW, many of them are likely not part of -Wall, because they false alarm, or there is too much code written that triggers them, or some other reason. I know the addition of -Wpointer-arith to configure.ac is beyond the scope of this PR. Getting the void* += x out of our code IS the point. IF we want 'additional' warnings, then it merits it's own PR (for sure). There seem to be lots of them. Now, a lot of the warnings pretty much p1ss me off, because they point out shortcut code I have been doing for years, which 'is' rock solid. However, just as often, they do point out areas which ARE bug ridden, and should be reworked, to clarify things properly to the compiler.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the discussion in issue #3608 and the warning configuration in configure.ac. Review the listed GCC warnings, especially -Wpointer-arith, and identify which warnings and related code changes are actually in scope. Done means the agreed warnings are enabled without unresolved build warnings, including the noted void* += x cleanup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100