Add support for extern "C++" - no warning should be issued as was previously occurring

This commit is contained in:
William S Fulton 2013-02-08 18:55:16 +00:00
commit 8778724768
5 changed files with 16 additions and 2 deletions

View file

@ -507,7 +507,7 @@ CPP0X_TEST_CASES = \
# cpp0x_inheriting_constructors \ # not supported by gcc-4.7
# cpp0x_hash_tables \ # not fully implemented yet
# cpp0x_result_of \ # SWIG does not support
# cpp0x_thread_local \ # not supported by any compiler yet
# cpp0x_thread_local \ # needs gcc-4.8
# Broken C++0x test cases.
CPP0X_TEST_BROKEN =

View file

@ -16,6 +16,7 @@ thread_local static int tsval;
extern thread_local int etval;
thread_local extern int teval;
extern "C" thread_local int ectval;
extern "C++" thread_local int ecpptval;
thread_local int ThreadLocals::stval = 11;
thread_local int ThreadLocals::tsval = 22;
@ -28,4 +29,5 @@ thread_local const int ThreadLocals::tscval99;
thread_local int etval = 33;
thread_local int teval = 44;
thread_local int ectval = 55;
thread_local int ecpptval = 66;
%}

View file

@ -43,5 +43,9 @@ public class cpp0x_thread_local_runme {
cpp0x_thread_local.setEctval(-55);
if (cpp0x_thread_local.getEctval() != -55)
throw new RuntimeException();
cpp0x_thread_local.setEcpptval(-66);
if (cpp0x_thread_local.getEcpptval() != -66)
throw new RuntimeException();
}
}

View file

@ -32,3 +32,7 @@ cvar.ectval = -66
if cvar.ectval != -66:
raise RuntimeError
cvar.ecpptval = -66
if cvar.ecpptval != -66:
raise RuntimeError

View file

@ -5027,9 +5027,11 @@ anon_bitfield_type : primitive_type { $$ = $1;
* ====================================================================== */
storage_class : EXTERN { $$ = "extern"; }
| EXTERN string {
| EXTERN string {
if (strcmp($2,"C") == 0) {
$$ = "externc";
} else if (strcmp($2,"C++") == 0) {
$$ = "extern";
} else {
Swig_warning(WARN_PARSE_UNDEFINED_EXTERN,cparse_file, cparse_line,"Unrecognized extern type \"%s\".\n", $2);
$$ = 0;
@ -5038,6 +5040,8 @@ storage_class : EXTERN { $$ = "extern"; }
| EXTERN string THREAD_LOCAL {
if (strcmp($2,"C") == 0) {
$$ = "externc thread_local";
} else if (strcmp($2,"C++") == 0) {
$$ = "extern thread_local";
} else {
Swig_warning(WARN_PARSE_UNDEFINED_EXTERN,cparse_file, cparse_line,"Unrecognized extern type \"%s\".\n", $2);
$$ = 0;