[flang-commits] [clang] [flang] [flang] Support -f(no-)protect-parens (PR #170505)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Wed Dec 17 16:50:49 PST 2025


================
@@ -0,0 +1,13 @@
+! RUN: %flang -fprotect-parens -### %s -o %t 2>&1 | FileCheck %s -check-prefix=PROTECT
+! RUN: %flang -fno-protect-parens -### %s -o %t 2>&1 | FileCheck %s -check-prefix=NO-PROTECT
+! RUN: %flang -### %s -o %t 2>&1 | FileCheck %s -check-prefix=DEFAULT
+! RUN: %flang -Ofast -### %s -o %t 2>&1 | FileCheck %s -check-prefix=OFAST
+! RUN: %flang -Ofast -fprotect-parens -### %s -o %t 2>&1 | FileCheck %s -check-prefix=OFAST-PROTECT
----------------
tarunprabhu wrote:

```suggestion
! RUN: %flang -fprotect-parens -### %s -o %t 2>&1 | FileCheck %s -check-prefix=PROTECT
! RUN: %flang -fno-protect-parens -### %s -o %t 2>&1 | FileCheck %s -check-prefix=NO-PROTECT
! RUN: %flang -### %s -o %t 2>&1 | FileCheck %s -check-prefix=NO-PROTECT
! RUN: %flang -Ofast -### %s -o %t 2>&1 | FileCheck %s -check-prefix=NO-PROTECT
! RUN: %flang -Ofast -fprotect-parens -### %s -o %t 2>&1 | FileCheck %s -check-prefix=PROTECT
```

The `PROTECT-NOT`, `DEFAULT-NOT` and `OFAST-PROTECT-NOT` are identical, as are `NO-PROTECT` and `OFAST`. With this change, we reduce the number of distinct check labels. To me, it is easier to tell what is expected in each `RUN` directive. 

This is just a suggestion. Feel free to disregard if you do not agree.

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


More information about the flang-commits mailing list