From 023b626fc41d2f3ef28b49e70404e82c22798f59 Mon Sep 17 00:00:00 2001 From: Derek Bankieris Date: Wed, 3 Jun 2020 11:18:25 -0500 Subject: [PATCH] Fully qualify TRICK_SWIG_TEMPLATE identifiers Closes #1003 --- libexec/trick/convert_swig | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libexec/trick/convert_swig b/libexec/trick/convert_swig index 906a464c..74595770 100755 --- a/libexec/trick/convert_swig +++ b/libexec/trick/convert_swig @@ -641,12 +641,16 @@ sub process_class($$$$$) { #print "*** template_type_no_sp = $template_type_no_sp ***\n" ; if ( ! exists $processed_templates{$template_type_no_sp} ) { - $$new_contents_ref .= "\n#define TRICK_SWIG_TEMPLATE_$class_name${var_name}_template\n" ; + my $sanitized_namespace = $curr_namespace =~ s/:/_/gr ; + my $identifier = "${sanitized_namespace}${class_name}_${var_name}" ; + my $trick_swig_template = "TRICK_SWIG_TEMPLATE_$identifier" ; - my $typedef = "\n#ifdef TRICK_SWIG_TEMPLATE_$class_name${var_name}_template\n" ; - $typedef .= "\%template($class_name${var_name}_template) $template_full_type;\n" ; - $typedef .= "#undef TRICK_SWIG_TEMPLATE_$class_name${var_name}_template\n" ; - $typedef .= "#endif\n" ; + $$new_contents_ref .= "\n#define $trick_swig_template\n" ; + + my $typedef = "\n#ifdef $trick_swig_template\n" ; + $typedef .= "\%template($identifier) $template_full_type;\n" ; + $typedef .= "#undef $trick_swig_template\n" ; + $typedef .= "#endif\n" ; if ($qualified) { $global_template_typedefs .= $typedef