Xcode Static Analyzer

RSS for tag

The Xcode Clang Static Analyzer finds bugs in Objective-C, C, and C++ code. It finds hard-to-produce, edge-case bugs without the need to run code and shows the sequence of steps along which the bug occurs.

Clang Static Analyzer Documentation

Posts under Xcode Static Analyzer tag

27 Posts
Sort by:
Post not yet marked as solved
1 Replies
693 Views
Hi, I'm looking for a way to integrate clang-tidy rules with my xcode project. is there a way xcode can read .clang-tidy files and add the rules to each compilation line ? I couldn't find anyway to do it, so i presume it's unsupported. but perhaps there can be some workaround i can use to modify the compilation according to clang-tidy rules that the IDE read from a file. thanks !
Posted
by chapo213.
Last updated
.
Post not yet marked as solved
0 Replies
388 Views
Hi everyone, I got an error when compile c++ with xcode 13. > 'notify_one' is unavailable 'wait' is unavailable This is my code in main.mm : #include <iostream> #include <atomic> #include <thread> std::atomic_flag condAtomicFlag{}; std::atomic<int> counter{}; constexpr int countlimit = 1000000; void ping() {   while(counter <= countlimit) {     condAtomicFlag.clear();     condAtomicFlag.test_and_set();           ++counter;           condAtomicFlag.notify_one();   } } void pong() {   while(counter < countlimit) {     condAtomicFlag.wait(false);     condAtomicFlag.clear();     condAtomicFlag.notify_one();   } } int main() {    auto start = std::chrono::system_clock::now();       condAtomicFlag.test_and_set();   std::thread t1(ping);   std::thread t2(pong);   t1.join();   t2.join();   std::chrono::duration<double> dur = std::chrono::system_clock::now() - start;   std::cout << "Duration: " << dur.count() << " seconds" << std::endl; } I researched and found Apple clang not support "notify_one" and "wait" function If have any solution for my issue Thank you
Posted
by bbbbbb.
Last updated
.
Post not yet marked as solved
0 Replies
300 Views
So I'm new to Xcode, but I'm noticing some disturbing behavior with my current c project. it seems it is not reporting headers it can't find, which is making all kinds of harder to diagnose errors, like "implicit function declaration not allowed in c99, etc. Anyone have any other ideas on why this might be? I think the latest one was "ssl.h", so maybe it was finding it in the sdk and not the version under my project I needed to use (boringssl)?
Posted Last updated
.
Post not yet marked as solved
0 Replies
1k Views
This seems to be a problem that has been popping up quite often with Big Sur. The mentioned solutions for checking the symbolic link for the MacOS.sdk don't seem to solve my problem. I'm trying to build a c++ module for python using a setup.py script. Running in verbose my command line shows: running build running build_ext building 'pparser' extension Compiling with an SDK that doesn't seem to exist:  /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk Please check your Xcode installation clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/john/.pyenv/versions/3.7.9/include/python3.7m -c pparser.cpp -o build/temp.macosx-11.4-x86_64-3.7/pparser.o -Wno-nullability-completeness -Wno-undef-prefix -I/usr/local/opt/flex/include -I/usr/local/opt/bison/include -std=gnu++14 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk --verbose Apple clang version 12.0.5 (clang-1205.0.22.11) Target: x86_64-apple-darwin20.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin clang: warning: no such sysroot directory: ' /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk' [-Wmissing-sysroot] ignoring nonexistent directory " /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1"  "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.4.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name pparser.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -munwind-tables -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -target-linker-version 650.9 -v -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/12.0.5 -isysroot " /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk" -D NDEBUG -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I /Users/john/.pyenv/versions/3.7.9/include/python3.7m -I /usr/local/opt/flex/include -I /usr/local/opt/bison/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -stdlib=libc++ -internal-isystem /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1 -internal-isystem " /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/local/include" -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/12.0.5/include -internal-externc-isystem " /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include" -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -O3 -Wno-unused-result -Wsign-compare -Wunreachable-code -Wall -Wno-nullability-completeness -Wno-undef-prefix -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -std=gnu++14 -fdeprecated-macro -fdebug-compilation-dir /Users/john/Programming/git/Jupyter/Parsers -ferror-limit 19 -fwrapv -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -vectorize-loops -vectorize-slp -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -mllvm -disable-aligned-alloc-awareness=1 -o build/temp.macosx-11.4-x86_64-3.7/pparser.o -x c++ pparser.cpp clang -cc1 version 12.0.5 (clang-1205.0.22.11) default target x86_64-apple-darwin20.5.0 Yet my directory shows the correct symbolic links: ```~/Programming/git/Jupyter/Parsers  % ls -al /Library/Developer/CommandLineTools/SDKs                                                                                                                                       main total 0 drwxr-xr-x  7 root  wheel  224 Jul 12 19:31 . drwxr-xr-x  5 root  wheel  160 Jul 12 19:27 .. lrwxr-xr-x  1 root  wheel   14 Jul 12 19:31 MacOSX.sdk -> MacOSX11.3.sdk drwxr-xr-x  8 root  wheel  256 Jul 12 19:31 MacOSX10.15.sdk drwxr-xr-x  7 root  wheel  224 Nov 30  2020 MacOSX11.1.sdk drwxr-xr-x  7 root  wheel  224 Jul 12 19:31 MacOSX11.3.sdk lrwxr-xr-x  1 root  wheel   14 Jul 12 19:30 MacOSX11.sdk -> MacOSX11.3.sdk I'm trying to force some of the settings in the setup script: from distutils.core import setup, Extension class custom_build_ext(build_ext): def build_extensions(self): # Override the compiler executables. Importantly, this # removes the "default" compiler flags that would # otherwise get passed on to to the compiler, i.e., # distutils.sysconfig.get_var("CFLAGS"). self.compiler.set_executable("compiler_so", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++") self.compiler.set_executable("compiler_cxx", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++") self.compiler.set_executable("linker_so", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++") build_ext.build_extensions(self) [ setup(name='pparser', version='1.0', \ ext_modules=[Extension('pparser', ['pparser.cpp'], extra_compile_args = ["-Wno-nullability-completeness", "-Wno-undef-prefix", "-I/usr/local/opt/flex/include", "-I/usr/local/opt/bison/include", "-std=gnu++14", "-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk", "--verbose"], extra_link_args=["-flat_namespace"])]) ] I'm lost on what to try next.
Posted
by MNSkiBum.
Last updated
.
Post not yet marked as solved
1 Replies
564 Views
When I invoke the c++ compiler in macOS Big Sur Version 11.5.1 (20G80) I get the following: objc[80581]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x20cbc3ad8) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1165dc2b8). One of the two will be used. Which one is undefined. objc[80581]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x20cbc3b28) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1165dc308). One of the two will be used. Which one is undefined. My question: What to do about these messages? Thanks in advance,
Posted
by aguila98.
Last updated
.
Post not yet marked as solved
0 Replies
389 Views
In the latest update of Big Sur 11.5.1 LAPACK is showing some Error. It was running fine in the previous updates. Now It is showing errors like " error: no matching function for call to 'zgeev_' zgeev_(&Nchar, &eigenvec_choice, &N, reinterpret_cast<complex double *>(A.data()), &LDA, w, vl, &LDA, vr, &LDA, WORK, &LWORK, RWORK, &INFO); ^~~~~~ /usr/local/opt/lapack/include/lapack.h:1854:6: note: candidate function not viable: requires 16 arguments, but 14 were provided void LAPACK_zgeev_base( " I need help to run my c++ code with LAPACK
Posted Last updated
.