[PATCH] D99901: [Driver][test] Test intended target only

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 10 11:17:24 PDT 2021


thakis added inline comments.


================
Comment at: clang/test/Driver/nostdincxx.cpp:4
 // RUN: not %clangxx -nostdlibinc %s 2>&1 | FileCheck %s
-// RUN: not %clangxx -fsyntax-only -nostdinc -nostdinc++ %s 2>&1 | FileCheck /dev/null --implicit-check-not=-Wunused-command-line-argument
+// RUN: not %clangxx -target unknown-unknown-gnu -fsyntax-only -nostdinc -nostdinc++ %s 2>&1 | FileCheck /dev/null --implicit-check-not=-Wunused-command-line-argument
 // CHECK: file not found
----------------
hubert.reinterpretcast wrote:
> jsji wrote:
> > MaskRay wrote:
> > > `error: unknown target triple 'unknown-unknown-hurd-gnu', please use -triple or -arch`
> > > 
> > > Perhaps this should UNSUPPORTED aix if aix does not support -nostdinc++.
> > No, AIX does support `-nostdinc++`, we don't want to unsupport this whole test
> I believe the original fix was meant to be generally applicable but unintentionally applied in only a limited fashion. Ideally, the test would have been left as-is and the various toolchains changed similarly.
> 
> That is:
> ```
> $ clang -nostdinc -nostdinc++ -xc++ /dev/null -fsyntax-only
> clang-13: warning: argument unused during compilation: '-nostdinc++' [-Wunused-command-line-argument]
> ```
> 
> should not happen. I guess a way forward is to first make the change for AIX (and update the test to check on AIX) and then to commit a separate NFCI commit to apply the test broadly to see if anyone finds the test to be failing.
FYI: `%clangxx` is a driver invocation, not a cc1 invocation. The driver flag is `--target=`, not `-triple`.

This test, when run manually, produces:

```
bin/clang  -triple x86_64-unknown-unknown-gnu -fsyntax-only -nostdinc -nostdinc++ /Users/thakis/src/llvm-project/clang/test/Driver/nostdincxx.cpp
clang: error: unknown argument: '-triple'
clang: error: no such file or directory: 'x86_64-unknown-unknown-gnu'
```

That passes, but probably not for the reasons you want :) I fixed this in 23f256f2b198.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99901



More information about the cfe-commits mailing list