Index: include/clang/Basic/DiagnosticDriverKinds.td =================================================================== --- include/clang/Basic/DiagnosticDriverKinds.td +++ include/clang/Basic/DiagnosticDriverKinds.td @@ -119,6 +119,7 @@ def err_drv_optimization_remark_pattern : Error< "%0 in '%1'">; +def warn_ignored_gcc_optimization : Warning<"Ignoring unsupported optimization flag %0">; def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup; def warn_drv_optimization_value : Warning<"optimization level '%0' is unsupported; using '%1%2' instead">, InGroup; Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -88,6 +88,10 @@ def clang_ignored_m_Group : OptionGroup<"">, Group; +// Group that ignores all gcc optimizations that won't be implemented +def clang_ignored_gcc_optimization_f_Group : OptionGroup<"">, + Group; + ///////// // Options @@ -1558,7 +1562,8 @@ defm gnu : BooleanFFlag<"gnu">, Group; defm ident : BooleanFFlag<"ident">, Group; defm implicit_templates : BooleanFFlag<"implicit-templates">, Group; -defm inline_limit : BooleanFFlag<"inline-limit">, Group; +def finline_limit_EQ : Joined<["-"], "finline-limit=">, Group; +defm finline_limit : BooleanFFlag<"inline-limit">, Group; defm ivopts : BooleanFFlag<"ivopts">, Group; defm non_call_exceptions : BooleanFFlag<"non-call-exceptions">, Group; defm permissive : BooleanFFlag<"permissive">, Group; Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -3128,6 +3128,12 @@ } } + // Warn about ignored options to clang. + for (arg_iterator it = Args.filtered_begin(options::OPT_clang_ignored_gcc_optimization_f_Group), + ie = Args.filtered_end(); it != ie; ++it) { + D.Diag(diag::warn_ignored_gcc_optimization) << (*it)->getAsString(Args); + } + // Don't warn about unused -flto. This can happen when we're preprocessing or // precompiling. Args.ClaimAllArgs(options::OPT_flto); Index: test/Driver/clang_f_opts.c =================================================================== --- test/Driver/clang_f_opts.c +++ test/Driver/clang_f_opts.c @@ -159,6 +159,8 @@ // RUN: -fno-unsigned-char \ // RUN: -fno-signed-char \ // RUN: -fstrength-reduce -fno-strength-reduce \ +// RUN: -finline-limit=1000 \ +// RUN: -finline-limit \ // RUN: %s 2>&1 | FileCheck --check-prefix=IGNORE %s // IGNORE-NOT: error: unknown argument