public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] testsuite, objective-c: Fix a testcase on Windows.
@ 2023-02-15 10:54 Iain Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain Sandoe @ 2023-02-15 10:54 UTC (permalink / raw)
  To: gcc-patches

tested by 'nightstrike' on Windows, and on x86_64-darwin21,
pushed to master, thanks,
Iain

--- 8< ---

Windows needs to use uintptr_t to represent an integral pointer type (long
is not the right type there).

Patch from 'nightstike'.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/testsuite/ChangeLog:

	* obj-c++.dg/proto-lossage-4.mm: Use uintptr_t for integral pointer
	representations.
---
 gcc/testsuite/obj-c++.dg/proto-lossage-4.mm | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm
index 2e753d1f8ba..ff053bec7d0 100644
--- a/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm
+++ b/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm
@@ -6,24 +6,26 @@
 /* One-line substitute for objc/objc.h */
 typedef struct objc_object { struct objc_class *class_pointer; } *id;
 
+typedef __UINTPTR_TYPE__ uintptr_t;
+
 @protocol Proto
-- (long)someValue;
+- (uintptr_t)someValue;
 @end
 
 @interface Obj
-- (long)anotherValue;
+- (uintptr_t)anotherValue;
 @end
 
-long foo(void) {
-  long receiver = 2;
+uintptr_t foo(void) {
+  uintptr_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 .uintptr_t." } */
+  receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver type .uintptr_t." } */
 
   receiver += [(Obj *)receiver someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */
 /* { dg-error "invalid conversion" "" { target *-*-* } .-1 } */
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-15 10:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 10:54 [pushed] testsuite, objective-c: Fix a testcase on Windows Iain Sandoe

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).