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

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 16:39:17 PDT 2024


================
@@ -10,31 +10,36 @@
 // RUN: %clang -Ofast -fno-strict-aliasing -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-NO-STRICT-ALIASING %s
 // RUN: %clang -Ofast -fno-vectorize -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-NO-VECTORIZE %s
 
+// CHECK-OFAST: argument '-Ofast' is deprecated; use '-O3 -ffast-math' instead, or just '-O3' if you do not intend to enable non-conforming optimizations
 // CHECK-OFAST: -cc1
 // CHECK-OFAST-NOT: -relaxed-aliasing
 // CHECK-OFAST: -ffast-math
 // CHECK-OFAST: -Ofast
 // CHECK-OFAST: -vectorize-loops
 
+// CHECK-OFAST-O2-NOT: argument '-Ofast' is deprecated; use '-O3 -ffast-math' instead, or just '-O3' if you do not intend to enable non-conforming optimizations
----------------
MaskRay wrote:

`clang -### -Werror` exits with 1 in case of errors (https://reviews.llvm.org/D156363). A lot of `CHECK-NOT: warning: ...` patterns can be replaced with `-### -Werror`

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


More information about the cfe-commits mailing list