this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

runtest: use clang instead of gcc, adding TLS support tests

+73 -2
+2 -2
tests/runtest.cpp
··· 310 310 throw std::runtime_error("Unsupported file name"); 311 311 312 312 if (!strcmp(suffix, ".c") || !strcmp(suffix, ".m")) 313 - return "gcc"; 313 + return "clang"; 314 314 else if (!strcmp(suffix, ".cpp") || !strcmp(suffix, ".mm")) 315 - return "g++"; 315 + return "clang++"; 316 316 else 317 317 throw std::runtime_error("Unsupported file name"); 318 318 }
+26
tests/src/tls1.c
··· 1 + #include <stdio.h> 2 + #include <pthread.h> 3 + 4 + __thread static int var = 123; 5 + 6 + void* printThread(void* v); 7 + 8 + int main() 9 + { 10 + printf("main: var = %d\n", var); 11 + var = 321; 12 + printf("main: var = %d\n", var); 13 + 14 + pthread_t pth; 15 + pthread_create(&pth, NULL, printThread, NULL); 16 + pthread_join(pth, NULL); 17 + 18 + return 0; 19 + } 20 + 21 + void* printThread(void* v) 22 + { 23 + printf("thread: var = %d\n", var); 24 + return NULL; 25 + } 26 +
+45
tests/src/tls2.cpp
··· 1 + #include <stdio.h> 2 + #include <pthread.h> 3 + 4 + void* printThread(void* v); 5 + 6 + struct SimpleStruct 7 + { 8 + SimpleStruct(); 9 + ~SimpleStruct(); 10 + 11 + int val; 12 + }; 13 + 14 + __thread static SimpleStruct var; 15 + 16 + int main() 17 + { 18 + printf("main: var = %d\n", var.val); 19 + var.val = 321; 20 + printf("main: var = %d\n", var.val); 21 + 22 + pthread_t pth; 23 + pthread_create(&pth, NULL, printThread, NULL); 24 + pthread_join(pth, NULL); 25 + 26 + return 0; 27 + } 28 + 29 + SimpleStruct::SimpleStruct() 30 + { 31 + puts("Constructor called"); 32 + val = 123; 33 + } 34 + 35 + SimpleStruct::~SimpleStruct() 36 + { 37 + puts("Destructor called"); 38 + } 39 + 40 + void* printThread(void* v) 41 + { 42 + printf("thread: var = %d <- this seems to be broken on all platforms\n", var.val); 43 + return NULL; 44 + } 45 +