139 search_var_instance_decl_c::opt_t ext_opt = search_var_instance_ext_decl. get_option(var_name); |
138 search_var_instance_decl_c::opt_t ext_opt = search_var_instance_ext_decl. get_option(var_name); |
140 search_var_instance_decl_c::opt_t glo_opt = search_var_instance_glo_decl->get_option(var_name); |
139 search_var_instance_decl_c::opt_t glo_opt = search_var_instance_glo_decl->get_option(var_name); |
141 if ((glo_opt == search_var_instance_decl_c::constant_opt) && (ext_opt != search_var_instance_decl_c::constant_opt)) |
140 if ((glo_opt == search_var_instance_decl_c::constant_opt) && (ext_opt != search_var_instance_decl_c::constant_opt)) |
142 STAGE3_ERROR(0, glo_decl, glo_decl, "Declaration error. The external variable must be declared as constant, as it maps to a constant global variable."); |
141 STAGE3_ERROR(0, glo_decl, glo_decl, "Declaration error. The external variable must be declared as constant, as it maps to a constant global variable."); |
143 |
142 |
144 /* Copy the const_value from the global to the external variable. |
|
145 * This is actually part of the constant folding algorithm. It is placed here because it needs the extern<->global pairing |
|
146 * information to run correctly, which is all available right here! |
|
147 */ |
|
148 constant_folding_c constant_folding; |
|
149 constant_folding.handle_var_extern_global_pair(var_name /* extern_var */, ext_decl /* extern_decl */, NULL /* global_var */, glo_decl /* global_decl */); |
|
150 |
|
151 /* TODO: Check redefinition data type. |
143 /* TODO: Check redefinition data type. |
152 * We need a new class (like search_base_type class) to get type id by variable declaration. |
144 * We need a new class (like search_base_type class) to get type id by variable declaration. |
153 * symbol_c *glo_type = ????; |
145 * symbol_c *glo_type = ????; |
154 * symbol_c *ext_type = fpi.param_type(); |
146 * symbol_c *ext_type = fpi.param_type(); |
155 */ |
147 */ |