Re: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/tls.c Makefile

2007-04-14 Thread Chris Lattner
On Apr 11, 2007, at 11:57 AM, Lauro Ramos Venancio wrote:
> Add a TLS test.

Hi Lauro, can you please add a "Threads" subdirectory of UnitTests  
and move this testcase there?  That way we won't be linking all  
UnitTests with -lpthreads.

Thanks!

-Chris

>
> ---
> Diffs of the changes:  (+21 -0)
>
>  Makefile |1 +
>  tls.c|   20 
>  2 files changed, 21 insertions(+)
>
>
> Index: llvm-test/SingleSource/UnitTests/tls.c
> diff -c /dev/null llvm-test/SingleSource/UnitTests/tls.c:1.1
> *** /dev/null Wed Apr 11 13:56:56 2007
> --- llvm-test/SingleSource/UnitTests/tls.cWed Apr 11 13:56:46 2007
> ***
> *** 0 
> --- 1,20 
> + #include 
> + #include 
> +
> + void *f(void *a){
> +   static __thread int i = 1;
> +   i++;
> +   return (void *)i;
> + }
> +
> + int main() {
> +   pthread_t t;
> +   int ret;
> +   pthread_create(&t, NULL, f, NULL);
> +   pthread_join(t, (void **) &ret);
> +   printf("Thread 1: %d\n",ret);
> +   pthread_create(&t, NULL, f, NULL);
> +   pthread_join(t, (void **) &ret);
> +   printf("Thread 2: %d\n",ret);
> +   return 0;
> + }
>
>
> Index: llvm-test/SingleSource/UnitTests/Makefile
> diff -u llvm-test/SingleSource/UnitTests/Makefile:1.14 llvm-test/ 
> SingleSource/UnitTests/Makefile:1.15
> --- llvm-test/SingleSource/UnitTests/Makefile:1.14Tue Apr 10  
> 18:52:47 2007
> +++ llvm-test/SingleSource/UnitTests/Makefile Wed Apr 11 13:56:46 2007
> @@ -15,5 +15,6 @@
>
>  DIRS += SignlessTypes
>
> +LDFLAGS += -lpthread
>  PROGRAM_REQUIRED_TO_EXIT_OK := 1
>  include $(LEVEL)/SingleSource/Makefile.singlesrc
>
>
>
> ___
> llvm-commits mailing list
> [EMAIL PROTECTED]
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
[EMAIL PROTECTED]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/tls.c Makefile

2007-04-11 Thread Lauro Ramos Venancio


Changes in directory llvm-test/SingleSource/UnitTests:

tls.c added (r1.1)
Makefile updated: 1.14 -> 1.15
---
Log message:

Add a TLS test.


---
Diffs of the changes:  (+21 -0)

 Makefile |1 +
 tls.c|   20 
 2 files changed, 21 insertions(+)


Index: llvm-test/SingleSource/UnitTests/tls.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/tls.c:1.1
*** /dev/null   Wed Apr 11 13:56:56 2007
--- llvm-test/SingleSource/UnitTests/tls.c  Wed Apr 11 13:56:46 2007
***
*** 0 
--- 1,20 
+ #include 
+ #include 
+ 
+ void *f(void *a){
+   static __thread int i = 1;
+   i++;
+   return (void *)i;
+ }
+ 
+ int main() {
+   pthread_t t;
+   int ret;
+   pthread_create(&t, NULL, f, NULL);
+   pthread_join(t, (void **) &ret);
+   printf("Thread 1: %d\n",ret);
+   pthread_create(&t, NULL, f, NULL);
+   pthread_join(t, (void **) &ret);
+   printf("Thread 2: %d\n",ret);
+   return 0;
+ }


Index: llvm-test/SingleSource/UnitTests/Makefile
diff -u llvm-test/SingleSource/UnitTests/Makefile:1.14 
llvm-test/SingleSource/UnitTests/Makefile:1.15
--- llvm-test/SingleSource/UnitTests/Makefile:1.14  Tue Apr 10 18:52:47 2007
+++ llvm-test/SingleSource/UnitTests/Makefile   Wed Apr 11 13:56:46 2007
@@ -15,5 +15,6 @@
 
 DIRS += SignlessTypes
 
+LDFLAGS += -lpthread
 PROGRAM_REQUIRED_TO_EXIT_OK := 1
 include $(LEVEL)/SingleSource/Makefile.singlesrc



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits