public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests
@ 2022-12-15 12:23 Jakub Jelinek
  2022-12-15 12:48 ` Richard Biener
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jakub Jelinek @ 2022-12-15 12:23 UTC (permalink / raw)
  To: Richard Biener, Arthur Cohen, Gaius Mulley; +Cc: gcc-patches, gcc-rust

Hi!

This patch allows magic comments also for Rust and Modula-2
for effective target tests etc. and fixes up the Assembly entry
- it is a glob, so /* Assembly can match /whatever Assembly and
not just /* Assembly.

Tested on x86_64-linux with
make check-g++ RUNTESTFLAGS=i386.exp=pr35513*
and verifying it still uses *.S extension for the property_1_needed
effective target test.

Ok for trunk?

2022-12-15  Jakub Jelinek  <jakub@redhat.com>

	* lib/target-supports.exp (check_compile): Add support for
	Rust and Modula-2.  Use \* rather than * for /* comment for
	Assembly.

--- gcc/testsuite/lib/target-supports.exp.jj	2022-11-30 10:29:42.217698938 +0100
+++ gcc/testsuite/lib/target-supports.exp	2022-12-15 13:08:47.941221943 +0100
@@ -36,7 +36,9 @@
 # "! Fortran" for Fortran code,
 # "/* ObjC", for ObjC
 # "// ObjC++" for ObjC++
-# and "// Go" for Go
+# "// Go" for Go
+# "// Rust" for Rust
+# and "(* Modula-2" for Modula-2
 # If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to 
 # allow for ObjC/ObjC++ specific flags.
 
@@ -58,13 +60,15 @@ proc check_compile {basename type conten
 	set options ""
     }
     switch -glob -- $contents {
-	"*/* Assembly*" { set src ${basename}[pid].S }
+	"*/\* Assembly*" { set src ${basename}[pid].S }
 	"*! Fortran*" { set src ${basename}[pid].f90 }
 	"*// C++*" { set src ${basename}[pid].cc }
 	"*// D*" { set src ${basename}[pid].d }
 	"*// ObjC++*" { set src ${basename}[pid].mm }
 	"*/* ObjC*" { set src ${basename}[pid].m }
 	"*// Go*" { set src ${basename}[pid].go }
+	"*// Rust*" { set src ${basename}[pid].rs }
+	"*(\* Modula-2*" { set src ${basename}[pid].mod }
 	default {
 	    switch -- $tool {
 		"objc" { set src ${basename}[pid].m }

	Jakub


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests
  2022-12-15 12:23 [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests Jakub Jelinek
@ 2022-12-15 12:48 ` Richard Biener
  2022-12-15 12:53 ` Arthur Cohen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Richard Biener @ 2022-12-15 12:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Arthur Cohen, Gaius Mulley, gcc-patches, gcc-rust

On Thu, 15 Dec 2022, Jakub Jelinek wrote:

> Hi!
> 
> This patch allows magic comments also for Rust and Modula-2
> for effective target tests etc. and fixes up the Assembly entry
> - it is a glob, so /* Assembly can match /whatever Assembly and
> not just /* Assembly.
> 
> Tested on x86_64-linux with
> make check-g++ RUNTESTFLAGS=i386.exp=pr35513*
> and verifying it still uses *.S extension for the property_1_needed
> effective target test.
> 
> Ok for trunk?

OK.

Thanks,
Richard.

> 2022-12-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* lib/target-supports.exp (check_compile): Add support for
> 	Rust and Modula-2.  Use \* rather than * for /* comment for
> 	Assembly.
> 
> --- gcc/testsuite/lib/target-supports.exp.jj	2022-11-30 10:29:42.217698938 +0100
> +++ gcc/testsuite/lib/target-supports.exp	2022-12-15 13:08:47.941221943 +0100
> @@ -36,7 +36,9 @@
>  # "! Fortran" for Fortran code,
>  # "/* ObjC", for ObjC
>  # "// ObjC++" for ObjC++
> -# and "// Go" for Go
> +# "// Go" for Go
> +# "// Rust" for Rust
> +# and "(* Modula-2" for Modula-2
>  # If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to 
>  # allow for ObjC/ObjC++ specific flags.
>  
> @@ -58,13 +60,15 @@ proc check_compile {basename type conten
>  	set options ""
>      }
>      switch -glob -- $contents {
> -	"*/* Assembly*" { set src ${basename}[pid].S }
> +	"*/\* Assembly*" { set src ${basename}[pid].S }
>  	"*! Fortran*" { set src ${basename}[pid].f90 }
>  	"*// C++*" { set src ${basename}[pid].cc }
>  	"*// D*" { set src ${basename}[pid].d }
>  	"*// ObjC++*" { set src ${basename}[pid].mm }
>  	"*/* ObjC*" { set src ${basename}[pid].m }
>  	"*// Go*" { set src ${basename}[pid].go }
> +	"*// Rust*" { set src ${basename}[pid].rs }
> +	"*(\* Modula-2*" { set src ${basename}[pid].mod }
>  	default {
>  	    switch -- $tool {
>  		"objc" { set src ${basename}[pid].m }
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests
  2022-12-15 12:23 [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests Jakub Jelinek
  2022-12-15 12:48 ` Richard Biener
@ 2022-12-15 12:53 ` Arthur Cohen
  2022-12-15 13:01 ` Andreas Schwab
  2022-12-15 13:03 ` Andreas Schwab
  3 siblings, 0 replies; 6+ messages in thread
From: Arthur Cohen @ 2022-12-15 12:53 UTC (permalink / raw)
  To: Jakub Jelinek, Richard Biener, Gaius Mulley; +Cc: gcc-patches, gcc-rust


[-- Attachment #1.1.1: Type: text/plain, Size: 1988 bytes --]

Hi Jakub,

On 12/15/22 13:23, Jakub Jelinek wrote:
> Hi!
> 
> This patch allows magic comments also for Rust and Modula-2
> for effective target tests etc. and fixes up the Assembly entry
> - it is a glob, so /* Assembly can match /whatever Assembly and
> not just /* Assembly.
> 
> Tested on x86_64-linux with
> make check-g++ RUNTESTFLAGS=i386.exp=pr35513*
> and verifying it still uses *.S extension for the property_1_needed
> effective target test.
> 
> Ok for trunk?
> 
> 2022-12-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* lib/target-supports.exp (check_compile): Add support for
> 	Rust and Modula-2.  Use \* rather than * for /* comment for
> 	Assembly.
> 
> --- gcc/testsuite/lib/target-supports.exp.jj	2022-11-30 10:29:42.217698938 +0100
> +++ gcc/testsuite/lib/target-supports.exp	2022-12-15 13:08:47.941221943 +0100
> @@ -36,7 +36,9 @@
>   # "! Fortran" for Fortran code,
>   # "/* ObjC", for ObjC
>   # "// ObjC++" for ObjC++
> -# and "// Go" for Go
> +# "// Go" for Go
> +# "// Rust" for Rust
> +# and "(* Modula-2" for Modula-2
>   # If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to
>   # allow for ObjC/ObjC++ specific flags.
>   
> @@ -58,13 +60,15 @@ proc check_compile {basename type conten
>   	set options ""
>       }
>       switch -glob -- $contents {
> -	"*/* Assembly*" { set src ${basename}[pid].S }
> +	"*/\* Assembly*" { set src ${basename}[pid].S }
>   	"*! Fortran*" { set src ${basename}[pid].f90 }
>   	"*// C++*" { set src ${basename}[pid].cc }
>   	"*// D*" { set src ${basename}[pid].d }
>   	"*// ObjC++*" { set src ${basename}[pid].mm }
>   	"*/* ObjC*" { set src ${basename}[pid].m }
>   	"*// Go*" { set src ${basename}[pid].go }
> +	"*// Rust*" { set src ${basename}[pid].rs }
> +	"*(\* Modula-2*" { set src ${basename}[pid].mod }
>   	default {
>   	    switch -- $tool {
>   		"objc" { set src ${basename}[pid].m }
> 
> 	Jakub
> 

LGTM :)

Thank you,

Arthur

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3195 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests
  2022-12-15 12:23 [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests Jakub Jelinek
  2022-12-15 12:48 ` Richard Biener
  2022-12-15 12:53 ` Arthur Cohen
@ 2022-12-15 13:01 ` Andreas Schwab
  2022-12-15 13:03 ` Andreas Schwab
  3 siblings, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2022-12-15 13:01 UTC (permalink / raw)
  To: Jakub Jelinek via Gcc-rust
  Cc: Richard Biener, Arthur Cohen, Gaius Mulley, Jakub Jelinek, gcc-patches

On Dez 15 2022, Jakub Jelinek via Gcc-rust wrote:

> @@ -58,13 +60,15 @@ proc check_compile {basename type conten
>  	set options ""
>      }
>      switch -glob -- $contents {
> -	"*/* Assembly*" { set src ${basename}[pid].S }
> +	"*/\* Assembly*" { set src ${basename}[pid].S }

That's a no-op.  Either double the backslash or quote with {} instead of
"".

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests
  2022-12-15 12:23 [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests Jakub Jelinek
                   ` (2 preceding siblings ...)
  2022-12-15 13:01 ` Andreas Schwab
@ 2022-12-15 13:03 ` Andreas Schwab
  2022-12-15 13:22   ` Jakub Jelinek
  3 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2022-12-15 13:03 UTC (permalink / raw)
  To: Jakub Jelinek via Gcc-rust
  Cc: Richard Biener, Arthur Cohen, Gaius Mulley, Jakub Jelinek, gcc-patches

On Dez 15 2022, Jakub Jelinek via Gcc-rust wrote:

> @@ -58,13 +60,15 @@ proc check_compile {basename type conten
>  	set options ""
>      }
>      switch -glob -- $contents {
> -	"*/* Assembly*" { set src ${basename}[pid].S }
> +	"*/\* Assembly*" { set src ${basename}[pid].S }
>  	"*! Fortran*" { set src ${basename}[pid].f90 }
>  	"*// C++*" { set src ${basename}[pid].cc }
>  	"*// D*" { set src ${basename}[pid].d }
>  	"*// ObjC++*" { set src ${basename}[pid].mm }
>  	"*/* ObjC*" { set src ${basename}[pid].m }

You probably want to quote the * here too.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests
  2022-12-15 13:03 ` Andreas Schwab
@ 2022-12-15 13:22   ` Jakub Jelinek
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Jelinek @ 2022-12-15 13:22 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Jakub Jelinek via Gcc-rust, Richard Biener, Arthur Cohen,
	Gaius Mulley, gcc-patches

On Thu, Dec 15, 2022 at 02:03:36PM +0100, Andreas Schwab wrote:
> On Dez 15 2022, Jakub Jelinek via Gcc-rust wrote:
> 
> > @@ -58,13 +60,15 @@ proc check_compile {basename type conten
> >  	set options ""
> >      }
> >      switch -glob -- $contents {
> > -	"*/* Assembly*" { set src ${basename}[pid].S }
> > +	"*/\* Assembly*" { set src ${basename}[pid].S }
> >  	"*! Fortran*" { set src ${basename}[pid].f90 }
> >  	"*// C++*" { set src ${basename}[pid].cc }
> >  	"*// D*" { set src ${basename}[pid].d }
> >  	"*// ObjC++*" { set src ${basename}[pid].mm }
> >  	"*/* ObjC*" { set src ${basename}[pid].m }
> 
> You probably want to quote the * here too.

You're right on both, I've committed this follow-up
after verifying that Assembly test still works (it works even with \\\*
but doesn't with \\\\*) and verifying that changing 
check_effective_target_property_1_needed
to have // Assembly instead of /* Assembly incorrectly works with
"*/* Assembly*", "*/\* Assembly*" but correctly doesn't work with
"*/\\* Assembly*" or "*/\\\* Assembly*".

Committed to trunk.  Sorry.

2022-12-15  Jakub Jelinek  <jakub@redhat.com>
    
	* lib/target-supports.exp (check_compile): Further quoting
	fixes for /* Assembly, /* ObjC and (* Modula-2 *) checks.

--- gcc/testsuite/lib/target-supports.exp.jj	2022-12-15 13:57:40.000000000 +0100
+++ gcc/testsuite/lib/target-supports.exp	2022-12-15 14:14:02.987854385 +0100
@@ -60,15 +60,15 @@ proc check_compile {basename type conten
 	set options ""
     }
     switch -glob -- $contents {
-	"*/\* Assembly*" { set src ${basename}[pid].S }
+	"*/\\* Assembly*" { set src ${basename}[pid].S }
 	"*! Fortran*" { set src ${basename}[pid].f90 }
 	"*// C++*" { set src ${basename}[pid].cc }
 	"*// D*" { set src ${basename}[pid].d }
 	"*// ObjC++*" { set src ${basename}[pid].mm }
-	"*/* ObjC*" { set src ${basename}[pid].m }
+	"*/\\* ObjC*" { set src ${basename}[pid].m }
 	"*// Go*" { set src ${basename}[pid].go }
 	"*// Rust*" { set src ${basename}[pid].rs }
-	"*(\* Modula-2*" { set src ${basename}[pid].mod }
+	"*(\\* Modula-2*" { set src ${basename}[pid].mod }
 	default {
 	    switch -- $tool {
 		"objc" { set src ${basename}[pid].m }


	Jakub


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-15 13:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15 12:23 [PATCH] testsuite: Add support for Rust and Modula-2 effective target tests Jakub Jelinek
2022-12-15 12:48 ` Richard Biener
2022-12-15 12:53 ` Arthur Cohen
2022-12-15 13:01 ` Andreas Schwab
2022-12-15 13:03 ` Andreas Schwab
2022-12-15 13:22   ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).