New issue
Advanced search Search tips

Issue 646674 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Apr 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

-Wunguarded-availability suggests using @available, which doesn't exist yet

Project Member Reported by sdy@chromium.org, Sep 14 2016

Issue description

When I use a declaration that's marked @available(…) as of a newer SDK than the deployment target, I get a diagnostic like this:

    app_controller_mac.mm:414:14: error: 'setAllowsAutomaticWindowTabbing:' is only available on macOS 10_12 or newer [-Werror,-Wunguarded-availability]
    [snip]
    app_controller_mac.mm:414:14: note: enclose 'setAllowsAutomaticWindowTabbing:' in an @available check to silence this warning
        NSWindow.allowsAutomaticWindowTabbing = NO;
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

But if I try to use @available, I get another diagnostic that suggests it isn't implemented:

    ../../chrome/browser/app_controller_mac.mm:412:7: error: cannot compile this scalar expression yet
      if (@available(macos 10.12, *))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~

It looks like this first phase of @available was added here:
https://reviews.llvm.org/D23003?id=67713
 

Comment 1 by thakis@chromium.org, Oct 26 2016

If anyone finds this by googling: The workaround for now is to redeclare the functions you want to use locally in your file, then the warning will go away.

Here are many examples: https://cs.chromium.org/chromium/src/base/mac/sdk_forward_declarations.h?q=sdk_for&sq=package:chromium&l=5 (The redeclaration doesn't have to go into that file, it can just be local to your .mm file)

Don't forget to check that the function really exists before calling it though.

Comment 2 by sdy@chromium.org, Apr 25 2018

Status: WontFix (was: Assigned)
I'm going to wontfix this because @available exists now :O.

Sign in to add a comment