Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum number of errors while compiling with Clang

Tags:

c++

llvm

clang

When I try to use the '-fmax-errors=n' option with clang++ the following warning is output:

clang: warning: argument unused during compilation: '-fmax-errors=2'

What is the clang equivalent?

like image 798
chila Avatar asked Jan 30 '14 14:01

chila


People also ask

Does Clang compile faster than GCC?

GCC's PCH mechanism (which is just a dump of the compiler memory image) is related, but is architecturally only able to read the dump back into the exact same executable as the one that produced it (it is not a structured format). Clang is much faster and uses far less memory than GCC.

Does Clang define __ GNUC __?

(GNU C is a language, GCC is a compiler for that language.Clang defines __GNUC__ / __GNUC_MINOR__ / __GNUC_PATCHLEVEL__ according to the version of gcc that it claims full compatibility with.

Can Clang compile itself?

Clang C++ can parse GCC 4.2 libstdc++ and generate working code for non-trivial programs, and can compile itself.

What compiler does Clang use?

Clang uses the LLVM compiler as its back end and it has been included in the release of the LLVM since the LLVM 2.6. Clang is also built to be a drop-in replacement for GCC command. In its design, the Clang compiler has been constructed to work very similarly to GCC to ensure that portability is maximized.


1 Answers

The equivalent clang flag is -ferror-limit:

clang -ferror-limit=2 test.c
like image 194
Florian Sowade Avatar answered Oct 17 '22 04:10

Florian Sowade