Hi, I’m applying my clang-tidy rules on macOS cmake project using the following command :
set_target_properties(${target_name} PROPERTIES CXX_CLANG_TIDY ${clang_tidy_cmd})
Recently I’ve added a file that is written in objective-c++, so the clang-tidy rules applies to it as well.
The makefile was generated ok, but when try to compile it I got compilation error which relates to the system include line
#import <Foundation/Foundation.h>
The error was :
/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)))
^
When avoid setting clang-tidy on the target’s properties, the compilation passes.
I could try and avoid this if it was a rules that breaks, but it seems like a compilation error, so i assume that clang-tidy settings changes compiler configuration somehow…
Any idea how to resolve it ?