This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH] Emit DW_LANG_Fortran{03,08}


Jakub Jelinek wrote:
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.

For completeness: gfortran currently produces "GNU Fortran" and DW_LANG_Fortran95; GCC itself also handles ...Fortran77 and ...Fortran90, but those are not produced with gfortran.

With the patch, it produces for -gdwarf-2/3/4 (4 is default) or "-gdwarf-5 -std=f95" the same as above. For -std=f2003 -gdwarf-5, it yields "GNU Fortran2003" and DW_LANG_Fortran2003. And for -gdwarf-5 and the rest of -std= (f2008, f2008ts, gnu, legacy), it produces "GNU Fortran2008" and DW_LANG_Fortran2008.

(In principle, they could have prepared for the future and added Fortran 2015 as well.)


Regarding the change: it is fine with me. (However, I wonder how much will break, once the "|| !dwarf_strict" is enabled, knowing that compilers are often more frequently updated as debuggers, valgrind and similar programs. On the other, except of debuggers, most tools should care much about the DW_LANG.)

Tobias

PS: Talking about DWARF5, do you know when it will be available as public draft? I am especially looking forward to http://dwarfstd.org/ShowIssue.php?issue=121221.1 (Allow DW_AT_type with DW_TAG_string_type), which would be a low-hanging fruit in terms of implementation. Contrary to the array additions of 130313.5.

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]