Closed Bug 1222666 Opened 5 years ago Closed 5 years ago

./mach clang-format does not indent 'case' label in switch


(Firefox Build System :: Source Code Analysis, defect)

Not set


(Not tracked)



(Reporter: TYLin, Unassigned)


(Blocks 1 open bug)


According to the coding style example in mdn [1], the 'case' label in 'switch' statement should be indented, but clang-format will put the 'case' label at the same level of 'switch'.

You are probably using a very old version of clang-format. Can you check what you have installed with `clang-format --version`?

If you are using a recent version, where is the incorrectly formatted switch block?
I use ./mach clang-format, which uses the clang-format under "~/.mozbuild/clang-format-3.5".

If I delete the clang-format under ~/.mozbuild, it will prompt the following message to install for me. BTW, I need to add "import urllib2" to "tools/" to avoid "global name 'urllib2' is not defined" exception.

./mach clang-format 
Download clang-format executables from (yN)? y
Downloading to /Users/tlin/.mozbuild/clang-format-3.5
Downloading to /Users/tlin/.mozbuild/clang-format-diff-3.5

If I use the clang-format install from brew, the case label is formatted correctly. 
$ clang-format -version
clang-format version 3.8.0 (tags/google/testing/2015-07-31)

Perhaps we should update installation code so that mach installs the upstream version of the clang-format  after bug 961541 is landed.
Closed: 5 years ago
Resolution: --- → WORKSFORME
Summary: clang-format does not indent 'case' label in switch → ./mach clang-format does not indent 'case' label in switch
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.