Overview
Comment: | OFInvocation: Fix void return |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7c1614461e60a570709ba582d6dcb81c |
User & Date: | js on 2018-11-26 22:04:03 |
Other Links: | manifest | tags |
Context
2018-11-26
| ||
22:08 | invocation: Add a shared header for some defines check-in: f133454532 user: js tags: trunk | |
22:04 | OFInvocation: Fix void return check-in: 7c1614461e user: js tags: trunk | |
2018-11-24
| ||
13:02 | Fix compilation with --disable-unicode-tables check-in: efedce10f7 user: js tags: trunk | |
Changes
Modified src/OFInvocation.m from [366a242dd0] to [d943af9714].
︙ | ︙ | |||
60 61 62 63 64 65 66 | capacity: 1]; [data increaseCountBy: 1]; [_arguments addObject: data]; } typeEncoding = [_methodSignature methodReturnType]; typeSize = of_sizeof_type_encoding(typeEncoding); | > > | > | | > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | capacity: 1]; [data increaseCountBy: 1]; [_arguments addObject: data]; } typeEncoding = [_methodSignature methodReturnType]; typeSize = of_sizeof_type_encoding(typeEncoding); if (typeSize > 0) { _returnValue = [[OFMutableData alloc] initWithItemSize: typeSize capacity: 1]; [_returnValue increaseCountBy: 1]; } objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |
Modified src/invocation/invoke-x86_64.m from [6c3222c447] to [d401c0dd7a].
︙ | ︙ | |||
324 325 326 327 328 329 330 331 332 333 334 335 336 337 | typeEncoding = [methodSignature methodReturnType]; if (*typeEncoding == 'r') typeEncoding++; switch (*typeEncoding) { case 'c': case 'C': case 'i': case 'I': case 's': case 'S': case 'l': | > | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | typeEncoding = [methodSignature methodReturnType]; if (*typeEncoding == 'r') typeEncoding++; switch (*typeEncoding) { case 'v': case 'c': case 'C': case 'i': case 'I': case 's': case 'S': case 'l': |
︙ | ︙ | |||
377 378 379 380 381 382 383 384 385 386 387 388 389 390 | free(context); @throw [OFInvalidFormatException exception]; } of_invocation_call(context); switch (*typeEncoding) { #define CASE_GPR(encoding, type) \ case encoding: \ { \ type tmp = (type)context->GPR[NUM_GPR_IN]; \ [invocation setReturnValue: &tmp]; \ } \ break; | > > | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | free(context); @throw [OFInvalidFormatException exception]; } of_invocation_call(context); switch (*typeEncoding) { case 'v': break; #define CASE_GPR(encoding, type) \ case encoding: \ { \ type tmp = (type)context->GPR[NUM_GPR_IN]; \ [invocation setReturnValue: &tmp]; \ } \ break; |
︙ | ︙ |
Modified tests/OFInvocationTests.m from [3eeb41421c] to [16bfacf2a2].
︙ | ︙ | |||
42 43 44 45 46 47 48 | : (unsigned int)i : (struct test_struct *)ptr : (struct test_struct)st { return st; } | > > > > > | | | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | : (unsigned int)i : (struct test_struct *)ptr : (struct test_struct)st { return st; } - (void)invocationTestMethod2: (id)obj { assert(obj == self); } - (int)invocationTestMethod3: (int)i1 : (int)i2 : (int)i3 : (int)i4 : (int)i5 : (int)i6 : (int)i7 : (int)i8 : (int)i9 : (int)i10 : (int)i11 : (int)i12 : (int)i13 : (int)i14 : (int)i15 : (int)i16 { return (i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10 + i11 + i12 + i13 + i14 + i15 + i16) / 16; } - (double)invocationTestMethod4: (double)d1 : (double)d2 : (double)d3 : (double)d4 : (double)d5 : (double)d6 : (double)d7 : (double)d8 : (double)d9 : (double)d10 : (double)d11 : (double)d12 : (double)d13 : (double)d14 : (double)d15 : (double)d16 { return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } - (float)invocationTestMethod5: (double)d1 : (float)f2 : (float)f3 : (float)f4 : (float)f5 : (float)f6 : (float)f7 : (float)f8 : (float)f9 : (double)d10 : (float)f11 : (float)f12 : (float)f13 : (float)f14 : (float)f15 : (float)f16 { return (float)((d1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + d10 + f11 + f12 + f13 + f14 + f15 + f16) / 16); } - (long double)invocationTestMethod6: (long double)d1 : (long double)d2 : (long double)d3 : (long double)d4 : (long double)d5 : (long double)d6 : (long double)d7 : (long double)d8 |
︙ | ︙ | |||
127 128 129 130 131 132 133 | : (long double)d16 { return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } #if defined(HAVE_COMPLEX_H) && !defined(__STDC_NO_COMPLEX__) | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | : (long double)d16 { return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } #if defined(HAVE_COMPLEX_H) && !defined(__STDC_NO_COMPLEX__) - (complex double)invocationTestMethod7: (complex float)c1 : (complex double)c2 : (complex float)c3 : (complex double)c4 : (complex float)c5 : (complex double)c6 : (complex float)c7 : (complex double)c8 |
︙ | ︙ | |||
165 166 167 168 169 170 171 | OF_ENSURE(creal(c15) == 15.0 && cimag(c15) == 7.5); OF_ENSURE(creal(c16) == 16.0 && cimag(c16) == 8.0); return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } | | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | OF_ENSURE(creal(c15) == 15.0 && cimag(c15) == 7.5); OF_ENSURE(creal(c16) == 16.0 && cimag(c16) == 8.0); return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } - (complex long double)invocationTestMethod8: (complex double)c1 : (complex float)c2 : (complex long double)c3 : (complex double)c4 : (complex float)c5 : (complex long double)c6 : (complex double)c7 : (complex float)c8 |
︙ | ︙ | |||
206 207 208 209 210 211 212 | return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } #endif #ifdef __SIZEOF_INT128__ __extension__ | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } #endif #ifdef __SIZEOF_INT128__ __extension__ - (__int128)invocationTestMethod9: (int)i1 : (__int128)i2 : (__int128)i3 : (__int128)i4 : (int)i5 : (__int128)i6 : (__int128)i7 : (__int128)i8 |
︙ | ︙ | |||
308 309 310 311 312 313 314 | TEST(@"-[getArgument:atIndex:] #4", R([invocation getArgument: &st2 atIndex: 5]) && memcmp(&st, &st2, sizeof(st)) == 0) #ifdef OF_INVOCATION_CAN_INVOKE /* -[invoke] #1 */ | | > > > > > > > > > > > > > > | | | | | | | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | TEST(@"-[getArgument:atIndex:] #4", R([invocation getArgument: &st2 atIndex: 5]) && memcmp(&st, &st2, sizeof(st)) == 0) #ifdef OF_INVOCATION_CAN_INVOKE /* -[invoke] #1 */ selector = @selector(invocationTestMethod2:); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; [invocation setArgument: &self atIndex: 2]; TEST(@"-[invoke] #1", R([invocation invoke])) /* -[invoke] #2 */ selector = @selector(invocationTestMethod3::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) [invocation setArgument: &j atIndex: j + 1]; int intResult; TEST(@"-[invoke] #2", R([invocation invoke]) && R([invocation getReturnValue: &intResult]) && intResult == 8) /* -[invoke] #3 */ selector = @selector(invocationTestMethod4::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) { double d = j; [invocation setArgument: &d atIndex: j + 1]; } double doubleResult; TEST(@"-[invoke] #3", R([invocation invoke]) && R([invocation getReturnValue: &doubleResult]) && doubleResult == 8.5) /* -[invoke] #4 */ selector = @selector(invocationTestMethod5::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
369 370 371 372 373 374 375 | atIndex: j + 1]; else [invocation setArgument: &f atIndex: j + 1]; } float floatResult; | | | | | | | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | atIndex: j + 1]; else [invocation setArgument: &f atIndex: j + 1]; } float floatResult; TEST(@"-[invoke] #4", R([invocation invoke]) && R([invocation getReturnValue: &floatResult]) && floatResult == 8.5) /* Only when encoding long doubles is supported */ if (strcmp(@encode(double), @encode(long double)) != 0) { /* -[invoke] #5 */ selector = @selector(invocationTestMethod6::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) { long double d = j; [invocation setArgument: &d atIndex: j + 1]; } long double longDoubleResult; TEST(@"-[invoke] #5", R([invocation invoke]) && R([invocation getReturnValue: &longDoubleResult]) && longDoubleResult == 8.5) } # if defined(HAVE_COMPLEX_H) && !defined(__STDC_NO_COMPLEX__) /* -[invoke] #6 */ selector = @selector(invocationTestMethod7::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
420 421 422 423 424 425 426 | atIndex: j + 1]; else [invocation setArgument: &cd atIndex: j + 1]; } complex double complexDoubleResult; | | | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | atIndex: j + 1]; else [invocation setArgument: &cd atIndex: j + 1]; } complex double complexDoubleResult; TEST(@"-[invoke] #6", R([invocation invoke]) && R([invocation getReturnValue: &complexDoubleResult]) && complexDoubleResult == 8.5 + 4.25 * I) /* Only when encoding complex long doubles is supported */ if (strcmp(@encode(complex double), @encode(complex long double)) != 0) { /* -[invoke] #7 */ selector = @selector(invocationTestMethod8::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
459 460 461 462 463 464 465 | [invocation setArgument: &cf atIndex: j + 1]; break; } } complex long double complexLongDoubleResult; | | | | | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | [invocation setArgument: &cf atIndex: j + 1]; break; } } complex long double complexLongDoubleResult; TEST(@"-[invoke] #7", R([invocation invoke]) && R([invocation getReturnValue: &complexLongDoubleResult]) && complexLongDoubleResult == 8.5 + 4.25 * I) } # endif # ifdef __SIZEOF_INT128__ /* -[invoke] #8 */ selector = @selector(invocationTestMethod9::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
490 491 492 493 494 495 496 | atIndex: j + 1]; else [invocation setArgument: &i128 atIndex: j + 1]; } __extension__ __int128 int128Result; | | | 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | atIndex: j + 1]; else [invocation setArgument: &i128 atIndex: j + 1]; } __extension__ __int128 int128Result; TEST(@"-[invoke] #8", R([invocation invoke]) && R([invocation getReturnValue: &int128Result]) && int128Result == __extension__ ((__int128)0xFFFFFFFFFFFFFFFF << 64) + 8) # endif #endif [pool drain]; } @end |