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

Issue 741084 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

clang-format quality problem: inconsistent formatting of availability attribute

Project Member Reported by p...@chromium.org, Jul 11 2017

Issue description

clang-format produced code that (choose all that apply): 
- Riles my finely honed stylistic dander

Here's the code before formatting:

@interface NSView (ElCapitanSDK)
- (void)setPressureConfiguration:(NSPressureConfiguration*)aConfiguration
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutXAxisAnchor* leftAnchor
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutXAxisAnchor* rightAnchor
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutYAxisAnchor* bottomAnchor
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutDimension* widthAnchor
    __attribute__((availability(macos, introduced = 10.11)));
@end


Here's the code after formatting:

@interface NSView (ElCapitanSDK)
- (void)setPressureConfiguration:(NSPressureConfiguration*)aConfiguration
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutXAxisAnchor* leftAnchor
    __attribute__((availability(macos, introduced=10.11)));
@property(readonly, strong) NSLayoutXAxisAnchor* rightAnchor
    __attribute__((availability(macos, introduced=10.11)));
@property(readonly, strong) NSLayoutYAxisAnchor* bottomAnchor
    __attribute__((availability(macos, introduced=10.11)));
@property(readonly, strong) NSLayoutDimension* widthAnchor
    __attribute__((availability(macos, introduced=10.11)));
@end

Here's how it ought to look:

@interface NSView (ElCapitanSDK)
- (void)setPressureConfiguration:(NSPressureConfiguration*)aConfiguration
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutXAxisAnchor* leftAnchor
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutXAxisAnchor* rightAnchor
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutYAxisAnchor* bottomAnchor
    __attribute__((availability(macos, introduced = 10.11)));
@property(readonly, strong) NSLayoutDimension* widthAnchor
    __attribute__((availability(macos, introduced = 10.11)));
@end

(or without spaces around the =, I don't really care)

Code review link for full files/context:

https://chromium-review.googlesource.com/c/564224/
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jul 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/23f11eae0f75b87c853ec1383a34d6469b89be9d

commit 23f11eae0f75b87c853ec1383a34d6469b89be9d
Author: Nico Weber <thakis@chromium.org>
Date: Thu Jul 13 23:39:41 2017

mac: Use spiffy API_AVAILABILE macro instead of raw __attribute__

This is the recommended way to use the new @available feature.
Also happens to work around clang-format not understanding
__attribute__.

Bug:  735328 ,741084
Change-Id: I3f518b23037d2cdd23a5e32c0fc3de1f865bedd0
Reviewed-on: https://chromium-review.googlesource.com/570007
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486539}
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/base/BUILD.gn
[add] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/base/mac/availability.h
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/base/mac/sdk_forward_declarations.h
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/chrome/browser/app_controller_mac.mm
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/chrome/browser/ui/cocoa/browser_window_touch_bar.mm
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/chrome/browser/ui/cocoa/tabs/tab_window_controller.h
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/chrome/utility/safe_browsing/mac/crdmg.cc
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/components/handoff/handoff_manager.h
[modify] https://crrev.com/23f11eae0f75b87c853ec1383a34d6469b89be9d/components/handoff/handoff_manager.mm

Components: Tools
Labels: clang-format
Labels: Pri-2
Issue has a component, but no priority. Updating to have default priority (Pri-2)

Sign in to add a comment