clang

ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARC

佐手、 提交于 2020-01-03 23:09:40
sudo gem install jekyll 安装报错 Building native extensions. This could take a while .. . ERROR: Error installing jekyll: ERROR: Failed to build gem native extension. current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.11.3/ext/ffi_c /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200103-63706-1n7uc12.rb extconf.rb checking for ffi.h .. . no checking for ffi.h in /usr/local/include,/usr/include/ffi .. . yes checking for ffi_call ( ) in -lffi .. . yes checking for ffi_closure_alloc ( ) .. . no checking for shlwapi.h .. . no checking for rb_thread_call_without

Variadic macros: expansion of pasted tokens

♀尐吖头ヾ 提交于 2020-01-03 18:31:09
问题 I'm wondering if it's possible to "nest" variadic macro invocations. I'm only truly concerned with GCC and Clang. My macro definition looks like this: /** * @brief Invoke an instance method. */ #define $(obj, method, ...) \ ({ \ typeof(obj) _obj = obj; \ _obj->interface->method(_obj, ## __VA_ARGS__); \ }) I use this to conveniently call "instance methods" in my OO framework (https://github.com/jdolan/objectively): $(array, addObject, obj); Works boss. Unfortunately, I haven't yet figured out

Configure error with Mac OS X 10.8.5 Xcode 5.0.2: clang: error: argument to '-V' is missing (expected 1 value) clang: error: no input files

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 17:28:37
问题 on MacOSX 10.8.5, after upgrading to Xcode 5.0.2 (and upgrading/installing the Command Line Tools (from within Xcode preferences) I was installing FFTW 3.3.3 and Open MPI 1.6.5 by configuring them from the sources. I get the same type of error in both config.log files in the configure step, which shows the problem is not with the programs as I downloaded them from the official websites. In short, the first error I see in the both logs is: configure:3750: checking for gcc configure:3766: found

libclang: missing some statements in the AST?

☆樱花仙子☆ 提交于 2020-01-03 17:09:13
问题 I've wrote a test program (parse_ast.c) to parse a c source file (tt.c) to see how libclang works, the output is the hierarchical structure of the AST: Here is the test file: /* tt.c */ // line 1 #include <unistd.h> #include <stdio.h> typedef ssize_t (*write_fn_t)(int, const void *, size_t); void indirect_write(write_fn_t write_fn) { // line 7 (*write_fn)(1, "indirect call\n", 14); } void direct_write() { // line 11 write(1, "direct call\n", 12); // line 12 mising in the ast? } int main() { /

How to set language standard (-std) for Clang static analyzer in Qt Creator

萝らか妹 提交于 2020-01-03 16:47:14
问题 I write my project in C using QtCreator as IDE and CMake for build. QtCreator ver. >= 4.0.0 include Clang static analyzer, that I try to use. In my CMakeLists.txt set: set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}") When I launch analysis in console get errors: error: invalid argument '-std=gnu++11' not allowed with 'C/ObjC' How to pass '-std=gnu99' to clang analyzer? Maybe it's hardcoded in QtCreator plugin sources? UDP1 : Seems like it's the QtCreator bug: https://bugreports.qt.io/browse

Casting pointers to _Atomic pointers and _Atomic sizes

为君一笑 提交于 2020-01-03 15:39:10
问题 By my reading of the standard, *(_Atomic TYPE*)&(TYPE){0} (in words, casting a pointer to a non-atomic to a pointer to a corresponding atomic and dereferencing) isn't supported. Do gcc and/or clang recognize it as an extension if TYPE is/isn't lock-free? (Question 1) Second and related question: I was under the impression that if TYPE couldn't be implemented as a lock free atomic, a lock would need to be embedded in the corresponding _Atomic TYPE . But if I make TYPE a largish struct, then on

Find loops in LLVM bytecode

牧云@^-^@ 提交于 2020-01-03 12:31:27
问题 I want to find simple loops in LLVM bytecode, and extract the basic information of the loop. For example: for (i=0; i<1000; i++) sum += i; I want to extract the bound [0, 1000), the loop variable "i" and the loop body (sum += i). What should I do? I read the LLVM API document, and find some useful classes like "Loop", "LoopInfo". But I do not know how to use them in detail. Could you please give me some help? A detailed usage may be more helpful. 回答1: If you do not want to use the pass

Building a C library (GMP) for arm64 iOS

回眸只為那壹抹淺笑 提交于 2020-01-03 12:13:42
问题 I'm trying to build a C library (GMP 6.0.0) for arm64 for use on iOS. I'm running the configure script with the invocation below (compiler is as found using xcrun --find). ./configure \ CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" \ CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" \ CPPFLAGS="-target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms

constexpr non-static member function with non-constexpr constructor (gcc,clang differ)

偶尔善良 提交于 2020-01-03 08:09:49
问题 For this code: struct S { S(int m): m(m) {} constexpr int f() const { return m; } int m; }; int main() { S s(1); } it is compiled with no warnings or errors by clang 3.6, 3.7 and 3.8 with -std=c++14 . But in g++ 5.x the following errors occur: main.cpp:4:19: error: enclosing class of constexpr non-static member function 'int S::f() const' is not a literal type constexpr int f() const { return m; } ^ main.cpp:1:8: note: 'S' is not literal because: struct S ^ main.cpp:1:8: note: 'S' is not an

constexpr non-static member function with non-constexpr constructor (gcc,clang differ)

一笑奈何 提交于 2020-01-03 08:09:07
问题 For this code: struct S { S(int m): m(m) {} constexpr int f() const { return m; } int m; }; int main() { S s(1); } it is compiled with no warnings or errors by clang 3.6, 3.7 and 3.8 with -std=c++14 . But in g++ 5.x the following errors occur: main.cpp:4:19: error: enclosing class of constexpr non-static member function 'int S::f() const' is not a literal type constexpr int f() const { return m; } ^ main.cpp:1:8: note: 'S' is not literal because: struct S ^ main.cpp:1:8: note: 'S' is not an