@@ -614,17 +614,10 @@ class ASRToCVisitor : public BaseCCPPVisitor<ASRToCVisitor>
614
614
ASR::EnumType_t* enum_type = ASR::down_cast<ASR::EnumType_t>(enum_->m_enum_type );
615
615
sub = format_type_c (" " , " enum " + std::string (enum_type->m_name ), v.m_name , false , false );
616
616
} else if (ASR::is_a<ASR::Const_t>(*v_m_type)) {
617
- if ( v.m_intent == ASRUtils::intent_local ) {
618
- LCOMPILERS_ASSERT (v.m_symbolic_value );
619
- visit_expr (*v.m_symbolic_value );
620
- sub = " #define " + std::string (v.m_name ) + " " + src + " \n " ;
621
- return sub;
622
- } else {
623
- std::string const_underlying_type = CUtils::get_c_type_from_ttype_t (
624
- ASR::down_cast<ASR::Const_t>(v_m_type)->m_type );
625
- sub = format_type_c (" " , " const " + const_underlying_type + " " ,
626
- v.m_name , false , false );
627
- }
617
+ std::string const_underlying_type = CUtils::get_c_type_from_ttype_t (
618
+ ASRUtils::type_get_past_const (v_m_type));
619
+ sub = format_type_c (" " , " const " + const_underlying_type,
620
+ v.m_name , false , false );
628
621
} else if (ASR::is_a<ASR::TypeParameter_t>(*v_m_type)) {
629
622
// Ignore type variables
630
623
return " " ;
702
695
ASR::Variable_t *v = ASR::down_cast<ASR::Variable_t>(item.second );
703
696
unit_src_tmp = convert_variable_decl (*v);
704
697
unit_src += unit_src_tmp;
705
- if (unit_src_tmp.size () > 0 && (!ASR::is_a<ASR::Const_t>(*v->m_type ) ||
706
- v->m_intent == ASRUtils::intent_return_var )) {
698
+ if (unit_src_tmp.size () > 0 ) {
707
699
unit_src += " ;\n " ;
708
700
}
709
701
}
852
844
item.second );
853
845
unit_src_tmp = convert_variable_decl (*v);
854
846
unit_src += unit_src_tmp;
855
- if (unit_src_tmp.size () > 0 &&
856
- (!ASR::is_a<ASR::Const_t>(*v->m_type ) ||
857
- v->m_intent == ASRUtils::intent_return_var )) {
847
+ if (unit_src_tmp.size () > 0 ) {
858
848
unit_src += " ;\n " ;
859
849
}
860
850
}
920
910
decl += indent1;
921
911
decl_tmp = convert_variable_decl (*v);
922
912
decl += decl_tmp;
923
- if (decl_tmp.size () > 0 && (!ASR::is_a<ASR::Const_t>(*v->m_type ) ||
924
- v->m_intent == ASRUtils::intent_return_var )) {
913
+ if (decl_tmp.size () > 0 ) {
925
914
decl += " ;\n " ;
926
915
}
927
916
}
@@ -1007,10 +996,7 @@ R"( // Initialise Numpy
1007
996
body += indent + convert_variable_decl (
1008
997
*ASR::down_cast<ASR::Variable_t>(member),
1009
998
&c_decl_options_);
1010
- if ( !ASR::is_a<ASR::Const_t>(*ASRUtils::symbol_type (member)) ||
1011
- ASR::down_cast<ASR::Variable_t>(member)->m_intent == ASRUtils::intent_return_var ) {
1012
- body += " ;\n " ;
1013
- }
999
+ body += " ;\n " ;
1014
1000
}
1015
1001
indentation_level -= 1 ;
1016
1002
std::string end_struct = " };\n\n " ;
0 commit comments