imageorder2.m 590 B

123456789101112131415161718192021222324252627282930313233
  1. #include "test.h"
  2. #include "imageorder.h"
  3. static void c2(void) __attribute__((constructor));
  4. static void c2(void)
  5. {
  6. testassert(state == 2); // +load before C/C++
  7. testassert(cstate == 1);
  8. cstate = 2;
  9. }
  10. #if __clang__
  11. #pragma clang diagnostic push
  12. #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
  13. #endif
  14. @implementation Super (cat2)
  15. +(void) method {
  16. fail("+[Super(cat2) method] not replaced!");
  17. }
  18. +(void) method2 {
  19. state = 2;
  20. }
  21. +(void) load {
  22. testassert(state == 1);
  23. state = 2;
  24. }
  25. @end
  26. #if __clang__
  27. #pragma clang diagnostic pop
  28. #endif