clang

What does the clang compiler's `-Weverything` option include and where is it documented?

浪尽此生 提交于 2021-01-01 09:59:27
问题 clang, but NOT gcc, has a -Weverything option which appears to include things such as -Wpedantic . You can test it here: https://godbolt.org/z/qcYKd1. See the top-right of the window for where I have typed in -Weverything as an explicit compiler option. Notice the -Wvla-extension warning we get since we are relying on a C99 extension in C++ in this case, and we have -Weverything set. We get the same warning if we just use -Wpedantic , as shown here: https://godbolt.org/z/M9ahE4, indicating

How to specify custom libc++

社会主义新天地 提交于 2020-12-30 09:45:36
问题 I have built libc++ and want to use it when compiling my program ? so I have something like clang++ -stdlib=~/libc++/libc++.so main.cpp but this does not work. How can use my custom built libc++ when building the application? 回答1: This information comes from llvm documentation about libcxx. If you want to use a custom libc++ with clang you have to specify argument like this : $ clang++ -std=c++11 -stdlib=libc++ -nostdinc++ -I<path_to_libcxx>/include/c++/v1 -L<path_to_libcxx>/lib -Wl,-rpath,

Implication of using -fshort-wchar

情到浓时终转凉″ 提交于 2020-12-30 08:13:05
问题 While going through the file wchar.h on Mac OS X system, I found that wchar_t equivalent of str functions such as wcscpy, wcscat are poisoned when __cplusplust is not defined and max size of wchar_t is of 2 bytes (by using compiler option -fshort-wchar). It seems that for C program, it does not allow such functions to use if -fshort-wchar is defined. I would like to know that what is the implication of using wchar_t functions when -fshort-wchar is used? You may wonder that why I need to use

Implication of using -fshort-wchar

≯℡__Kan透↙ 提交于 2020-12-30 08:12:43
问题 While going through the file wchar.h on Mac OS X system, I found that wchar_t equivalent of str functions such as wcscpy, wcscat are poisoned when __cplusplust is not defined and max size of wchar_t is of 2 bytes (by using compiler option -fshort-wchar). It seems that for C program, it does not allow such functions to use if -fshort-wchar is defined. I would like to know that what is the implication of using wchar_t functions when -fshort-wchar is used? You may wonder that why I need to use

Implication of using -fshort-wchar

纵然是瞬间 提交于 2020-12-30 08:12:26
问题 While going through the file wchar.h on Mac OS X system, I found that wchar_t equivalent of str functions such as wcscpy, wcscat are poisoned when __cplusplust is not defined and max size of wchar_t is of 2 bytes (by using compiler option -fshort-wchar). It seems that for C program, it does not allow such functions to use if -fshort-wchar is defined. I would like to know that what is the implication of using wchar_t functions when -fshort-wchar is used? You may wonder that why I need to use

Implication of using -fshort-wchar

筅森魡賤 提交于 2020-12-30 08:11:10
问题 While going through the file wchar.h on Mac OS X system, I found that wchar_t equivalent of str functions such as wcscpy, wcscat are poisoned when __cplusplust is not defined and max size of wchar_t is of 2 bytes (by using compiler option -fshort-wchar). It seems that for C program, it does not allow such functions to use if -fshort-wchar is defined. I would like to know that what is the implication of using wchar_t functions when -fshort-wchar is used? You may wonder that why I need to use

Clang 8 with MinGW-w64: How do I use address- & UB sanitizers?

六月ゝ 毕业季﹏ 提交于 2020-12-30 05:48:13
问题 Clang 8 release notes have this promising line: Allow using Address Sanitizer and Undefined Behaviour Sanitizer on MinGW. However, I unable to figure out how to use those properly. I'm using Clang 8.0.0 with MSYS2 MinGW GCC. Exact details are at the bottom of the question. I'm trying to compile following minimal piece of code: 1.cpp #include <iostream> int main() { // Testing ubsan int x = 0x7fffffff; x++; std::cout << x << std::endl; // Testing asan int *y = new int; delete y; std::cout <<

What is a clobber?

坚强是说给别人听的谎言 提交于 2020-12-29 09:55:56
问题 Clang TargetInfo has a method called getClobbers : Returns a string of target-specific clobbers, in LLVM format. So, what is a clobber? 回答1: A clobbered register is a register which is trashed i.e. modified in unpredictable way by inline assembler. This usually happens when you need a temp. register or use particular instruction which happens to modify some register as a by-product. Usually programmer explicitly declares registers which are clobbered by his inline asm code but some may be

What is a clobber?

给你一囗甜甜゛ 提交于 2020-12-29 09:52:04
问题 Clang TargetInfo has a method called getClobbers : Returns a string of target-specific clobbers, in LLVM format. So, what is a clobber? 回答1: A clobbered register is a register which is trashed i.e. modified in unpredictable way by inline assembler. This usually happens when you need a temp. register or use particular instruction which happens to modify some register as a by-product. Usually programmer explicitly declares registers which are clobbered by his inline asm code but some may be

What is a clobber?

不羁岁月 提交于 2020-12-29 09:51:14
问题 Clang TargetInfo has a method called getClobbers : Returns a string of target-specific clobbers, in LLVM format. So, what is a clobber? 回答1: A clobbered register is a register which is trashed i.e. modified in unpredictable way by inline assembler. This usually happens when you need a temp. register or use particular instruction which happens to modify some register as a by-product. Usually programmer explicitly declares registers which are clobbered by his inline asm code but some may be