[llvm-bugs] [Bug 44968] New: "Use of '@import' in framework header" warning should take __has_feature(modules) into account

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 19 14:49:36 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44968

            Bug ID: 44968
           Summary: "Use of '@import' in framework header" warning should
                    take __has_feature(modules) into account
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Modules
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jrose at belkadan.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

I recently came across the following code:

#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif

For which Xcode 11.3.1 gives me the following warning

> Use of '@import' in framework header is discouraged, including this header requires -fmodules

defined in Clang here:

https://github.com/llvm/llvm-project/blob/24ad121582454e625bdad125c90d9ac0dae948c8/clang/include/clang/Basic/DiagnosticParseKinds.td#L280-L283

But the presence of the __has_feature check indicates that the framework author
has thought about this concern, and thus the warning shouldn't be emitted.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200219/74e94543/attachment.html>


More information about the llvm-bugs mailing list