[clang] [clang] Add deprecation warning for `-Ofast` driver option (PR #98736)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 12:03:01 PDT 2024


================
@@ -442,6 +442,9 @@ def warn_drv_deprecated_arg : Warning<
 def warn_drv_deprecated_arg_no_relaxed_template_template_args : Warning<
   "argument '-fno-relaxed-template-template-args' is deprecated">,
   InGroup<DeprecatedNoRelaxedTemplateTemplateArgs>;
+def warn_drv_deprecated_arg_ofast : Warning<
+  "argument '-Ofast' is deprecated; use '-O3', possibly with '-ffast-math'">,
----------------
mizvekov wrote:

I think in this diagnostic it's more important to inform the user that he should replace `-Ofast` with `-O3 -ffast-math` in order to just circumvent the deprecation and keep the current behavior, and this should be clear. Throwing the option of using just `O3` as equally valid is a bit misleading, but we can, as a note, inform the user that it's possible he made the wrong choice in the first place, and advise a switch to `O3`.

https://github.com/llvm/llvm-project/pull/98736


More information about the cfe-commits mailing list