[RFC PATCH] Emit DW_LANG_Fortran{03,08}

David Malcolm dmalcolm@redhat.com
Tue Jan 27 20:39:00 GMT 2015


On Tue, 2015-01-27 at 19:19 +0100, Jakub Jelinek wrote:
> Hi!
> 
> DW_LANG_Fortran03 and DW_LANG_Fortran08 DW_AT_language values were recently
> accepted into DWARF5.  This patch changes GCC to handle those similarly to
> how e.g. the -std=c++11, -std=c++14 or -std=c11 are handled.
> 
> As it will take some time for consumers to catch up, I'm enabling that
> only if -gdwarf-5 is used for now.
> 
> 2015-01-27  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* dwarf2.h (enum dwarf_source_language): Add DW_LANG_Fortran03
> 	and DW_LANG_Fortran08.
> 	* dwarf2out.c (is_fortran): Also return true for DW_LANG_Fortran03
> 	or DW_LANG_Fortran08.
> 	(lower_bound_default): Return 1 for DW_LANG_Fortran03 or
> 	DW_LANG_Fortran08.
> 	(gen_compile_unit_die): Handle "GNU Fortran2003" and
> 	"GNU Fortran2008" language strings.
> 	* dbxout.c (get_lang_number): Use lang_GNU_Fortran.
> 	* langhooks.h (lang_GNU_Fortran): New prototype.
> 	* langhooks.c (lang_GNU_Fortran): New function.
> fortran/
> 	* options.c: Include langhooks.h.
> 	(gfc_post_options): Change lang_hooks.name based on
> 	selected -std= mode.

(...snip...)

> --- gcc/fortran/options.c.jj	2015-01-12 21:29:11.000000000 +0100
> +++ gcc/fortran/options.c	2015-01-27 19:07:33.729285229 +0100
> @@ -43,6 +43,7 @@ along with GCC; see the file COPYING3.
>  #include "cpp.h"
>  #include "diagnostic.h"	/* For global_dc.  */
>  #include "tm.h"
> +#include "langhooks.h"
>  
>  gfc_option_t gfc_option;
>  
> @@ -398,6 +399,11 @@ gfc_post_options (const char **pfilename
>  
>    gfc_cpp_post_options ();
>  
> +  if (gfc_option.allow_std & GFC_STD_F2008)
> +    lang_hooks.name = "GNU Fortran2008";
> +  else if (gfc_option.allow_std & GFC_STD_F2003)
> +    lang_hooks.name = "GNU Fortran2003";
> +

Did you test this on rs6000?

In particular, rs6000_output_function_epilogue has a:
      else if (! strcmp (language_string, "GNU F77")
	       || ! strcmp (language_string, "GNU Fortran"))
	i = 1;

Does that conditional need updating to track the langhooks.name change
(maybe to use your new lang_GNU_Fortran function?)

Dave




More information about the Gcc-patches mailing list