This is an automated email from the git hooks/post-receive script.
unknown user pushed a commit to branch aoliva/libcp1 in repository gcc.
commit f1a88e3527ed8e1e8b21fd8bfc19a6a285284d94 Author: Alexandre Oliva aoliva@redhat.com Date: Wed Jun 10 06:21:57 2015 -0300
Fix build_constant for C++.
C++ wants CONST_DECLs to be used for enumerators only. Define a VAR_DECL with a READONLY and STATIC flags, and let cp_finish_decl take care of the initialization. Then introduce the declaration like other decls, removing the only remaining use of pushdecl_safe, so the function is removed too. --- libcc1/libcp1plugin.cc | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index b0d1cb0..a25e851 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -153,22 +153,6 @@ struct string_hasher : typed_noop_remove<const char>
-// A wrapper for pushdecl that doesn't let gdb have a chance to -// instantiate a symbol. - -static void -pushdecl_safe (tree decl) -{ - void (*save) (enum cp_oracle_request, tree identifier); - - save = cp_binding_oracle; - cp_binding_oracle = NULL; - pushdecl (decl); - cp_binding_oracle = save; -} - - - struct plugin_context : public cc1_plugin::connection { plugin_context (int fd); @@ -831,10 +815,14 @@ plugin_build_constant (cc1_plugin::connection *self, gcc_type [...] tree type = convert_in (type_in);
cst = build_int_cst (type, value); + if (!TYPE_READONLY (type)) + type = build_qualified_type (type, TYPE_QUAL_CONST); decl = build_decl (ctx->get_source_location (filename, line_number), - CONST_DECL, get_identifier (name), type); - DECL_INITIAL (decl) = cst; - pushdecl_safe (decl); + VAR_DECL, get_identifier (name), type); + TREE_STATIC (decl) = 1; + TREE_READONLY (decl) = 1; + cp_finish_decl (decl, cst, true, NULL, LOOKUP_ONLYCONVERTING); + pushdecl_maybe_friend (decl, false);
return 1; }