diff options
author | James E Wilson <wilson@specifixinc.com> | 2004-01-28 08:17:55 +0000 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 2004-01-28 00:17:55 -0800 |
commit | 220a38ab6e9973dac69fa339127b88b57e44dc9b (patch) | |
tree | 9bbe77e03b3b7400b8839a6b0342e6236041d630 | |
parent | faceece35d90a25ebfb9156d94cc6e8aa60bdb86 (diff) | |
download | gcc-220a38ab6e9973dac69fa339127b88b57e44dc9b.zip gcc-220a38ab6e9973dac69fa339127b88b57e44dc9b.tar.gz gcc-220a38ab6e9973dac69fa339127b88b57e44dc9b.tar.bz2 |
encode-2.m (main): New local string.
* objc.dg/encode-2.m (main): New local string. Set depending on
sizeof long. Use in sscanf call.
* objc.dg/encode-3.m (main): New local string. Set depending on
sizeof long. Use in scan_initial call.
From-SVN: r76783
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/encode-2.m | 11 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/encode-3.m | 8 |
3 files changed, 22 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 81e8392..e22e0e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2004-01-27 James E Wilson <wilson@specifixinc.com> + + * objc.dg/encode-2.m (main): New local string. Set depending on + sizeof long. Use in sscanf call. + * objc.dg/encode-3.m (main): New local string. Set depending on + sizeof long. Use in scan_initial call. + 2004-01-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * objc.dg/call-super-2.m: Make LP64-safe. diff --git a/gcc/testsuite/objc.dg/encode-2.m b/gcc/testsuite/objc.dg/encode-2.m index ebfd8d3..b089927 100644 --- a/gcc/testsuite/objc.dg/encode-2.m +++ b/gcc/testsuite/objc.dg/encode-2.m @@ -6,7 +6,7 @@ - The k-th parameter (k > 1) has offset equal to the sum of: - the offset of the k-1-st paramter - - the int-promoted size of the k-1-st parameter. + - the (void *)-promoted size of the k-1-st parameter. Note that the encoded offsets need not correspond to the actual placement of parameters (relative to 'self') @@ -78,6 +78,7 @@ int main(void) { Foo *foo = [[Foo alloc] init]; Class fooClass = OBJC_GETCLASS("Foo"); METHOD meth; + const char *string; meth = CLASS_GETINSTANCEMETHOD(fooClass, @selector(setRect:withInt:)); offs2 = 9999; @@ -88,8 +89,12 @@ int main(void) { meth = CLASS_GETINSTANCEMETHOD(fooClass, @selector(char:float:double:long:)); offs2 = 9999; - sscanf(meth->method_types, "v%u@%u:%uc%uf%ud%ul%u", &offs1, &offs2, &offs3, - &offs4, &offs5, &offs6, &offs7); + if (sizeof (long) == 8) + string = "v%u@%u:%uc%uf%ud%uq%u"; + else + string = "v%u@%u:%uc%uf%ud%ul%u"; + sscanf(meth->method_types, string, &offs1, &offs2, &offs3, + &offs4, &offs5, &offs6, &offs7); CHECK_IF(!offs2); [foo char:'c' float:2.3 double:3.5 long:2345L]; diff --git a/gcc/testsuite/objc.dg/encode-3.m b/gcc/testsuite/objc.dg/encode-3.m index b30b956..d32ab72 100644 --- a/gcc/testsuite/objc.dg/encode-3.m +++ b/gcc/testsuite/objc.dg/encode-3.m @@ -46,8 +46,14 @@ static void scan_initial(const char *pattern) { } int main(void) { + const char *string; + meth = [proto descriptionForInstanceMethod: @selector(char:float:double:unsigned:short:long:)]; - scan_initial("v%u@%u:%uc%uf%ud%uI%us%ul%u"); + if (sizeof (long) == 8) + string = "v%u@%u:%uc%uf%ud%uI%us%uq%u"; + else + string = "v%u@%u:%uc%uf%ud%uI%us%ul%u"; + scan_initial(string); CHECK_IF(offs3 == offs2 + sizeof(int) && offs4 == offs3 + sizeof(float)); CHECK_IF(offs5 == offs4 + sizeof(double) && offs6 == offs5 + sizeof(unsigned)); CHECK_IF(offs7 == offs6 + sizeof(int) && totsize == offs7 + sizeof(long)); |