Hi Cuper.

Thanks for the patch.
OK.

> Removed possibly forgotten A68_GLOBAL_CONTEXT and get_global_context
> in favor of the language specific a68_range_context function.
>
> The builtin initialization was using the global context through
> pushdecl function, which although not an immediate problem seems to be
> incorrect.
>
> Signed-off-by: Cupertino Miranda <[email protected]>
>
> gcc/algol68/ChangeLog
>
>       * a68-lang.cc (a68_init): Anticipate the execution of
>       a68_init_ranges.
>       (get_global_context): Removed function.
>       (pushdecl): Replace call to get_global_context by
>       a68_range_context.
>       * a68.h: Remove A68_GLOBAL_CONTEXT macro.
> ---
>  gcc/algol68/a68-lang.cc | 21 ++++-----------------
>  gcc/algol68/a68.h       |  1 -
>  2 files changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/gcc/algol68/a68-lang.cc b/gcc/algol68/a68-lang.cc
> index 1cefb08c5ab..77ddbf08788 100644
> --- a/gcc/algol68/a68-lang.cc
> +++ b/gcc/algol68/a68-lang.cc
> @@ -222,14 +222,15 @@ a68_build_a68_type_nodes (void)
>  static bool
>  a68_init (void)
>  {
> +  /* Initialize binding contexts.  */
> +  a68_init_ranges ();
> +
>    build_common_tree_nodes (false);
>    a68_build_a68_type_nodes ();
>    targetm.init_builtins ();
>    build_common_builtin_nodes ();
>    a68_install_builtins ();
>  
> -  /* Initialize binding contexts.  */
> -  a68_init_ranges ();
>  
>    /* Set the type of size_t.  */
>    if (TYPE_MODE (long_unsigned_type_node) == ptr_mode)
> @@ -399,20 +400,6 @@ a68_getdecls (void)
>  #undef LANG_HOOKS_GETDECLS
>  #define LANG_HOOKS_GETDECLS a68_getdecls
>  
> -/* Return A68_GLOBAL_CONTEXT, but create it first if need be.  */
> -
> -static tree
> -get_global_context (void)
> -{
> -  if (!A68_GLOBAL_CONTEXT)
> -    {
> -      A68_GLOBAL_CONTEXT = build_translation_unit_decl (NULL_TREE);
> -      debug_hooks->register_main_translation_unit (A68_GLOBAL_CONTEXT);
> -    }
> -
> -  return A68_GLOBAL_CONTEXT;
> -}
> -
>  /* Implements the lang_hooks.decls.pushdecl routine.
>     Record DECL as belonging to the current lexical scope.  */
>  
> @@ -426,7 +413,7 @@ pushdecl (tree decl)
>        if (current_function_decl)
>       DECL_CONTEXT (decl) = current_function_decl;
>        else
> -     DECL_CONTEXT (decl) = get_global_context ();
> +     DECL_CONTEXT (decl) = a68_range_context ();
>      }
>  
>    /* Put decls on list in reverse order.  */
> diff --git a/gcc/algol68/a68.h b/gcc/algol68/a68.h
> index 7130cd0948a..90f5467cf65 100644
> --- a/gcc/algol68/a68.h
> +++ b/gcc/algol68/a68.h
> @@ -144,7 +144,6 @@ extern GTY(()) A68_T a68_common;
>  #define A68_GLOBAL_TREES   A68 (global_trees)
>  #define A68_PARSER(Z)      (A68 (parser_state).Z)
>  #define A68_MODULE_DEFINITION_DECLS   A68 (module_definition_decls)
> -#define A68_GLOBAL_CONTEXT      A68 (global_context)
>  #define A68_GLOBAL_DECLARATIONS A68 (global_declarations)
>  
>  /* Particular pre-defined modes.  */

Reply via email to