]> git.pld-linux.org Git - packages/gcc.git/blob - gcc32-tls3.patch
- typo
[packages/gcc.git] / gcc32-tls3.patch
1 2002-08-06  Aldy Hernandez  <aldyh@redhat.com>
2
3         * c-decl.c (duplicate_decls): Error out for incompatible TLS
4         declarations.
5
6         * testsuite/gcc.dg/tls/diag-3.c: New.
7
8 *** gcc/c-decl.c        1 Aug 2002 06:20:30 -0000       1.344
9 --- gcc/c-decl.c        7 Aug 2002 01:01:55 -0000
10 *************** duplicate_decls (newdecl, olddecl, diffe
11 *** 1673,1678 ****
12 --- 1673,1692 ----
13         if (TREE_CODE (newdecl) == VAR_DECL)
14         DECL_INITIAL (newdecl) = 0;
15       }
16 +   /* TLS cannot follow non-TLS declaration.  */
17 +   else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL
18 +          && !DECL_THREAD_LOCAL (olddecl) && DECL_THREAD_LOCAL (newdecl))
19 +     {
20 +       error_with_decl (newdecl, "thread-local declaration of `%s' follows non thread-local declaration");
21 +       error_with_decl (olddecl, "previous declaration of `%s'");
22 +     }
23 +   /* non-TLS declaration cannot follow TLS declaration.  */
24 +   else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL
25 +          && DECL_THREAD_LOCAL (olddecl) && !DECL_THREAD_LOCAL (newdecl))
26 +     {
27 +       error_with_decl (newdecl, "non thread-local declaration of `%s' follows thread-local declaration");
28 +       error_with_decl (olddecl, "previous declaration of `%s'");
29 +     }
30     else
31       {
32         errmsg = redeclaration_error_message (newdecl, olddecl);
33 *** gcc/testsuite/gcc.dg/tls/diag-3.c   1 Jan 1970 00:00:00 -0000
34 --- gcc/testsuite/gcc.dg/tls/diag-3.c   7 Aug 2002 01:01:55 -0000
35 ***************
36 *** 0 ****
37 --- 1,10 ----
38 + /* Report invalid extern and __thread combinations.  */
39
40 + extern int j;         /* { dg-error "previous declaration" } */
41 + __thread int j;               /* { dg-error "thread-local declaration" } */
42
43 + extern __thread int i;        /* { dg-error "previous declaration" } */
44 + int i;                        /* { dg-error "non thread-local" } */
45
46 + extern __thread int k;        /* This is fine.  */
47 + __thread int k;
48
This page took 0.05953 seconds and 3 git commands to generate.