diff mbox

[objc,testsuite] : Fix testcase for scalar pointer type issue

Message ID 393F4EC2-A502-40ED-8730-6A1FF1BAB498@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe Oct. 5, 2010, 1:51 p.m. UTC
Hi Kai,

does the following work for you?
(it is more within the guidelines given for use of the macros in say:
http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros)

Iain


    receiver += [(Obj *)receiver anotherValue];
    receiver += [(Obj <Proto> *)receiver someValue];
    receiver += [(Obj <Proto> *)receiver anotherValue];
    receiver += [objrcvr someValue]; /* { dg-warning ".Obj. may not  
respond to .\\-someValue." } */
-/* { dg-warning "assignment makes integer from pointer without a  
cast" "" { target *-*-* } 34 } */
+/* { dg-warning "assignment makes integer from pointer without a  
cast" "" { target *-*-* } 36 } */

    receiver += [objrcvr anotherValue];
    receiver += [(Obj <Proto> *)objrcvr someValue];
@@ -40,7 +42,7 @@ long foo(void) {
    receiver += [objrcvr2 someValue];
    receiver += [objrcvr2 anotherValue];
    receiver += [(Obj *)objrcvr2 someValue]; /* { dg-warning ".Obj.  
may not respond to .\\-someValue." } */
-/* { dg-warning "assignment makes integer from pointer without a  
cast" "" { target *-*-* } 42 } */
+/* { dg-warning "assignment makes integer from pointer without a  
cast" "" { target *-*-* } 44 } */

    receiver += [(Obj *)objrcvr2 anotherValue];




On 5 Oct 2010, at 14:16, Kai Tietz wrote:

> Ping
>
> 2010/9/30 NightStrike <nightstrike@gmail.com>:
>> Ping
>>
>> On Wed, Sep 29, 2010 at 11:24 AM, Kai Tietz  
>> <Kai.Tietz@onevision.com> wrote:
>>> Hello,
>>>
>>> This test didn't handled LLP64 case correctly.
>>>
>>> ChangeLog gcc/testsuite
>>>
>>> 2010-09-29  Kai Tietz
>>>
>>>        * objc.dg/proto-lossage-4.m: Use __INTPTR_TYPE__ instead of
>>>        long type.
>>>
>>> Tested for x86_64-pc-mingw32, and i686-pc-cygwin. Ok for apply?
>>>
>>>
>>> Regards,
>>>  i.A. Kai Tietz
>>>
>>> |  (\_/)  This is Bunny. Copy and paste Bunny
>>> | (='.'=) into your signature to help him gain
>>> | (")_(") world domination.
>>>
>>>
>>
>
>
>
> -- 
> |  (\_/) This is Bunny. Copy and paste
> | (='.'=) Bunny into your signature to help
> | (")_(") him gain world domination

Comments

Kai Tietz Oct. 5, 2010, 2:38 p.m. UTC | #1
2010/10/5 IainS <developer@sandoe-acoustics.co.uk>:
> Hi Kai,
>
> does the following work for you?
> (it is more within the guidelines given for use of the macros in say:
> http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros)
>
> Iain
>
> Index: gcc/testsuite/objc.dg/proto-lossage-4.m
> ===================================================================
> --- gcc/testsuite/objc.dg/proto-lossage-4.m     (revision 164977)
> +++ gcc/testsuite/objc.dg/proto-lossage-4.m     (working copy)
> @@ -3,36 +3,38 @@
>  /* Author: Ziemowit Laski <zlaski@apple.com>.  */
>  /* { dg-do compile } */
>
> +#include <stdint.h>
> +
>  /* One-line substitute for objc/objc.h */
>  typedef struct objc_object { struct objc_class *class_pointer; } *id;
>
>  @protocol Proto
> -- (long)someValue;
> +- (intptr_t)someValue;
>  @end
>
>  @interface Obj
> -- (long)anotherValue;
> +- (intptr_t)anotherValue;
>  @end
>
>  long foo(void) {
> -  long receiver = 2;
> +  intptr_t receiver = 2;
>   Obj *objrcvr;
>   Obj <Proto> *objrcvr2;
>
>   /* NB: Since 'receiver' is an invalid ObjC message receiver, the compiler
>      should warn but then search for methods as if we were messaging 'id'.
>  */
>
> -  receiver += [receiver someValue]; /* { dg-warning "invalid receiver type
> .long int." } */
> -  receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver
> type .long int." } */
> +  receiver += [receiver someValue]; /* { dg-warning "invalid receiver type
> .intptr_t." } */
> +  receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver
> type .intptr_t." } */
>
>   receiver += [(Obj *)receiver someValue]; /* { dg-warning ".Obj. may not
> respond to .\\-someValue." } */
> -/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 28 } */
> +/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 30 } */
>
>   receiver += [(Obj *)receiver anotherValue];
>   receiver += [(Obj <Proto> *)receiver someValue];
>   receiver += [(Obj <Proto> *)receiver anotherValue];
>   receiver += [objrcvr someValue]; /* { dg-warning ".Obj. may not respond to
> .\\-someValue." } */
> -/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 34 } */
> +/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 36 } */
>
>   receiver += [objrcvr anotherValue];
>   receiver += [(Obj <Proto> *)objrcvr someValue];
> @@ -40,7 +42,7 @@ long foo(void) {
>   receiver += [objrcvr2 someValue];
>   receiver += [objrcvr2 anotherValue];
>   receiver += [(Obj *)objrcvr2 someValue]; /* { dg-warning ".Obj. may not
> respond to .\\-someValue." } */
> -/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 42 } */
> +/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 44 } */
>
>   receiver += [(Obj *)objrcvr2 anotherValue];
>
>
>
>
> On 5 Oct 2010, at 14:16, Kai Tietz wrote:
>
>> Ping
>>
>> 2010/9/30 NightStrike <nightstrike@gmail.com>:
>>>
>>> Ping
>>>
>>> On Wed, Sep 29, 2010 at 11:24 AM, Kai Tietz <Kai.Tietz@onevision.com>
>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> This test didn't handled LLP64 case correctly.
>>>>
>>>> ChangeLog gcc/testsuite
>>>>
>>>> 2010-09-29  Kai Tietz
>>>>
>>>>       * objc.dg/proto-lossage-4.m: Use __INTPTR_TYPE__ instead of
>>>>       long type.
>>>>
>>>> Tested for x86_64-pc-mingw32, and i686-pc-cygwin. Ok for apply?
>>>>
>>>>
>>>> Regards,
>>>>  i.A. Kai Tietz
>>>>
>>>> |  (\_/)  This is Bunny. Copy and paste Bunny
>>>> | (='.'=) into your signature to help him gain
>>>> | (")_(") world domination.
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> |  (\_/) This is Bunny. Copy and paste
>> | (='.'=) Bunny into your signature to help
>> | (")_(") him gain world domination
>
>

Yes, this works for me.
Thanks,
Kai
Nicola Pero Oct. 5, 2010, 2:44 p.m. UTC | #2
The patch with this change looks good to me. :-)

I'm not sure if I can approve it though (it's not about the GNU Objective-C Runtime)
so it will have to wait for Mike to approve it before it can go in.

Thanks

-----Original Message-----
From: "Kai Tietz" <ktietz70@googlemail.com>
Sent: Tuesday, 5 October, 2010 16:38
To: "IainS" <developer@sandoe-acoustics.co.uk>
Cc: "Mike Stump" <mrs@gcc.gnu.org>, "Nicola Pero" <nicola.pero@meta-innovation.com>, "GCC Patches" <gcc-patches@gcc.gnu.org>
Subject: Re: [patch objc testsuite]: Fix testcase for scalar pointer type issue

2010/10/5 IainS <developer@sandoe-acoustics.co.uk>:
> Hi Kai,
>
> does the following work for you?
> (it is more within the guidelines given for use of the macros in say:
> http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros)
>
> Iain
>
> Index: gcc/testsuite/objc.dg/proto-lossage-4.m
> ===================================================================
> --- gcc/testsuite/objc.dg/proto-lossage-4.m     (revision 164977)
> +++ gcc/testsuite/objc.dg/proto-lossage-4.m     (working copy)
> @@ -3,36 +3,38 @@
>  /* Author: Ziemowit Laski <zlaski@apple.com>.  */
>  /* { dg-do compile } */
>
> +#include <stdint.h>
> +
>  /* One-line substitute for objc/objc.h */
>  typedef struct objc_object { struct objc_class *class_pointer; } *id;
>
>  @protocol Proto
> -- (long)someValue;
> +- (intptr_t)someValue;
>  @end
>
>  @interface Obj
> -- (long)anotherValue;
> +- (intptr_t)anotherValue;
>  @end
>
>  long foo(void) {
> -  long receiver = 2;
> +  intptr_t receiver = 2;
>   Obj *objrcvr;
>   Obj <Proto> *objrcvr2;
>
>   /* NB: Since 'receiver' is an invalid ObjC message receiver, the compiler
>      should warn but then search for methods as if we were messaging 'id'.
>  */
>
> -  receiver += [receiver someValue]; /* { dg-warning "invalid receiver type
> .long int." } */
> -  receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver
> type .long int." } */
> +  receiver += [receiver someValue]; /* { dg-warning "invalid receiver type
> .intptr_t." } */
> +  receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver
> type .intptr_t." } */
>
>   receiver += [(Obj *)receiver someValue]; /* { dg-warning ".Obj. may not
> respond to .\\-someValue." } */
> -/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 28 } */
> +/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 30 } */
>
>   receiver += [(Obj *)receiver anotherValue];
>   receiver += [(Obj <Proto> *)receiver someValue];
>   receiver += [(Obj <Proto> *)receiver anotherValue];
>   receiver += [objrcvr someValue]; /* { dg-warning ".Obj. may not respond to
> .\\-someValue." } */
> -/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 34 } */
> +/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 36 } */
>
>   receiver += [objrcvr anotherValue];
>   receiver += [(Obj <Proto> *)objrcvr someValue];
> @@ -40,7 +42,7 @@ long foo(void) {
>   receiver += [objrcvr2 someValue];
>   receiver += [objrcvr2 anotherValue];
>   receiver += [(Obj *)objrcvr2 someValue]; /* { dg-warning ".Obj. may not
> respond to .\\-someValue." } */
> -/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 42 } */
> +/* { dg-warning "assignment makes integer from pointer without a cast" "" {
> target *-*-* } 44 } */
>
>   receiver += [(Obj *)objrcvr2 anotherValue];
>
>
>
>
> On 5 Oct 2010, at 14:16, Kai Tietz wrote:
>
>> Ping
>>
>> 2010/9/30 NightStrike <nightstrike@gmail.com>:
>>>
>>> Ping
>>>
>>> On Wed, Sep 29, 2010 at 11:24 AM, Kai Tietz <Kai.Tietz@onevision.com>
>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> This test didn't handled LLP64 case correctly.
>>>>
>>>> ChangeLog gcc/testsuite
>>>>
>>>> 2010-09-29  Kai Tietz
>>>>
>>>>       * objc.dg/proto-lossage-4.m: Use __INTPTR_TYPE__ instead of
>>>>       long type.
>>>>
>>>> Tested for x86_64-pc-mingw32, and i686-pc-cygwin. Ok for apply?
>>>>
>>>>
>>>> Regards,
>>>>  i.A. Kai Tietz
>>>>
>>>> |  (\_/)  This is Bunny. Copy and paste Bunny
>>>> | (='.'=) into your signature to help him gain
>>>> | (")_(") world domination.
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> |  (\_/) This is Bunny. Copy and paste
>> | (='.'=) Bunny into your signature to help
>> | (")_(") him gain world domination
>
>

Yes, this works for me.
Thanks,
Kai
Mike Stump Oct. 5, 2010, 4:23 p.m. UTC | #3
On Oct 5, 2010, at 7:38 AM, Kai Tietz wrote:
>> does the following work for you?

> Yes, this works for me.

Iain's patch is Ok.
Iain Sandoe Oct. 7, 2010, 3:28 p.m. UTC | #4
On 5 Oct 2010, at 17:23, Mike Stump wrote:

> On Oct 5, 2010, at 7:38 AM, Kai Tietz wrote:
>>> does the following work for you?
>
>> Yes, this works for me.
>
> Iain's patch is Ok.

applied as r165121.
Iain
diff mbox

Patch

Index: gcc/testsuite/objc.dg/proto-lossage-4.m
===================================================================
--- gcc/testsuite/objc.dg/proto-lossage-4.m	(revision 164977)
+++ gcc/testsuite/objc.dg/proto-lossage-4.m	(working copy)
@@ -3,36 +3,38 @@ 
  /* Author: Ziemowit Laski <zlaski@apple.com>.  */
  /* { dg-do compile } */

+#include <stdint.h>
+
  /* One-line substitute for objc/objc.h */
  typedef struct objc_object { struct objc_class *class_pointer; } *id;

  @protocol Proto
-- (long)someValue;
+- (intptr_t)someValue;
  @end

  @interface Obj
-- (long)anotherValue;
+- (intptr_t)anotherValue;
  @end

  long foo(void) {
-  long receiver = 2;
+  intptr_t receiver = 2;
    Obj *objrcvr;
    Obj <Proto> *objrcvr2;

    /* NB: Since 'receiver' is an invalid ObjC message receiver, the  
compiler
       should warn but then search for methods as if we were messaging  
'id'.  */

-  receiver += [receiver someValue]; /* { dg-warning "invalid receiver  
type .long int." } */
-  receiver += [receiver anotherValue]; /* { dg-warning "invalid  
receiver type .long int." } */
+  receiver += [receiver someValue]; /* { dg-warning "invalid receiver  
type .intptr_t." } */
+  receiver += [receiver anotherValue]; /* { dg-warning "invalid  
receiver type .intptr_t." } */

    receiver += [(Obj *)receiver someValue]; /* { dg-warning ".Obj.  
may not respond to .\\-someValue." } */
-/* { dg-warning "assignment makes integer from pointer without a  
cast" "" { target *-*-* } 28 } */
+/* { dg-warning "assignment makes integer from pointer without a  
cast" "" { target *-*-* } 30 } */