[tor-bugs] #19180 [Core Tor/Tor]: Add new compiler warnings

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu May 26 14:30:50 UTC 2016


#19180: Add new compiler warnings
------------------------------+--------------------------
     Reporter:  nickm         |      Owner:  nickm
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.2.???
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  029-proposed
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------
 While doing #19044 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
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/19180>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list