Hi, I’ve started using clang-tidy on my cmake based project.
Unfortunately, this option isn’t supported on Xcode project generation but only in Makefile.
So when I compiled on the first time, one of the error related to a system include line
#import <Foundation/Foundation.h>
I get the following error :
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:91:143: error: function does not return NSString [clang-diagnostic-error]
- (NSAttributedString *)localizedAttributedStringForKey:(NSString *)key value:(nullable NSString *)value table:(nullable NSString *)tableName NS_FORMAT_ARGUMENT(1) NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:103:48: note: expanded from macro 'NS_FORMAT_ARGUMENT'
#define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
^
119827 warnings and 1 error generated.
Error while processing /Users/me/proj/main.mm.
Suppressed 119978 warnings (119822 in non-user code, 5 due to line filter, 151 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
make[2]: *** [CMakeFiles/PASrv.dir/src/main.mm.o] Error 1
make[1]: *** [CMakeFiles/PASrv.dir/all] Error 2
Although it seems correct I’d like to ignore it, but couldn’t do so with // NOLINT
since it’s header file, So i’ve read about NOLINTBEGIN and NOLINTEND but it’s supported from llvm 14 and Apple has llvm 12.0.1 and I don’t want to update the entire package because it’s used by Xcode
clang-tidy --version
Homebrew LLVM version 12.0.1
Optimized build.
Default target: x86_64-apple-darwin20.6.0
Host CPU: skylake
any idea how to ignore this system header ?