Patchwork [ObjC++,test-suite] Fix encode-3 FAIL on NeXT.

login
register
mail settings
Submitter IainS
Date Nov. 5, 2010, 12:09 p.m.
Message ID <7AD7133C-A2FA-4AA9-A8D1-DF3B3ADF89D6@sandoe-acoustics.co.uk>
Download mbox | patch
Permalink /patch/70257/
State New
Headers show

Comments

IainS - Nov. 5, 2010, 12:09 p.m.
Hi,

It seems that the current obj-c++.dg/encode-3.mm "fail" is  
intentional...

... that is, we intentionally omit the ReadOnly encoding on types when  
-fnext-runtime is active.
This is compatible with the behavior of ObjC++ up to at least XCode  
3.2.3/Darwin10.

So, it seems that the 'fix' is for the test to check for different  
output for -fnext-runtime.

Shall apply this - or  any other thoughts?
Iain

    const char *encode = @encode(long);

@@ -44,7 +53,7 @@ int main(void) {
    if (strcmp (enc2, (const char *)"{Vec<double>=dd" L "q}"))
      abort ();

-  if (strcmp (enc3, (const char *)"{?=f[10d]i" L "q{Vec<const signed  
char>=rcrc" L "q}}"))
+  if (strcmp (enc3, (const char *) E3))
      abort ();

    return 0;
Mike Stump - Nov. 5, 2010, 3:18 p.m.
On Nov 5, 2010, at 5:09 AM, IainS wrote:
> So, it seems that the 'fix' is for the test to check for different output for -fnext-runtime.
> 
> Shall apply this - or  any other thoughts?

Compatibility is annoying at times.

Ok.
IainS - Nov. 6, 2010, 11:25 a.m.
On 5 Nov 2010, at 15:18, Mike Stump wrote:

> On Nov 5, 2010, at 5:09 AM, IainS wrote:
>> So, it seems that the 'fix' is for the test to check for different  
>> output for -fnext-runtime.
>>
>> Shall apply this - or  any other thoughts?
>
> Compatibility is annoying at times.
>
> Ok.

r166400, thanks
Iain

Patch

Index: gcc/testsuite/obj-c++.dg/encode-3.mm
===================================================================
--- gcc/testsuite/obj-c++.dg/encode-3.mm	(revision 166352)
+++ gcc/testsuite/obj-c++.dg/encode-3.mm	(working copy)
@@ -32,6 +32,15 @@  const char *enc3 = @encode(anonymous);
  #define L "l"
  #endif

+/* Darwin (at least, as of XCode 3.2.3/Darwin10) does not encode the  
read-only attribute
+   on types.  Arguably, this is a bug, but we are compatible with  
this when
+   -fnext-runtime is selected.  */
+#ifdef __NEXT_RUNTIME__
+#define E3 "{?=f[10d]i" L "q{Vec<const signed char>=cc" L "q}}"
+#else
+#define E3 "{?=f[10d]i" L "q{Vec<const signed char>=rcrc" L "q}}"
+#endif
+
  int main(void) {