Back to index

glibc  2.9
tst-tls10.c
Go to the documentation of this file.
00001 #include "tst-tls10.h"
00002 
00003 #ifdef USE_TLS__THREAD
00004 __thread int dummy __attribute__((visibility ("hidden"))) = 12;
00005 __thread struct A local = { 1, 2, 3 };
00006 #endif
00007 
00008 #define CHECK(N, S)                              \
00009   p = f##N##a ();                                \
00010   if (p->a != S || p->b != S + 1 || p->c != S + 2)      \
00011     abort ()
00012 
00013 int
00014 main (void)
00015 {
00016 #ifdef USE_TLS__THREAD
00017   struct A *p;
00018   if (local.a != 1 || local.b != 2 || local.c != 3)
00019     abort ();
00020   if (a1.a != 4 || a1.b != 5 || a1.c != 6)
00021     abort ();
00022   if (a2.a != 22 || a2.b != 23 || a2.c != 24)
00023     abort ();
00024   if (a3.a != 10 || a3.b != 11 || a3.c != 12)
00025     abort ();
00026   if (a4.a != 25 || a4.b != 26 || a4.c != 27)
00027     abort ();
00028   check1 ();
00029   check2 ();
00030   if (f1a () != &a1 || f2a () != &a2 || f3a () != &a3 || f4a () != &a4)
00031     abort ();
00032   CHECK (5, 16);
00033   CHECK (6, 19);
00034   if (f7a () != &a2 || f8a () != &a4)
00035     abort ();
00036   CHECK (9, 28);
00037   CHECK (10, 31);
00038 #endif
00039   exit (0);
00040 }