From e4bb0fd17935037b1f5366afe50b41140e74ceb4 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 15 Feb 2017 07:26:40 -0800 Subject: [PATCH] [clang] pass -Wno-ignored-optimization-argument to clang Summary: This avoids spurious warnings on projects using gcc with optimization flags that are ignored by clang. Reviewed By: akotulski Differential Revision: D4559326 fbshipit-source-id: 14a2431 --- infer/src/clang/ClangWrapper.re | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/infer/src/clang/ClangWrapper.re b/infer/src/clang/ClangWrapper.re index 40f120693..6b005961e 100644 --- a/infer/src/clang/ClangWrapper.re +++ b/infer/src/clang/ClangWrapper.re @@ -27,13 +27,20 @@ let normalize prog::prog args::args :list action_item => { "%s 2>&1" ( ClangCommand.prepend_arg "-###" cmd |> - /* c++ modules are not supported, so let clang know in case it was passed - "-fmodules". Unfortunately we cannot know accurately if "-fmodules" was passed because we - don't go into argument files at this point ("clang -### ..." will do that for us), so we - also pass "-Qunused-arguments" to silence the potential warning that "-fno-cxx-modules" - was ignored. Moreover, "-fno-cxx-modules" is only accepted by the clang driver so we have - to pass it now. */ - ClangCommand.append_args ["-fno-cxx-modules", "-Qunused-arguments"] |> ClangCommand.command_to_run + /* c++ modules are not supported, so let clang know in case it was passed "-fmodules". + Unfortunately we cannot know accurately if "-fmodules" was passed because we don't go + into argument files at this point ("clang -### ..." will do that for us), so we also pass + "-Qunused-arguments" to silence the potential warning that "-fno-cxx-modules" was + ignored. Moreover, "-fno-cxx-modules" is only accepted by the clang driver so we have to + pass it now. + + Using clang instead of gcc may trigger warnings about unsupported optimization flags; + passing -Wno-ignored-optimization-argument prevents that. */ + ClangCommand.append_args [ + "-fno-cxx-modules", + "-Qunused-arguments", + "-Wno-ignored-optimization-argument" + ] |> ClangCommand.command_to_run ); Logging.out "clang -### invocation: %s@\n" clang_hashhashhash; let normalized_commands = ref [];