[testsuite] Add effective target ident_directive

On nvptx we run into:
...
FAIL: c-c++-common/ident-1b.c  -Wc++-compat   scan-assembler GCC:
FAIL: c-c++-common/ident-2b.c  -Wc++-compat   scan-assembler GCC:
...

Using a scan-assembler directive adds -fno-indent to the compile options.
The test c-c++-common/ident-1b.c adds dg-options "-fident", and intends to
check that the -fident overrides the -fno-indent, by means of the
scan-assembler.  But for nvptx, there's no .ident directive, both with -fident
and -fno-ident.

Fix this by adding an effective target ident_directive, and requiring
it in both test-cases.

Tested on nvptx and x86_64.

gcc/testsuite/ChangeLog:

2020-09-24  Tom de Vries  <tdevries@suse.de>

	* lib/target-supports.exp (check_effective_target_ident_directive): New proc.
	* c-c++-common/ident-1b.c: Require effective target ident_directive.
	* c-c++-common/ident-2b.c: Same.
This commit is contained in:
Tom de Vries 2020-09-24 10:49:02 +02:00
parent a2b7397b50
commit fa91ca7f50
3 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,7 @@
* Make sure scan-assembler turns off .ident unless -fident in testcase */
/* { dg-do compile } */
/* { dg-options "-fident" } */
/* { dg-require-effective-target ident_directive }*/
int i;
/* { dg-final { scan-assembler "GCC: " { xfail { { hppa*-*-hpux* && { ! lp64 } } || { powerpc-ibm-aix* || powerpc*-*-darwin* } } } } } */

View File

@ -2,6 +2,7 @@
* Make sure scan-assembler-times turns off .ident unless -fident in testcase */
/* { dg-do compile } */
/* { dg-options "-fident" } */
/* { dg-require-effective-target ident_directive }*/
int ident;
/* { dg-final { scan-assembler "GCC: " { xfail { { hppa*-*-hpux* && { ! lp64 } } || { powerpc-ibm-aix* || powerpc*-*-darwin* } } } } } */

View File

@ -10510,3 +10510,12 @@ proc check_symver_available { } {
}
}]
}
# Return 1 if emitted assembly contains .ident directive.
proc check_effective_target_ident_directive {} {
return [check_no_messages_and_pattern ident_directive \
"(?n)^\[\t\]+\\.ident" assembly {
int i;
}]
}