New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 599925 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

clang-format behavior differs between chroot and vanilla linux version

Project Member Reported by za...@chromium.org, Apr 1 2016

Issue description

I'm noticing some discrepancies between the output of clang-format inside the Chromium OS chroot versus the vanilla clang-format.

Take a look at
https://chromium-review.googlesource.com/#/c/336320/2/bsdrm/src/drm_pipe.c@199. That was the output of the following clang-format run:

~/trunk/src/platform/drm-tests/bsdrm $ clang-format -style=file -i src/*.c include/*.h

The "else" token should be on the same line as the surrounding closing and opening braces. .clang-format in ~/trunk/src/platform/drm-tests has "BreakBeforeBraces: Linux" which dictates that behavior. clang-format does the correct thing on goobuntu and on a vanilla arch install.

The clang-format version inside of my chroot is: clang-format version 3.8.0 (/var/cache/chromeos-cache/distfiles/host/egit-src/clang.git 4483c0162c2672fc09fb738e9c683ebde1f146f3) (/var/cache/chromeos-cache/distfiles/host/egit-src/llvm.git fad81ab170b3d422f0aaa15b88157fdb16d3e75d). On my goobuntu machine: clang-format version google3-trunk (trunk r265040). On the arch install: clang-format version 3.7.1 (tags/RELEASE_371/final).
 
Cc: yunlian@chromium.org
Owner: yunlian@chromium.org
the CrOS one is really just trunk r255169
Without the .clang-format file, the clang-format inside chroot works fine. So why not modify the .clang-format file to remove that line?

Comment 3 by za...@chromium.org, Apr 5 2016

The intention of that line is to actually have the brace style called "Linux". Outside the chroot, with the exact same .clang-format style, we get the proper "} else {" on the same line, but inside the chroot, we get } else\n{". Regardless of how we change the .clang-format inside drm-tests, this is unexpected behavior.
Yes, found an upstream patch for it. And we will include it for next clang roll.

commit d86f4ca5e4d5460232d70bb1b80c86cde54bb0bd
Author: Daniel Jasper <djasper@google.com>
Date:   Mon Dec 14 08:24:16 2015 +0000

    clang-format: Fix style default for WebKit and Linux styles.

Status: Fixed (was: Untriaged)
This should be fixed.
Status: Verified (was: Fixed)

Sign in to add a comment