Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Tor Tor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 824
    • Issues 824
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 34
    • Merge requests 34
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • The Tor Project
  • Core
  • TorTor
  • Issues
  • #19180
Closed
Open
Created May 26, 2016 by Nick Mathewson@nickm🏃Owner

Add new compiler warnings

While doing legacy/trac#19044 (moved) I tried to sort all the GCC warnings to see if we missed any that we could add. I came up with a list that we could add without triggering any new warnings (for me), and a list of ones tthat maybe looked good, but which do trigger today. I'm thinking that we can add these with little to no trouble:

  -Wunused-but-set-parameter -Wunused -Wuninitialized -Wstrict-aliasing=5
  -Wswitch-bool -Wtrampolines -Wunused-but-set-variable -Wvariadic-macros
  -Wsync-nand -Wdate-time -Wsizeof-array-argument
  -Wunused-parameter -Wunused-local-typedefs 
  -Wshift-count-negative -Wshift-count-overflow
  -Wc99-c11-compat -Wcast-align -Wpacked
  -Wmissing-format-attribute -Wsuggest-attribute=noreturn -Wsuggest-attribute=format

And we can add these GCC-6 only options with little to no trouble:

  -Wshift-negative-value -Wshift-overflow=2 -Wignored-attributes

These warnings look useful but they trigger on our current code. Is it worth fixing these warnings?

 -Wconversion
 -Wsign-conversion
 -Wunsafe-loop-optimizations
 -Waggregate-return // one place only, I believe.
 -Wdouble-promotion // Pretty easy to fix.
 -Wunsuffixed-float-constants // We have these all over.
 -Wcast-qual
 -Wstrict-overflow=n
 -Wstrict-overflow
 -Wpadded
 -Wjump-misses-init // lots of these; are any bugs?
 -Wswitch-default
 -Wsuggest-attribute=pure
 -Wsuggest-attribute=const
 -Wfloat-conversion   // just a dozen or so.
 -Woverlength-strings // only in tests

And these gcc6-only warnings trigger on our current code:

   -Wnull-dereference
   -Wunused-const-variable
   -Wduplicated-cond
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking