Added keyword 'thread_local' to Swig.

Added testcase.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11393 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matevz Jekovec 2009-07-14 12:05:05 +00:00
commit 74d8325cdf
4 changed files with 18 additions and 3 deletions

View file

@ -404,7 +404,8 @@ CPP0X_TEST_CASES = \
cpp0x_explicit_conversion_operators \
cpp0x_raw_string_literals \
cpp0x_static_assert \
cpp0x_template_explicit
cpp0x_template_explicit \
cpp0x_thread_local
# cpp0x_constexpr # not supported by any compilers yet
# Broken C++0x test cases.

View file

@ -0,0 +1,11 @@
/* This testcase checks whether Swig correctly parses the 'thread_local'
keyword before the member type and name. */
%module cpp0x_thread_local
%inline %{
struct A {
thread_local int val;
};
%}

View file

@ -632,6 +632,8 @@ int yylex(void) {
return (FRIEND);
if (strcmp(yytext, "constexpr") == 0)
return (CONSTEXPR);
if (strcmp(yytext, "thread_local") == 0)
return (THREAD_LOCAL);
if (strcmp(yytext, "virtual") == 0)
return (VIRTUAL);
if (strcmp(yytext, "static_assert") == 0)

View file

@ -1492,8 +1492,8 @@ static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) {
%token ILLEGAL CONSTANT
%token NAME RENAME NAMEWARN EXTEND PRAGMA FEATURE VARARGS
%token ENUM
%token CLASS TYPENAME PRIVATE PUBLIC PROTECTED COLON STATIC VIRTUAL FRIEND THROW CATCH EXPLICIT CONSTEXPR
%token STATIC_ASSERT
%token CLASS TYPENAME PRIVATE PUBLIC PROTECTED COLON STATIC VIRTUAL FRIEND THROW CATCH EXPLICIT
%token STATIC_ASSERT CONSTEXPR THREAD_LOCAL /* C++0x keywords */
%token USING
%token <node> NAMESPACE
%token NATIVE INLINE
@ -4507,6 +4507,7 @@ storage_class : EXTERN { $$ = "extern"; }
| FRIEND { $$ = "friend"; }
| EXPLICIT { $$ = "explicit"; }
| CONSTEXPR { $$ = "constexpr"; }
| THREAD_LOCAL { $$ = "thread_local"; }
| empty { $$ = 0; }
;