Merge pull request #1004 from nasa/1003

Fully qualify TRICK_SWIG_TEMPLATE identifiers
This commit is contained in:
dbankieris 2020-06-03 11:49:05 -05:00 committed by GitHub
commit e0d5aaf855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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