Closed Bug 1235717 (Wunreachable-code) Opened 4 years ago Closed 4 years ago

Enable clang's -Wunreachable-code warnings

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox46 fixed)

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

mozilla-central is (almost! :) free of the following clang -Wunreachable-code warnings:

  -Wunreachable-code
  -Wunreachable-code-loop-increment
  -Wunreachable-code-return

Unfortunately, there are still hundreds of -Wunreachable-code-break warnings in the IDL bindings' generated code. clang's meta warning flag -Wunreachable-code-aggressive enables all of the above warnings.

  https://github.com/llvm-mirror/clang/blob/73e51e88d5ed202c6c828d88371f2d694fd9826a/include/clang/Basic/DiagnosticGroups.td#L516

gcc removed support for its -Wunreachable-code warning flag back in 2010 (gcc 4.5) because it produced different results for different -O optimization levels:

  https://gcc.gnu.org/ml/gcc-help/2011-05/msg00362.html

MSVC has an optional warning for unreachable code (C4702), but it is impractical because there are unreachable code warnings in VS2013's own standard library header files.

  https://msdn.microsoft.com/en-us/library/c26da40e.aspx

Here is a green Try build with -Wunreachable-code enabled:

  https://treeherder.mozilla.org/#/jobs?repo=try&revision=7892fcd8ca78
Attachment #8702794 - Flags: review?(mh+mozilla)
Attachment #8702794 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/c35d01078dad
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Depends on: 1237352
No longer blocks: 1242847
Depends on: 1242847
Depends on: 1247535
Depends on: 1247536
Alias: Wunreachable-code
Depends on: 1251891
Depends on: 1258175
Depends on: 1301001
Depends on: 1291397
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.