Open Bug 1338107 Opened 7 years ago Updated 1 year ago

[clang-format] ? operator incorrectly indented by two spaces

Categories

(Developer Infrastructure :: Lint and Formatting, defect)

defect

Tracking

(Not tracked)

People

(Reporter: jya, Unassigned)

References

(Blocks 1 open bug)

Details

Per Mozilla coding style:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Operators

operators are to be indented on the next line at the beginning (see bug 1338105)

This is also the case for the unary (?) operator.
"This applies to ?:"

As such it should be written as:
  LOGV("%d audio samples demuxed (sid:%d)",
       aSamples->mSamples.Length(),
       aSamples->mSamples[0]->mTrackInfo
       ? aSamples->mSamples[0]->mTrackInfo->GetID()
       : 0);

However, clang-format always indent by two characters the ? operator and it's written as:

  LOGV("%d audio samples demuxed (sid:%d)",
       aSamples->mSamples.Length(),
       aSamples->mSamples[0]->mTrackInfo
         ? aSamples->mSamples[0]->mTrackInfo->GetID()
         : 0);

which is incorrect.
Product: Core → Firefox Build System
Component: Source Code Analysis → Lint and Formatting
Product: Firefox Build System → Developer Infrastructure
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.