[PATCH] D116395: [Clang] Emit warning for -x option without effects

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 27 08:17:37 PST 2022


awarzynski added inline comments.


================
Comment at: clang/test/Driver/redundant-args.c:2
+// RUN: %clang -target x86_64-apple-darwin10 -Werror -x c -x c -fsyntax-only %s
+// RUN: %clang -target x86_64-apple-darwin10 %s -### -x c 2>&1 | FileCheck %s
+
----------------
hans wrote:
> These two lines seem to test pretty different things (and I find the first test a bit confusing). Maybe there's a better test to add the new warning to, or it could go in its own file?
I second @hans here - this is confusing. I suggest the following:
```
// RUN: %clang  -Werror -x c -fsyntax-only %s
// RUN: not %clang  -Werror %s -x c -fsyntax-only  2>&1 | FileCheck %s
```

Basically:
* IIUC, `-target` is not relevant here
* `-x -c` and `-x -c -x -c` are identical (so `-x -c` should be sufficient)
* both lines should be almost identical and the difference triggering the warning should be made clear


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116395/new/

https://reviews.llvm.org/D116395



More information about the cfe-commits mailing list