public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9535] testsuite, Objective-c++ : Backport test fixes.
@ 2021-03-24 22:07 Iain D Sandoe
0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2021-03-24 22:07 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8bbfa67a5eea80cb1ed2c2aae227e2833ddc148c
commit r10-9535-g8bbfa67a5eea80cb1ed2c2aae227e2833ddc148c
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Wed Oct 7 16:19:09 2020 +0100
testsuite, Objective-c++ : Backport test fixes.
Backported from fa99b56c7f3bca72c27d9bfcddf68ab9cc6a35e3,
6b468b7556fd96cf5bdc56ae30131980a3d596ae,
fd36daf64a1596b493d054604dd409bc7506fbfd,
cc3014d80e1072c376687f6fcfa421953a58fdd1 and
04103ecbaa59ccacc977256ae02e2f63dfd90258
gcc/testsuite/ChangeLog:
* obj-c++.dg/gnu-api-2-class-meta.mm: Add a flag to cause NeXT
headers to expose prototypes for messaging.
* obj-c++.dg/gnu-api-2-class.mm: Likewise.
* obj-c++.dg/gnu-api-2-objc.mm: Skip this because of the extra
protocols pulled in by system headers.
* obj-c++.dg/cxx-ivars-3.mm: Skip for macOS >= 10.7.
* obj-c++.dg/objc-gc-3.mm:i Skip for Darwin >= 16.
* objc-obj-c++-shared/TestsuiteObject.h: Add dummy retain and
release method declarations.
* objc-obj-c++-shared/TestsuiteObject.m: Add dummy retain and
release implementations.
* obj-c++.dg/plugin/diagnostic-test-expressions-1.mm:
Adjust testcase to include expressions for @selector and
@protocol. XFAIL where this is still not sufficient to obtain
a disgnostic range.
Diff:
---
gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm | 4 +--
gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm | 1 +
gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm | 1 +
gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm | 8 ++++--
gcc/testsuite/obj-c++.dg/objc-gc-3.mm | 2 +-
.../plugin/diagnostic-test-expressions-1.mm | 33 +++++++++++++++-------
.../objc-obj-c++-shared/TestsuiteObject.h | 5 ++++
.../objc-obj-c++-shared/TestsuiteObject.m | 11 ++++++++
8 files changed, 50 insertions(+), 15 deletions(-)
diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
index 18b671d122a..07123559d72 100644
--- a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
+++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
@@ -2,14 +2,14 @@
// { dg-do run { target *-*-darwin* } }
// { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
-// { dg-skip-if "Headers incompatible with 10.4 APIs" { *-*-darwin1[3-8]* } { "-fnext-runtime" } { "" } }
+// { dg-skip-if "Headers incompatible with 10.4 APIs" { *-*-darwin1[1-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } }
// { dg-additional-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4 -framework Foundation" }
// This test has no equivalent or meaning for m64/ABI V2
// { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
-#include <objc/objc-runtime.h>
#include <stdlib.h>
#include "../objc-obj-c++-shared/F-NSObject.h"
+#include <objc/objc-runtime.h>
//extern "C" { int printf(const char *,...); }
#define CHECK_IF(expr) if(!(expr)) abort()
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
index 7806d6faa36..bdaef9828ca 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
@@ -20,6 +20,7 @@
/* { dg-do run } */
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
index 9a7c092f3b2..ae39026c2d3 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
@@ -7,6 +7,7 @@
/* { dg-do run } */
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
index e5b1a69ed04..201ab7e7af2 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
@@ -3,8 +3,12 @@
This is test 'objc', covering all functions starting with 'objc'. */
/* { dg-do run } */
-/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
-/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* Although this works with the NeXT runtime in a sub-set of cases, some
+ versions of the runtime header pulls in a number of system protocols,
+ which causes the objc_copyProtocolList test to fail (in addition to those
+ systems that don't have the V2 APis). XFAILing the run is not useful
+ since it will XPASS on the sub-set that works. */
+/* { dg-skip-if "Incompatible" { *-*-darwin* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
diff --git a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
index 68bebf8fc96..45ffbc5553d 100644
--- a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
+++ b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
@@ -3,7 +3,7 @@
/* Contributed by Ziemowit Laski <zlaski@apple.com> */
/* { dg-do compile } */
-/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-8]* } { "-fnext-runtime" } { "" } } */
+/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } } */
/* { dg-options "-fobjc-gc" } */
/* { dg-prune-output "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
diff --git a/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm b/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
index 609fe3d0f93..988b290ce69 100644
--- a/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
+++ b/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
@@ -1,10 +1,13 @@
/* { dg-do compile } */
/* { dg-options "-O -fdiagnostics-show-caret" } */
+/* { dg-excess-errors "tree range 0:0-0:0" { target { *-*-darwin* } } } */
/* This file is similar to diagnostic-test-expressions-1.c
(see the notes in that file); this file adds test
coverage for various Objective C constructs. */
+#include <objc/runtime.h> /* for SEL, Protocol */
+
extern void __emit_expression_range (int dummy, ...);
@protocol prot
@@ -17,7 +20,7 @@ extern void __emit_expression_range (int dummy, ...);
- (void) test_sending_messages;
+ (void) test_class_dot_name;
- (void) test_at_selector;
-- (void) test_at_protocol;
+- (void) test_at_protocol:(int)i;
- (void) test_at_encode:(int)i;
@end
@@ -49,27 +52,37 @@ extern void __emit_expression_range (int dummy, ...);
}
+ (void) test_class_dot_name
{
- __emit_expression_range ( 0, tests.func2 ); /* { dg-warning "range" } */
+ __emit_expression_range ( 0, tests.func2 ); /* { dg-warning "range" } */
/* { dg-begin-multiline-output "" }
__emit_expression_range ( 0, tests.func2 );
~~~~~~^~~~~
- { dg-end-multiline-output "" } */
+ { dg-end-multiline-output "" } */
}
- (void) test_at_selector
{
- __emit_expression_range ( 0, @selector(func0) ); /* { dg-warning "range" } */
+ /* For the NeXT runtime, @selector() generates a a var decl which (a) isn't
+ handled by the plugin, and (b) if it was would not necessarily have the
+ right location (there is only one var decl uniqued to each selector
+ spelling, so the location would be that of the first occurrence). Use an
+ assignment expression to test the operation. This isn't reliable here,
+ unfortunately. */
+ SEL aSel;
+ __emit_expression_range ( 0, aSel = @selector(foo) ); /* { dg-warning "range" } */
/* { dg-begin-multiline-output "" }
- __emit_expression_range ( 0, @selector(func0) );
- ^~~~~~~~~~~~~~~~
- { dg-end-multiline-output "" } */
+ __emit_expression_range ( 0, aSel = @selector(foo) );
+ ~~~~~^~~~~~~~~~~~~~~~
+ { dg-end-multiline-output "" { xfail { *-*-darwin* } } } */
}
-- (void) test_at_protocol
+- (void) test_at_protocol:(int)i
{
- __emit_expression_range ( 0, @protocol(prot) ); /* { dg-warning "range" } */
+ /* As for @selector(), the NeXT runtime generates a a var decl for
+ @protocol(); Unfortunately, we can't so easily fabricate a mechanism to
+ handle this (C++ FE turns the assignment op into a NOP). */
+ __emit_expression_range ( 0, @protocol(prot) ); /* { dg-warning "range" "" { xfail { *-*-darwin* && lp64 } } } */
/* { dg-begin-multiline-output "" }
__emit_expression_range ( 0, @protocol(prot) );
^~~~~~~~~~~~~~~
- { dg-end-multiline-output "" } */
+ { dg-end-multiline-output "" { xfail { *-*-darwin* && lp64 } } } */
}
- (void) test_at_encode:(int)i
{
diff --git a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
index 0f139bc84b4..a1a964da8f5 100644
--- a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
+++ b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
@@ -45,6 +45,11 @@ __attribute__((objc_root_class))
+ (Class) superclass;
+ (const char *)name;
- (const char *)name;
+
+/* For try-catch impl that retains and releases thrown objects. */
+- (id) retain;
+- (void) release;
+
@end
#endif /* _TESTSUITE_OBJECT_H_ */
diff --git a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
index 703827f8e61..96717e362d5 100644
--- a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
+++ b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
@@ -66,4 +66,15 @@ along with GCC; see the file COPYING3. If not see
{
return object_getClassName (self);
}
+
+- (id) retain
+{
+ return self;
+}
+
+- (void) release
+{
+ return;
+}
+
@end
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-24 22:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 22:07 [gcc r10-9535] testsuite, Objective-c++ : Backport test fixes Iain D 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).