Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 9033 - Remove __thread from the language. #1616

Merged
merged 2 commits into from Feb 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/attrib.c
Expand Up @@ -511,7 +511,7 @@ const char *StorageClassDeclaration::stcToChars(char tmp[], StorageClass& stc)
{ STCnothrow, TOKnothrow },
{ STCpure, TOKpure },
{ STCref, TOKref },
{ STCtls, TOKtls },
{ STCtls },
{ STCgshared, TOKgshared },
{ STCproperty, TOKat, Id::property },
{ STCsafe, TOKat, Id::safe },
Expand All @@ -528,6 +528,9 @@ const char *StorageClassDeclaration::stcToChars(char tmp[], StorageClass& stc)
if (stc & tbl)
{
stc &= ~tbl;
if (tbl == STCtls) // TOKtls was removed
return "__thread";

enum TOK tok = table[i].tok;
#if DMDV2
if (tok == TOKat)
Expand Down
1 change: 0 additions & 1 deletion src/lexer.c
Expand Up @@ -2922,7 +2922,6 @@ static Keyword keywords[] =
#if DMDV2
{ "pure", TOKpure },
{ "nothrow", TOKnothrow },
{ "__thread", TOKtls },
{ "__gshared", TOKgshared },
{ "__traits", TOKtraits },
{ "__vector", TOKvector },
Expand Down
1 change: 0 additions & 1 deletion src/lexer.h
Expand Up @@ -161,7 +161,6 @@ enum TOK
TOKoverloadset,
TOKpure,
TOKnothrow,
TOKtls,
TOKgshared,
TOKline,
TOKfile,
Expand Down
5 changes: 0 additions & 5 deletions src/parse.c
Expand Up @@ -367,7 +367,6 @@ Dsymbols *Parser::parseDeclDefs(int once)
case TOKnothrow: stc = STCnothrow; goto Lstc;
case TOKpure: stc = STCpure; goto Lstc;
case TOKref: stc = STCref; goto Lstc;
case TOKtls: stc = STCtls; goto Lstc;
case TOKgshared: stc = STCgshared; goto Lstc;
//case TOKmanifest: stc = STCmanifest; goto Lstc;
case TOKat:
Expand Down Expand Up @@ -432,7 +431,6 @@ Dsymbols *Parser::parseDeclDefs(int once)
case TOKnothrow: stc = STCnothrow; goto Lstc;
case TOKpure: stc = STCpure; goto Lstc;
case TOKref: stc = STCref; goto Lstc;
case TOKtls: stc = STCtls; goto Lstc;
case TOKgshared: stc = STCgshared; goto Lstc;
//case TOKmanifest: stc = STCmanifest; goto Lstc;
case TOKat:
Expand Down Expand Up @@ -2949,7 +2947,6 @@ Dsymbols *Parser::parseDeclarations(StorageClass storage_class, unsigned char *c
case TOKnothrow: stc = STCnothrow; goto L1;
case TOKpure: stc = STCpure; goto L1;
case TOKref: stc = STCref; goto L1;
case TOKtls: stc = STCtls; goto L1;
case TOKgshared: stc = STCgshared; goto L1;
case TOKenum: stc = STCmanifest; goto L1;
case TOKat:
Expand Down Expand Up @@ -3806,7 +3803,6 @@ Statement *Parser::parseStatement(int flags)
case TOKnothrow:
case TOKpure:
case TOKref:
case TOKtls:
case TOKgshared:
case TOKat:
#endif
Expand Down Expand Up @@ -5319,7 +5315,6 @@ int Parser::skipAttributes(Token *t, Token **pt)
case TOKnothrow:
case TOKpure:
case TOKref:
case TOKtls:
case TOKgshared:
//case TOKmanifest:
break;
Expand Down
8 changes: 4 additions & 4 deletions test/runnable/imports/tlsa.d
Expand Up @@ -4,7 +4,7 @@ import std.c.stdio;

int foo()()
{
static __thread int z = 7;
static int z = 7;
return ++z;
}

Expand All @@ -13,9 +13,9 @@ int foo()()

int abc4(T)(T t)
{
static __thread T qqq; // TLS comdef
static T rrr; // comdef
static __thread T sss = 8; // TLS comdat
static T qqq; // TLS comdef
static T rrr; // comdef
static T sss = 8; // TLS comdat
static T ttt = 9; // comdat
printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt);
qqq += 2;
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/testthread.d
Expand Up @@ -7,8 +7,8 @@ version (Win32)
{
extern (C)
{
extern __thread int _tlsstart;
extern __thread int _tlsend;
extern int _tlsstart;
extern int _tlsend;
}
}

Expand Down
14 changes: 7 additions & 7 deletions test/runnable/tls.d
Expand Up @@ -3,7 +3,7 @@
import std.c.stdio;
import imports.tlsa;

__thread int x = 3;
int x = 3;

void bar()
{
Expand All @@ -28,10 +28,10 @@ void test1()

/************************************/

__thread long fooa;
__thread long foob;
__thread int bara = 0x12345678;
__thread int barb = 0x9ABCDEFF;
long fooa;
long foob;
int bara = 0x12345678;
int barb = 0x9ABCDEFF;

void test2()
{
Expand All @@ -50,9 +50,9 @@ void test2()

int abc3(T)(T t)
{
static __thread T qqq;
static T qqq;
static T rrr;
static __thread T sss = 8;
static T sss = 8;
static T ttt = 9;
printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt);
assert(sss == 8);
Expand Down
14 changes: 7 additions & 7 deletions test/runnable/tls_dup.d
Expand Up @@ -8,7 +8,7 @@
import std.c.stdio;
import imports.tlsa;

__thread int x = 3;
int x = 3;

void bar()
{
Expand All @@ -33,10 +33,10 @@ void test1()

/************************************/

__thread long fooa;
__thread long foob;
__thread int bara = 0x12345678;
__thread int barb = 0x9ABCDEFF;
long fooa;
long foob;
int bara = 0x12345678;
int barb = 0x9ABCDEFF;

void test2()
{
Expand All @@ -55,9 +55,9 @@ void test2()

int abc3(T)(T t)
{
static __thread T qqq;
static T qqq;
static T rrr;
static __thread T sss = 8;
static T sss = 8;
static T ttt = 9;
printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt);
assert(sss == 8);
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/xtest55.d
Expand Up @@ -2,7 +2,7 @@

import core.memory, std.stdio;

__thread Stuff* stuff1;
Stuff* stuff1;

struct Stuff {
uint num;
Expand Down