Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to silence unused command line argument error with clang without disabling it?

Tags:

c

clang

When using -Werror with clang, it transforms "warning: argument unused during compilation" messages into errors, which makes sense. There's a -Qunused-arguments flag to silence them entirely. My question is, is there some -Wno-error=... flag I can pass to make these not be errors, without disabling them entirely?

like image 922
Alex Gaynor Avatar asked Feb 07 '14 00:02

Alex Gaynor


3 Answers

Turns out the correct answer is -Wno-error=unused-command-line-argument.

like image 123
Alex Gaynor Avatar answered Nov 18 '22 12:11

Alex Gaynor


You can also use this command:

-Wno-unused-command-line-argument
like image 36
Enye Aaron Shi Avatar answered Nov 18 '22 13:11

Enye Aaron Shi


In my case, I had similar issues with autoconf while using clang-8 compiler in ./configure.

*clang-8: error: unknown argument: '-ftree-loop-distribute-patterns'*
*clang-8: error: unknown argument: '-fno-semantic-interposition'*

I needed following command line to fix these errors:

./configure CC=clang-8 CXX=clang++-8 LD=clang++-8 CFLAGS=-Qunused-arguments

Hope this is helpful to others.

like image 1
naveenKumar Avatar answered Nov 18 '22 13:11

naveenKumar