Patchwork [v2,testsuite] : Add dg-error for unsupported floating suffix

login
register
mail settings
Submitter Uros Bizjak
Date Nov. 15, 2012, 4:20 p.m.
Message ID <CAFULd4bY7SiwuhyuzP7uP9bFRUt60gdFDGy+Oyfb5vT9sv=k+Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/199340/
State New
Headers show

Comments

Uros Bizjak - Nov. 15, 2012, 4:20 p.m.
On Thu, Nov 15, 2012 at 1:35 AM, Uros Bizjak <ubizjak@gmail.com> wrote:

> Attached patch fixes following testsuite failure
>
> FAIL: g++.dg/cpp0x/gnu_fext-numeric-literals.C (test for excess errors)
> FAIL: g++.dg/cpp0x/std_fext-numeric-literals.C (test for excess errors)
>
> on targets that don't support Q and W floating suffixes.

This revision auto-detect support for Q and W suffixes.

2012-11-15  Uros Bizjak  <ubizjak@gmail.com>

	* lib/target_suports.exp
	(check_effective_target_has_w_floating_suffix): New procedure.
	(check_effective_target_has_q_floating_suffix): Ditto.
	* g++.dg/cpp0x/gnu_fext-numeric-literals.C: Add dg-error directive
	for unsupported non-standard suffix on floating constant.
	* g++.dg/cpp0x/std_fext-numeric-literals.C: Ditto.

Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu.

OK for mainline?

Uros.
Jakub Jelinek - Nov. 15, 2012, 4:25 p.m.
On Thu, Nov 15, 2012 at 05:20:48PM +0100, Uros Bizjak wrote:
> This revision auto-detect support for Q and W suffixes.
> 
> 2012-11-15  Uros Bizjak  <ubizjak@gmail.com>
> 
> 	* lib/target_suports.exp
> 	(check_effective_target_has_w_floating_suffix): New procedure.
> 	(check_effective_target_has_q_floating_suffix): Ditto.
> 	* g++.dg/cpp0x/gnu_fext-numeric-literals.C: Add dg-error directive
> 	for unsupported non-standard suffix on floating constant.
> 	* g++.dg/cpp0x/std_fext-numeric-literals.C: Ditto.
> 
> Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu.
> 
> OK for mainline?

> Index: lib/target-supports.exp
> ===================================================================
> --- lib/target-supports.exp	(revision 193533)
> +++ lib/target-supports.exp	(working copy)
> @@ -1742,6 +1742,23 @@
>      }]
>  }
>  
> +# Return 1 if the target supports 'w' suffix on floating constant
> +# 0 otherwise.
> +
> +proc check_effective_target_has_w_floating_suffix { } {
> +    return [check_no_compiler_messages w_fp_suffix object {
> +	float dummy = 1.0w;
> +    }]
> +}
> +
> +# Return 1 if the target supports 'q' suffix on floating constant
> +# 0 otherwise.
> +
> +proc check_effective_target_has_q_floating_suffix { } {
> +    return [check_no_compiler_messages q_fp_suffix object {
> +	float dummy = 1.0q;
> +    }]

Don't you need to make sure you are compiling this either with C, or C++
with -std=gnu++03/11 or whatever other option is needed to enable those?
With -std=c++11 without other options I believe this is now rejected,
even when the target supports it.

	Jakub
Uros Bizjak - Nov. 15, 2012, 4:31 p.m.
On Thu, Nov 15, 2012 at 5:25 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Nov 15, 2012 at 05:20:48PM +0100, Uros Bizjak wrote:
>> This revision auto-detect support for Q and W suffixes.
>>
>> 2012-11-15  Uros Bizjak  <ubizjak@gmail.com>
>>
>>       * lib/target_suports.exp
>>       (check_effective_target_has_w_floating_suffix): New procedure.
>>       (check_effective_target_has_q_floating_suffix): Ditto.
>>       * g++.dg/cpp0x/gnu_fext-numeric-literals.C: Add dg-error directive
>>       for unsupported non-standard suffix on floating constant.
>>       * g++.dg/cpp0x/std_fext-numeric-literals.C: Ditto.
>>
>> Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu.
>>
>> OK for mainline?
>
>> Index: lib/target-supports.exp
>> ===================================================================
>> --- lib/target-supports.exp   (revision 193533)
>> +++ lib/target-supports.exp   (working copy)
>> @@ -1742,6 +1742,23 @@
>>      }]
>>  }
>>
>> +# Return 1 if the target supports 'w' suffix on floating constant
>> +# 0 otherwise.
>> +
>> +proc check_effective_target_has_w_floating_suffix { } {
>> +    return [check_no_compiler_messages w_fp_suffix object {
>> +     float dummy = 1.0w;
>> +    }]
>> +}
>> +
>> +# Return 1 if the target supports 'q' suffix on floating constant
>> +# 0 otherwise.
>> +
>> +proc check_effective_target_has_q_floating_suffix { } {
>> +    return [check_no_compiler_messages q_fp_suffix object {
>> +     float dummy = 1.0q;
>> +    }]
>
> Don't you need to make sure you are compiling this either with C, or C++
> with -std=gnu++03/11 or whatever other option is needed to enable those?
> With -std=c++11 without other options I believe this is now rejected,
> even when the target supports it.

No, the intention of this test is to check if target can handle these
suffixes through TARGET_C_MODE_FOR_SUFFIX. Please note that in
particular tests, -std=x compile switches are added to compile flags.

Uros.
Jakub Jelinek - Nov. 15, 2012, 4:34 p.m.
On Thu, Nov 15, 2012 at 05:31:42PM +0100, Uros Bizjak wrote:
> No, the intention of this test is to check if target can handle these
> suffixes through TARGET_C_MODE_FOR_SUFFIX. Please note that in
> particular tests, -std=x compile switches are added to compile flags.

But -std=c++11 (well, perhaps -std=gnu++11) could be eventually the default.
As Q/W suffixes are only supported in certain modes through
TARGET_C_MODE_FOR_SUFFIX, it is better to put the explicit option that
allows it on the command line of the check_effective_target* test.

	Jakub
Uros Bizjak - Nov. 15, 2012, 4:42 p.m.
On Thu, Nov 15, 2012 at 5:34 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Nov 15, 2012 at 05:31:42PM +0100, Uros Bizjak wrote:
>> No, the intention of this test is to check if target can handle these
>> suffixes through TARGET_C_MODE_FOR_SUFFIX. Please note that in
>> particular tests, -std=x compile switches are added to compile flags.
>
> But -std=c++11 (well, perhaps -std=gnu++11) could be eventually the default.
> As Q/W suffixes are only supported in certain modes through
> TARGET_C_MODE_FOR_SUFFIX, it is better to put the explicit option that
> allows it on the command line of the check_effective_target* test.

Do you have option in mind that would be appropriate for the test?

Thanks,
Uros.
Jakub Jelinek - Nov. 15, 2012, 4:44 p.m.
On Thu, Nov 15, 2012 at 05:42:32PM +0100, Uros Bizjak wrote:
> On Thu, Nov 15, 2012 at 5:34 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> > On Thu, Nov 15, 2012 at 05:31:42PM +0100, Uros Bizjak wrote:
> >> No, the intention of this test is to check if target can handle these
> >> suffixes through TARGET_C_MODE_FOR_SUFFIX. Please note that in
> >> particular tests, -std=x compile switches are added to compile flags.
> >
> > But -std=c++11 (well, perhaps -std=gnu++11) could be eventually the default.
> > As Q/W suffixes are only supported in certain modes through
> > TARGET_C_MODE_FOR_SUFFIX, it is better to put the explicit option that
> > allows it on the command line of the check_effective_target* test.
> 
> Do you have option in mind that would be appropriate for the test?

"-std=gnu++03" ?

	Jakub

Patch

Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 193533)
+++ lib/target-supports.exp	(working copy)
@@ -1742,6 +1742,23 @@ 
     }]
 }
 
+# Return 1 if the target supports 'w' suffix on floating constant
+# 0 otherwise.
+
+proc check_effective_target_has_w_floating_suffix { } {
+    return [check_no_compiler_messages w_fp_suffix object {
+	float dummy = 1.0w;
+    }]
+}
+
+# Return 1 if the target supports 'q' suffix on floating constant
+# 0 otherwise.
+
+proc check_effective_target_has_q_floating_suffix { } {
+    return [check_no_compiler_messages q_fp_suffix object {
+	float dummy = 1.0q;
+    }]
+}
 # Return 1 if the target supports compiling fixed-point,
 # 0 otherwise.
 
Index: g++.dg/cpp0x/gnu_fext-numeric-literals.C
===================================================================
--- g++.dg/cpp0x/gnu_fext-numeric-literals.C	(revision 193533)
+++ g++.dg/cpp0x/gnu_fext-numeric-literals.C	(working copy)
@@ -91,10 +91,10 @@ 
   auto rfp = 1.0r; // { dg-error "fixed-point types not supported" }
   auto Rfp = 1.0R; // { dg-error "fixed-point types not supported" }
 
-  auto wfp = 1.0w;
-  auto Wfp = 1.0W;
-  auto qfp = 1.0q;
-  auto Qfp = 1.0Q;
+  auto wfp = 1.0w; // { dg-error "unsupported" "" { target { ! has_w_floating_suffix } } }
+  auto Wfp = 1.0W; // { dg-error "unsupported" "" { target { ! has_w_floating_suffix } } }
+  auto qfp = 1.0q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+  auto Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
 }
 
 // { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 7 }
Index: g++.dg/cpp0x/std_fext-numeric-literals.C
===================================================================
--- g++.dg/cpp0x/std_fext-numeric-literals.C	(revision 193533)
+++ g++.dg/cpp0x/std_fext-numeric-literals.C	(working copy)
@@ -91,10 +91,10 @@ 
   auto rfp = 1.0r; // { dg-error "fixed-point types not supported" }
   auto Rfp = 1.0R; // { dg-error "fixed-point types not supported" }
 
-  auto wfp = 1.0w;
-  auto Wfp = 1.0W;
-  auto qfp = 1.0q;
-  auto Qfp = 1.0Q;
+  auto wfp = 1.0w; // { dg-error "unsupported" "" { target { ! has_w_floating_suffix } } }
+  auto Wfp = 1.0W; // { dg-error "unsupported" "" { target { ! has_w_floating_suffix } } }
+  auto qfp = 1.0q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+  auto Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
 }
 
 // { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 7 }