Help save net neutrality! Learn more.
Close

#350 small patch for include guard in perl

None
closed-accepted
None
5
2014-08-17
2014-08-09
ajrh
No

Perl wrapper in director mode uses module name for an include guard,
which doesn't work for nested classname, viz #ifndef SWIG_Foo::Bar_WRAP_H_
Move up the underscore_module definition and use that instead.

Anthony

--- Source/Modules/perl5.cxx.Orig       2014-06-04 08:00:18.000000000 -0400
+++ Source/Modules/perl5.cxx    2014-08-08 21:16:16.547289933 -0400
@@ -342,11 +342,18 @@
     Node *options = Getattr(mod, "options");
     module = Copy(Getattr(n,"name"));

+    String *underscore_module = Copy(module);
+    Replaceall(underscore_module,":","_");
+
+    if (verbose > 0) {
+      fprintf(stdout, "top: using namespace_module: %s\n", Char(namespace_module));
+    }
+
     if (directorsEnabled()) {
       Swig_banner(f_directors_h);
       Printf(f_directors_h, "\n");
-      Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module);
-      Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module);
+      Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", underscore_module);
+      Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", underscore_module);
       if (dirprot_mode()) {
        Printf(f_directors_h, "#include <map>\n");
        Printf(f_directors_h, "#include <string>\n\n");
@@ -379,13 +386,6 @@
        fprintf(stdout, "top: No package found\n");
       }
     }
-    String *underscore_module = Copy(module);
-    Replaceall(underscore_module,":","_");
-
-    if (verbose > 0) {
-      fprintf(stdout, "top: using namespace_module: %s\n", Char(namespace_module));
-    }
-
     /* If we're in blessed mode, change the package name to "packagec"
     */

     if (blessed) {
1 Attachments

Discussion

  • Robert Stone

    Robert Stone - 2014-08-16
    • assigned_to: Robert Stone
    • Group: -->
     
  • Robert Stone

    Robert Stone - 2014-08-17
    • status: open --> closed-accepted
     

Log in to post a comment.