From 678937db247e4fceadbdc8f68d2c1220fe6c9067 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 2 Jun 2015 07:27:03 +0100 Subject: [PATCH 01/15] Appveyor upgrade to cygwin on stable server Appveyor now has cygwin on their stable OS --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index e84bf6c88..aa69719d8 100755 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ os: -- Unstable +- Windows Server 2012 R2 platform: - x86 From 117f6d0026ae0e52286c1e1a3750c682d081b53c Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 9 Jun 2015 07:49:25 +0100 Subject: [PATCH 02/15] Fix C++11 type aliasing seg fault. Closes #424 --- CHANGES.current | 3 ++ Examples/test-suite/common.mk | 1 + Examples/test-suite/cpp11_type_aliasing.i | 46 +++++++++++++++++++ .../java/cpp11_type_aliasing_runme.java | 20 ++++++++ Source/CParse/parser.y | 4 +- 5 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 Examples/test-suite/cpp11_type_aliasing.i create mode 100644 Examples/test-suite/java/cpp11_type_aliasing_runme.java diff --git a/CHANGES.current b/CHANGES.current index a9847ac6f..542f6c1a5 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.6 (in progress) =========================== +2015-06-09: wsfulton + Fix seg fault processing C++11 type aliasing. Issue #424. + 2015-05-28: wsfulton [Python] Add new feature "python:cdefaultargs" to control default argument code generation. By default, SWIG attempts to convert C/C++ default argument values diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 5fd09566e..4e3b52fe0 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -543,6 +543,7 @@ CPP11_TEST_CASES = \ cpp11_template_explicit \ cpp11_template_typedefs \ cpp11_type_traits \ + cpp11_type_aliasing \ cpp11_uniform_initialization \ cpp11_unrestricted_unions \ cpp11_userdefined_literals \ diff --git a/Examples/test-suite/cpp11_type_aliasing.i b/Examples/test-suite/cpp11_type_aliasing.i new file mode 100644 index 000000000..8ddbc3bdc --- /dev/null +++ b/Examples/test-suite/cpp11_type_aliasing.i @@ -0,0 +1,46 @@ +%module cpp11_type_aliasing + +// Type aliasing seg fault : Github issue #424 + +%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) Target; + +%inline %{ + +namespace Halide { + +struct Target { + int bits; + Target(int bits=32) : bits(bits) {} +}; + +class NamesInterface { +public: + using Target = Halide::Target; +}; + +Target get_host_target() { + return Target(); +} + +namespace Internal { + +template class GeneratorParam { + T value; +public: + GeneratorParam(const char *name, const T &v) : value(v) {} + + T getValue() { + return value; + } +}; + +class GeneratorBase : public NamesInterface { +public: + GeneratorParam target{ "target", Halide::get_host_target() }; +}; + +} +} +%} + +%template(Halide_Target) Halide::Internal::GeneratorParam; diff --git a/Examples/test-suite/java/cpp11_type_aliasing_runme.java b/Examples/test-suite/java/cpp11_type_aliasing_runme.java new file mode 100644 index 000000000..0db1df372 --- /dev/null +++ b/Examples/test-suite/java/cpp11_type_aliasing_runme.java @@ -0,0 +1,20 @@ +import cpp11_type_aliasing.*; + +public class cpp11_type_aliasing_runme { + + static { + try { + System.loadLibrary("cpp11_type_aliasing"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + Halide_Target ht = new GeneratorBase().getTarget(); + Target x = ht.getValue(); + if (x.getBits() != 32) + throw new RuntimeException("Incorrect bits"); + } +} diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 39b859d68..c6b1d5ee4 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -2850,10 +2850,10 @@ c_declaration : c_decl { Swig_warning(WARN_CPP11_LAMBDA, cparse_file, cparse_line, "Lambda expressions and closures are not fully supported yet.\n"); SWIG_WARN_NODE_END($$); } - | USING idcolon EQUAL { - skip_decl(); + | USING idcolon EQUAL idcolon { $$ = new_node("using"); Setattr($$,"name",$2); + Setattr($$,"uname",$4); add_symbols($$); SWIG_WARN_NODE_BEGIN($$); Swig_warning(WARN_CPP11_ALIAS_DECLARATION, cparse_file, cparse_line, "The 'using' keyword in type aliasing is not fully supported yet.\n"); From efa84dab7cd9caae1175546558c49b8662384f0d Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 9 Jun 2015 07:54:47 +0100 Subject: [PATCH 03/15] Fix warning display of types associated with 'using' and templates. --- .../test-suite/errors/cpp_using_type_aliasing.i | 13 +++++++++++++ .../errors/cpp_using_type_aliasing.stderr | 3 +++ Source/Swig/symbol.c | 8 ++++---- 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 Examples/test-suite/errors/cpp_using_type_aliasing.i create mode 100644 Examples/test-suite/errors/cpp_using_type_aliasing.stderr diff --git a/Examples/test-suite/errors/cpp_using_type_aliasing.i b/Examples/test-suite/errors/cpp_using_type_aliasing.i new file mode 100644 index 000000000..df65dbd3d --- /dev/null +++ b/Examples/test-suite/errors/cpp_using_type_aliasing.i @@ -0,0 +1,13 @@ +%module cpp_using_type_aliasing + +namespace Space { + template struct Okay { + }; + struct User { + protected: + using OkayInt = Okay; + }; + struct Derived : User { + Okay ff(); + }; +}; diff --git a/Examples/test-suite/errors/cpp_using_type_aliasing.stderr b/Examples/test-suite/errors/cpp_using_type_aliasing.stderr new file mode 100644 index 000000000..3f256652f --- /dev/null +++ b/Examples/test-suite/errors/cpp_using_type_aliasing.stderr @@ -0,0 +1,3 @@ +cpp_using_type_aliasing.i:8: Warning 341: The 'using' keyword in type aliasing is not fully supported yet. +cpp_using_type_aliasing.i:8: Warning 315: Nothing known about 'Okay< int >'. +cpp_using_type_aliasing.i:8: Warning 315: Nothing known about 'Okay< int >'. diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index 2202f61c6..d72451a14 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -1149,7 +1149,7 @@ Node *Swig_symbol_clookup(const_String_or_char_ptr name, Symtab *n) { Symtab *un = Getattr(s, "sym:symtab"); Node *ss = (!Equal(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */ if (!ss) { - Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, "uname")); + Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname"))); } s = ss; } @@ -1221,7 +1221,7 @@ Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (* Node *ss; ss = Swig_symbol_clookup(Getattr(s, "uname"), Getattr(s, "sym:symtab")); if (!ss && !checkfunc) { - Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, "uname")); + Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname"))); } s = ss; } @@ -1272,7 +1272,7 @@ Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) { while (s && Checkattr(s, "nodeType", "using")) { Node *ss = Swig_symbol_clookup_local(Getattr(s, "uname"), Getattr(s, "sym:symtab")); if (!ss) { - Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, "uname")); + Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname"))); } s = ss; } @@ -1320,7 +1320,7 @@ Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n, while (s && Checkattr(s, "nodeType", "using")) { Node *ss = Swig_symbol_clookup_local_check(Getattr(s, "uname"), Getattr(s, "sym:symtab"), checkfunc); if (!ss && !checkfunc) { - Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, "uname")); + Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname"))); } s = ss; } From 2b9b007027961cf79088af2f38398e8c33dc3c4c Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 11 Jun 2015 07:42:50 +0100 Subject: [PATCH 04/15] C# -outfile cosmetic code fixes --- Source/Modules/csharp.cxx | 57 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index ad27a5bea..38afc7357 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -248,16 +248,16 @@ public: } else if (strcmp(argv[i], "-oldvarnames") == 0) { Swig_mark_arg(i); old_variable_names = true; - } else if (strcmp(argv[i], "-outfile") == 0) { - if (argv[i + 1]) { - output_file = NewString(""); - Printf(output_file, argv[i + 1]); - Swig_mark_arg(i); - Swig_mark_arg(i + 1); - i++; - } else { - Swig_arg_error(); - } + } else if (strcmp(argv[i], "-outfile") == 0) { + if (argv[i + 1]) { + output_file = NewString(""); + Printf(output_file, argv[i + 1]); + Swig_mark_arg(i); + Swig_mark_arg(i + 1); + i++; + } else { + Swig_arg_error(); + } } else if (strcmp(argv[i], "-help") == 0) { Printf(stdout, "%s\n", usage); } @@ -465,7 +465,7 @@ public: Printf(f_im, "}\n"); addCloseNamespace(0, f_im); - if(f_im != f_single_out) + if (f_im != f_single_out) Delete(f_im); f_im = NULL; } @@ -508,7 +508,7 @@ public: Printf(f_module, "}\n"); addCloseNamespace(0, f_module); - if(f_module != f_single_out) + if (f_module != f_single_out) Delete(f_module); f_module = NULL; } @@ -609,7 +609,7 @@ public: f_directors_h = NULL; } - if(f_single_out) { + if (f_single_out) { Dump(f_single_out, f_begin); Delete(f_single_out); f_single_out = NULL; @@ -649,12 +649,12 @@ public: * /.cs * ----------------------------------------------------------------------------- */ - File *getOutputFile(const String* dir, String* name) { - if(output_file) { - if(!f_single_out) { + File *getOutputFile(const String *dir, const String *name) { + if (output_file) { + if (!f_single_out) { String *filen = NewStringf("%s%s", SWIG_output_directory(), output_file); f_single_out = NewFile(filen, "w", SWIG_output_files()); - if(!f_single_out) { + if (!f_single_out) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } @@ -668,7 +668,7 @@ public: } else { String *filen = NewStringf("%s%s.cs", dir, name); File *f = NewFile(filen, "w", SWIG_output_files()); - if(!f) { + if (!f) { FileErrorDisplay(f); SWIG_exit(EXIT_FAILURE); } @@ -1132,7 +1132,7 @@ public: scope = NewString(""); if (nspace) Printf(scope, "%s", nspace); - if (Node* cls = getCurrentClass()) { + if (Node *cls = getCurrentClass()) { if (Node *outer = Getattr(cls, "nested:outer")) { String *outerClassesPrefix = Copy(Getattr(outer, "sym:name")); for (outer = Getattr(outer, "nested:outer"); outer != 0; outer = Getattr(outer, "nested:outer")) { @@ -1252,7 +1252,7 @@ public: "\n", enum_code, "\n", NIL); addCloseNamespace(nspace, f_enum); - if(f_enum != f_single_out) + if (f_enum != f_single_out) Delete(f_enum); f_enum = NULL; Delete(output_directory); @@ -1954,7 +1954,6 @@ public: } } - // Each outer proxy class goes into a separate file if (!has_outerclass) { String *output_directory = outputDirectory(nspace); f_proxy = getOutputFile(output_directory, proxy_class_name); @@ -2017,7 +2016,7 @@ public: if (!has_outerclass) { Printf(f_proxy, "}\n"); addCloseNamespace(nspace, f_proxy); - if(f_proxy != f_single_out) + if (f_proxy != f_single_out) Delete(f_proxy); f_proxy = NULL; } else { @@ -3278,7 +3277,7 @@ public: Printv(f_swigtype, swigtype, NIL); addCloseNamespace(0, f_swigtype); - if(f_swigtype != f_single_out) + if (f_swigtype != f_single_out) Delete(f_swigtype); f_swigtype = NULL; Delete(swigtype); @@ -4297,10 +4296,10 @@ extern "C" Language *swig_csharp(void) { const char *CSHARP::usage = "\ C# Options (available with -csharp)\n\ - -dllimport
- Override DllImport attribute name to
\n\ - -namespace - Generate wrappers into C# namespace \n\ - -noproxy - Generate the low-level functional interface instead\n\ - of proxy classes\n\ - -oldvarnames - Old intermediary method names for variable wrappers\n\ - -outfile - Write all C# to a single file located in the output directory\n\ + -dllimport
- Override DllImport attribute name to
\n\ + -namespace - Generate wrappers into C# namespace \n\ + -noproxy - Generate the low-level functional interface instead\n\ + of proxy classes\n\ + -oldvarnames - Old intermediary method names for variable wrappers\n\ + -outfile - Write all C# into a single located in the output directory\n\ \n"; From c1a18992ccc56bb85cb33e0a4e366608929b68de Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 11 Jun 2015 07:43:26 +0100 Subject: [PATCH 05/15] Add in all C# command line options to the docs --- Doc/Manual/CSharp.html | 66 +++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html index 28d6d2b2e..0c0d98c0e 100644 --- a/Doc/Manual/CSharp.html +++ b/Doc/Manual/CSharp.html @@ -14,7 +14,7 @@
  • SWIG 2 Compatibility Differences to the Java module
  • Void pointers @@ -37,7 +37,7 @@
  • Directors implementation
  • Director caveats -
  • Multiples modules +
  • Multiple modules
  • C# Typemap examples
    • Memory management when returning references to member variables @@ -82,26 +82,58 @@ Monodoc, available from the Mono project, has a very useful section titled using directives in generated code. This breaks backwards compatibility with typemaps, pragmas, etc written for use with SWIG 2 that assume the presence of using System; or using System.Runtime.InteropServices; directives in the intermediate class imports, module imports, or proxy imports. SWIG 3 supports backwards compatibility though the use of the SWIG2_CSHARP macro. If SWIG2_CSHARP is defined, SWIG 3 generates using directives in the intermediate class, module class, and proxy class code similar to those generated by SWIG 2. This can be done without modifying any of the input code by passing the -DSWIG2_CSHARP commandline parameter when executing swig.

      -

      20.1.2 C# Command Line Options

      - -

      Additional command line options that can be used to control code generation:

      +

      20.1.2 Additional command line options

      --outfile <filename>
      -This command line will instruct the C# module to write all generated C# code to <filename> (located in the output directory) instead of creating separate files for generated classes.
      -Caveats: -

        +The following table lists the additional commandline options available for the C# module. They can also be seen by using: +

        -
      • -The file extension (.cs) will not be automatically be added and needs to be provided. -
      • +
        +swig -csharp -help 
        +
        -
      • -Due to possible compiler limits it is not advisable to use -outfile when generating wrappers for big projects. -
      • +

        -
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      C# specific options
      -dllimport <dl>Override DllImport attribute name to <dl>
      -namespace <nm>Generate wrappers into C# namespace <nm>
      -noproxyGenerate the low-level functional interface instead of proxy classes
      -oldvarnamesOld intermediary method names for variable wrappers
      -outfile <file>Write all C# into a single <file> located in the output directory +
      + +

      +The -outfile option combines all the generated C# code into a single output file instead of creating multiple C# files. +The default, when this option is not provided, is to generate separate .cs files for the module class, +intermediary class and each of the generated proxy and type wrapper classes. +Note that the file extension (.cs) will not be automatically added and needs to be provided. +Due to possible compiler limits it is not advisable to use -outfile for large projects.

      20.2 Differences to the Java module

      @@ -1707,7 +1739,7 @@ However, a call from C# to CSharpDefaults.DefaultMethod() will of cours should pass the call on to CSharpDefaults.DefaultMethod(int)using the C++ default value, as shown above.

      -

      20.7 Multiples modules

      +

      20.7 Multiple modules

      From 50b7a0410cc2ff44825b1860b203373725346d79 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 11 Jun 2015 07:47:42 +0100 Subject: [PATCH 06/15] changes file update for -outfile --- CHANGES.current | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.current b/CHANGES.current index a9847ac6f..94ed20271 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.6 (in progress) =========================== +2015-06-11: sghirate + [C#] Patch #427 adds in new command line option -outfile to combine all the + generated C# code into a single file. + 2015-05-28: wsfulton [Python] Add new feature "python:cdefaultargs" to control default argument code generation. By default, SWIG attempts to convert C/C++ default argument values From 8bd6e596d1eabca437f78e980c4fc8227f07adcd Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 11 Jun 2015 07:57:37 +0100 Subject: [PATCH 07/15] Cosmetics - remove references to Java in C# module --- Source/Modules/csharp.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 38afc7357..9193cd34b 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -636,7 +636,7 @@ public: Swig_banner_target_lang(f, "//"); Printf(f, "//------------------------------------------------------------------------------\n\n"); } - + /* ----------------------------------------------------------------------------- * getOutputFile() * @@ -3375,7 +3375,7 @@ public: /* ----------------------------------------------------------------------------- * outputDirectory() * - * Return the directory to use for generating Java classes/enums and create the + * Return the directory to use for generating C# classes/enums and create the * subdirectory (does not create if language specific outdir does not exist). * ----------------------------------------------------------------------------- */ @@ -3515,7 +3515,7 @@ public: * classDirectorMethod() * * Emit a virtual director method to pass a method call on to the - * underlying Java object. + * underlying C# object. * * --------------------------------------------------------------- */ @@ -3676,7 +3676,7 @@ public: if (!ignored_method) Printf(w->code, "} else {\n"); - /* Go through argument list, convert from native to Java */ + /* Go through argument list, convert from native to C# */ for (i = 0, p = l; p; ++i) { /* Is this superfluous? */ while (checkAttribute(p, "tmap:directorin:numinputs", "0")) { From 85c02b172d1aeb52bf67cb95906355684c38745e Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 11 Jun 2015 20:13:09 +0100 Subject: [PATCH 08/15] Expand section on code generation philosophy. We avoid introducing 3rd party dependencies in the generated code including the STL. --- Doc/Manual/Introduction.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/Manual/Introduction.html b/Doc/Manual/Introduction.html index 9cc4277c9..02a41169a 100644 --- a/Doc/Manual/Introduction.html +++ b/Doc/Manual/Introduction.html @@ -457,6 +457,12 @@ be used on any platform. Again, this is an important part of staying out of the programmer's way----the last thing any developer wants to do is to spend their time debugging the output of a tool that relies on non-portable or unreliable programming features. +Dependencies are often a source of incompatibilities and problems and so +additional third party libraries are not used in the generated code. +SWIG will also generally avoid generating code that introduces a dependency +on the C++ Standard Template Library (STL). +SWIG will generate code that depends on the C libraries though. +

      From cc6970e21f841a36fdce68222f16b1ea88a6b276 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 12 Jun 2015 06:29:57 +0100 Subject: [PATCH 09/15] Documentation improvements for -o and -oh options --- Doc/Manual/SWIG.html | 5 +++-- Source/Modules/main.cxx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html index 4c33aeab8..774e00b23 100644 --- a/Doc/Manual/SWIG.html +++ b/Doc/Manual/SWIG.html @@ -146,7 +146,8 @@ can be obtained by typing swig -help or swig -Idir Add a directory to the file include path -lfile Include a SWIG library file. -module name Set the name of the SWIG module --o outfile Name of output file +-o outfile Set name of C/C++ output file to <outfile> +-oh headfile Set name of C++ output header file for directors to <headfile> -outcurrentdir Set default output dir to current dir instead of input file's path -outdir dir Set language specific files output directory -pcreversion Display PCRE version information @@ -212,7 +213,7 @@ additional files depending on the target language. By default, an input file with the name file.i is transformed into a file file_wrap.c or file_wrap.cxx (depending on whether or not the -c++ option has been used). The name of the -output file can be changed using the -o option. In certain +output C/C++ file can be changed using the -o option. In certain cases, file suffixes are used by the compiler to determine the source language (C, C++, etc.). Therefore, you have to use the -o option to change the suffix of the SWIG-generated wrapper diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index f0f9962dd..1850a47cb 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -131,8 +131,8 @@ static const char *usage3 = (const char *) "\ static const char *usage4 = (const char *) "\ -O - Enable the optimization options: \n\ -fastdispatch -fvirtual \n\ - -o - Set name of the output file to \n\ - -oh - Set name of the output header file to \n\ + -o - Set name of C/C++ output file to \n\ + -oh - Set name of C++ output header file for directors to \n\ -outcurrentdir - Set default output dir to current dir instead of input file's path\n\ -outdir - Set language specific files output directory to \n\ -pcreversion - Display PCRE version information\n\ From 1891b82e0042994fc249f1209b86de9fbf103dd9 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 12 Jun 2015 20:23:56 +0100 Subject: [PATCH 10/15] R - Call to SWIG_createNewRef in copyToC was incorrectly named. Closes #430 --- CHANGES.current | 3 +++ Lib/r/srun.swg | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 1b5d1f095..8270c254a 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.6 (in progress) =========================== +2015-06-12: wsfulton + [R] Fix #430 - call to SWIG_createNewRef in copyToC was incorrectly named. + 2015-06-11: sghirate [C#] Patch #427 adds in new command line option -outfile to combine all the generated C# code into a single file. diff --git a/Lib/r/srun.swg b/Lib/r/srun.swg index 71a508d49..2045ab94e 100644 --- a/Lib/r/srun.swg +++ b/Lib/r/srun.swg @@ -62,7 +62,7 @@ function(className, ..., append = TRUE) if(!isGeneric("copyToC")) setGeneric("copyToC", - function(value, obj = RSWIG_createNewRef(class(value))) + function(value, obj = SWIG_createNewRef(class(value))) standardGeneric("copyToC" )) @@ -147,4 +147,4 @@ function(fun, userData = NULL) } -####################################################################### \ No newline at end of file +####################################################################### From 5fb344e0e6ee9ca4b1606c71b944a66d7f07c9ad Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 12 Jun 2015 20:25:00 +0100 Subject: [PATCH 11/15] R - fix duplicate generation of 'self' parameter. Fixes director_keywords test case. --- Lib/r/rkw.swg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/r/rkw.swg b/Lib/r/rkw.swg index 2c181faa0..074d7dfd9 100644 --- a/Lib/r/rkw.swg +++ b/Lib/r/rkw.swg @@ -3,6 +3,7 @@ */ #define RKW(x) %keywordwarn("'" `x` "' is a R keyword, renaming to '_" `x`"'", rename="_%s") `x` +#define RSWIGKW(x) %keywordwarn("'" `x` "' is a SWIG R reserved parameter name, renaming to '_" `x`"'", rename="_%s") `x` /* Warnings for R reserved words taken from @@ -29,4 +30,7 @@ RKW(NA_real_); RKW(NA_complex_); RKW(NA_character_); +RSWIGKW(self); + #undef RKW +#undef RSWIGKW From 9b2bde403b8a68490e9e8cb91053c0ab3e732d30 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 12 Jun 2015 20:26:24 +0100 Subject: [PATCH 12/15] R - Remove constantWrapper message wrapping constants An implementation is still needed for constants. --- Source/Modules/r.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index a42ee97a1..61c3b9a11 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -2181,6 +2181,16 @@ int R::functionWrapper(Node *n) { return SWIG_OK; } +/* ---------------------------------------------------------------------- + * R::constantWrapper() + * ---------------------------------------------------------------------- */ + +int R::constantWrapper(Node *n) { + (void) n; + // TODO + return SWIG_OK; +} + /***************************************************** Add the specified routine name to the collection of generated routines that are called from R functions. From 1f5361593555deb6f429b3b238b649e8055abb05 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 12 Jun 2015 20:28:49 +0100 Subject: [PATCH 13/15] Add R to travis testing --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 679d42a5d..5b80a030e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,6 +54,8 @@ matrix: env: SWIGLANG=python SWIG_FEATURES=-O - compiler: gcc env: SWIGLANG=python SWIG_FEATURES=-classic + - compiler: gcc + env: SWIGLANG=r - compiler: gcc env: SWIGLANG=ruby - compiler: gcc @@ -96,6 +98,7 @@ before_install: - if test "$SWIGLANG" = "python"; then git clone https://github.com/jcrocholl/pep8.git && pushd pep8 && git checkout tags/1.5.7 && python ./setup.py build && sudo python ./setup.py install && popd; fi - if test "$SWIGLANG" = "python" -a "$PY3" -a -z "$VER"; then sudo apt-get install -qq python3-dev; fi - if test "$SWIGLANG" = "python" -a "$VER"; then sudo add-apt-repository -y ppa:fkrull/deadsnakes && sudo apt-get -qq update && sudo apt-get -qq install python${VER}-dev && export CONFIGOPTS="--with-python${PY3}=python${VER}"; fi + - if test "$SWIGLANG" = "r"; then sudo apt-get -qq install r-base; fi - if test "$SWIGLANG" = "scilab"; then sudo apt-get -qq install scilab; fi - if test "$SWIGLANG" = "tcl"; then sudo apt-get -qq install tcl8.4-dev; fi - $CC --version From b94820adcfe05b48c0e553e4e4fd0b32f385651f Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 12 Jun 2015 23:37:08 +0100 Subject: [PATCH 14/15] Fix r.cxx build break --- Source/Modules/r.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index 61c3b9a11..0e8e23063 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -281,6 +281,7 @@ public: void dispatchFunction(Node *n); int functionWrapper(Node *n); + int constantWrapper(Node *n); int variableWrapper(Node *n); int classDeclaration(Node *n); From b1f2d0749e6db99cba94eaec606d3a6ae986415f Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 13 Jun 2015 10:29:09 +0100 Subject: [PATCH 15/15] Don't fail R in Travis - runtime tests are failing in this environment --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b80a030e..a51c541cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,6 +63,9 @@ matrix: - compiler: gcc env: SWIGLANG=tcl allow_failures: + # Lots of failing tests currently + - compiler: gcc + env: SWIGLANG=ocaml # Occasional gcc internal compiler error - compiler: gcc env: SWIGLANG=octave SWIGJOBS=-j3 VER=3.8 @@ -72,9 +75,9 @@ matrix: # Not quite working yet - compiler: gcc env: SWIGLANG=python SWIG_FEATURES=-O - # Lots of failing tests currently + # Runtime errors in Travis environment - compiler: gcc - env: SWIGLANG=ocaml + env: SWIGLANG=r before_install: - date -u - uname -a