libitm/testsuite/libitm.c/clone-1.c
raw| 1 | /* Verify that we can look up tm clone of transaction_callable |
| 2 | and transaction_pure. */ |
| 3 | |
| 4 | #include <stdlib.h> |
| 5 | #include <libitm.h> |
| 6 | |
| 7 | static int x; |
| 8 | |
| 9 | int __attribute__((transaction_pure)) pure(int i) |
| 10 | { |
| 11 | return i+2; |
| 12 | } |
| 13 | |
| 14 | int __attribute__((transaction_callable)) callable(void) |
| 15 | { |
| 16 | return ++x; |
| 17 | } |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | if (_ITM_getTMCloneSafe (&pure) != &pure) |
| 22 | abort (); |
| 23 | |
| 24 | if (_ITM_getTMCloneSafe (&callable) == NULL) |
| 25 | abort (); |
| 26 | |
| 27 | return 0; |
| 28 | } |