Open Bug 1511879 Opened 7 years ago Updated 3 years ago

clang-format confused by macros that expand to nothing unless some #define is set

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: heycam, Unassigned)

Details

For example, this from the big clang-format commit (in nsComboboxControlFrame.h), where REFLOW_COUNTER_INIT() expands to nothing in regular builds, and so it thinks it should put the opening and closing braces of the constructor on the same line: @@ -223,57 +216,49 @@ static int32_t gReflowInx = -1; //------------------------------------------------------ nsComboboxControlFrame::nsComboboxControlFrame(ComputedStyle* aStyle) - : nsBlockFrame(aStyle, kClassID) - , mDisplayFrame(nullptr) - , mButtonFrame(nullptr) - , mDropdownFrame(nullptr) - , mListControlFrame(nullptr) - , mDisplayISize(0) - , mRecentSelectedIndex(NS_SKIP_NOTIFY_INDEX) - , mDisplayedIndex(-1) - , mLastDropDownBeforeScreenBCoord(nscoord_MIN) - , mLastDropDownAfterScreenBCoord(nscoord_MIN) - , mDroppedDown(false) - , mInRedisplayText(false) - , mDelayedShowDropDown(false) - , mIsOpenInParentProcess(false) -{ - REFLOW_COUNTER_INIT() -} - -//-------------------------------------------------------------- -nsComboboxControlFrame::~nsComboboxControlFrame() -{ + : nsBlockFrame(aStyle, kClassID), + mDisplayFrame(nullptr), + mButtonFrame(nullptr), + mDropdownFrame(nullptr), + mListControlFrame(nullptr), + mDisplayISize(0), + mRecentSelectedIndex(NS_SKIP_NOTIFY_INDEX), + mDisplayedIndex(-1), + mLastDropDownBeforeScreenBCoord(nscoord_MIN), + mLastDropDownAfterScreenBCoord(nscoord_MIN), + mDroppedDown(false), + mInRedisplayText(false), + mDelayedShowDropDown(false), + mIsOpenInParentProcess(false){REFLOW_COUNTER_INIT()} + + //-------------------------------------------------------------- + nsComboboxControlFrame::~nsComboboxControlFrame() { REFLOW_COUNTER_DUMP("nsCCF"); } //--------------------------------------------------------------
Not sure what happened with the comment and destructor indenting, but that might be a separate issue.
(Actually it probably is related, as I can't get the destructor to be left-aligned unless I remove the REFLOW_COUNTER_INIT().)
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.