Hi Cuper.

The patch is OK for master, thanks.

I am thinking it would be good to add a few tests checking that the
right DW_AT_name attributes are generated.  Something with -dA perhaps?

The same approach could be used to test the generation of DW_TAG_typedef
for mode declarations..

> Hi Jose,
>
> Thanks for the review and apologies for the dangling comment from
> previous version.
>
> Cheers,
> Cupertino
>
> ------
>
> DWARF output contained no names for the compiler's base types, so
> they were emitted with the type name __unknown__.  In dwarf2out.cc,
> comments suggest that the __unknown__ type code flow is likely a bug.
> a68 frontend never assigned names to its built-in types.
>
> This patch sets a type name for every built-in type during a68
> initialization so they are emitted correctly in DWARF output.
>
> Signed-off-by: Cupertino Miranda <[email protected]>
>
> gcc/algol68/ChangeLog
>
>             * a68-lang.cc (PUSH_TYPE): Macro definition
>           (a68_build_a68_type_nodes): Inserted type names using
>           PUSH_TYPE macro.
>           (pushdecl): Added logic to insert name to the type
>           declaration.
> ---
>  gcc/algol68/a68-lang.cc | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/algol68/a68-lang.cc b/gcc/algol68/a68-lang.cc
> index 77ddbf08788..33ca7b5a037 100644
> --- a/gcc/algol68/a68-lang.cc
> +++ b/gcc/algol68/a68-lang.cc
> @@ -123,6 +123,9 @@ a68_type_moid (tree type)
>    return TYPE_LANG_SPECIFIC (type)->moid;
>  }
>  
> +#define PUSH_TYPE(name, node) \
> +  TYPE_NAME (node) = get_identifier (name);
> +
>  /* Build the type trees in a68_global_trees.  */
>  
>  static void
> @@ -138,9 +141,11 @@ a68_build_a68_type_nodes (void)
>  
>    /* BOOL */
>    a68_bool_type = boolean_type_node;
> +  PUSH_TYPE ("bool", a68_bool_type);
>  
>    /* CHAR */
>    a68_char_type = uint32_type_node;
> +  PUSH_TYPE ("char", a68_char_type);
>  
>    /* SHORT SHORT INT
>       SHORT INT
> @@ -148,6 +153,9 @@ a68_build_a68_type_nodes (void)
>    a68_short_short_int_type = signed_char_type_node;
>    a68_short_int_type = short_integer_type_node;
>    a68_int_type = integer_type_node;
> +  PUSH_TYPE ("short short int", a68_short_short_int_type);
> +  PUSH_TYPE ("short int", a68_short_int_type);
> +  PUSH_TYPE ("int", a68_int_type);
>  
>    /* LONG INT */
>    if (int_size_in_bytes (long_integer_type_node)
> @@ -158,6 +166,7 @@ a68_build_a68_type_nodes (void)
>      a68_long_int_type = long_long_integer_type_node;
>    else
>      a68_long_int_type = a68_int_type;
> +  PUSH_TYPE ("long int", a68_long_int_type);
>  
>    /* LONG LONG INT */
>    if (int_size_in_bytes (long_integer_type_node)
> @@ -168,6 +177,7 @@ a68_build_a68_type_nodes (void)
>      a68_long_long_int_type = long_long_integer_type_node;
>    else
>      a68_long_long_int_type = a68_long_int_type;
> +  PUSH_TYPE ("long long int", a68_long_long_int_type);
>  
>    /* SHORT SHORT BITS
>       SHORT BITS
> @@ -175,6 +185,9 @@ a68_build_a68_type_nodes (void)
>    a68_short_short_bits_type = unsigned_char_type_node;
>    a68_short_bits_type = short_unsigned_type_node;
>    a68_bits_type = unsigned_type_node;
> +  PUSH_TYPE ("short short bits", a68_short_short_bits_type);
> +  PUSH_TYPE ("short bits", a68_short_bits_type);
> +  PUSH_TYPE ("bits", a68_bits_type);
>  
>    /* LONG BITS */
>    if (int_size_in_bytes (long_unsigned_type_node)
> @@ -185,6 +198,7 @@ a68_build_a68_type_nodes (void)
>      a68_long_bits_type = long_long_unsigned_type_node;
>    else
>      a68_long_bits_type = a68_bits_type;
> +  PUSH_TYPE ("long bits", a68_long_bits_type);
>  
>    /* LONG LONG BITS */
>    if (int_size_in_bytes (long_unsigned_type_node)
> @@ -195,11 +209,14 @@ a68_build_a68_type_nodes (void)
>      a68_long_long_bits_type = long_long_unsigned_type_node;
>    else
>      a68_long_long_bits_type = a68_long_bits_type;
> +  PUSH_TYPE ("long long bits", a68_long_long_bits_type);
>  
>    /* BYTES
>       LONG BYTES */
>    a68_bytes_type = unsigned_type_node;
>    a68_long_bytes_type = long_unsigned_type_node;
> +  PUSH_TYPE ("bytes", a68_bytes_type);
> +  PUSH_TYPE ("long bytes", a68_long_bytes_type);
>  
>    /* REAL
>       LONG REAL
> @@ -207,7 +224,11 @@ a68_build_a68_type_nodes (void)
>    a68_real_type = float_type_node;
>    a68_long_real_type = double_type_node;
>    a68_long_long_real_type = long_double_type_node;
> +  PUSH_TYPE ("real", a68_real_type);
> +  PUSH_TYPE ("long real", a68_long_real_type);
> +  PUSH_TYPE ("long long real", a68_long_long_real_type);
>  }
> +#undef PUSH_TYPE
>  
>  /* Language hooks data structures.  This is the main interface between
>     the GCC front-end and the GCC middle-end/back-end.  A list of
> @@ -529,7 +550,7 @@ a68_handle_option (size_t scode,
>       if (file == NULL)
>         fatal_error (UNKNOWN_LOCATION,
>                      "cannot open modules map file %<%s%>", arg);
> -     
> +
>       ssize_t ssize = a68_file_size (fileno (file));
>       if (ssize < 0)
>         fatal_error (UNKNOWN_LOCATION,

Reply via email to