2
0

destructor.c 444 B

12345678910111213141516171819202122
  1. #include <stdio.h>
  2. #include "test_helpers.h"
  3. __attribute__((destructor))
  4. void destructor_no_priority(void) {
  5. puts("destructor (no priority)");
  6. }
  7. #define TEST(__priority) \
  8. __attribute__((destructor(__priority))) \
  9. void destructor_priority_##__priority(void) { \
  10. puts("destructor ("#__priority")"); \
  11. }
  12. TEST(101)
  13. TEST(102)
  14. TEST(103)
  15. TEST(104)
  16. int main(void) {
  17. puts("main");
  18. }