DWARF Standard


210305.1 Jakub Jelinek Split DW_AT_language into DW_AT_language and DW_AT_language_version Enhancement Open

Section 3.1.1, pg 61-63

Some of the DW_LANG_* language codes currently include a language version, usually 
in the form of 2 digit suffix for the standard year.  E.g.
the problem with this way is that any time new language codes are assigned for new 
language versions of the same language, all consumers need to be updated to handle 
those new language codes.  Say if a consumer needs some special handling of C++11 
or later, for DWARF5 it needs to look for DW_LANG_C_plus_plus_{11,14}, but in DWARF6 
it would need to look for DW_LANG_C_plus_plus_{11,14,17,20} and maybe 23 too.

As DWARF5 has DW_FORM_implicit_const, adding new constants to the TUs isn't that 
expensive, so I'd like to propose that we adjust DW_LANG_* codes and add an 
optional DW_AT_language_version attribute.  I think it would be best if the values 
for DW_AT_language_version were YYYYMM decimal numbers when the particular standard 
was finalized, so e.g. for C++ it would be 199711 for C++98, 201103 for C++11, 
201402 for C++14, 201703 for C++17, 202002 for C++20, etc.  This would mean consumers
then can check DW_AT_language value is DW_LANG_C_plus_plus and DW_AT_language_version
value >= 201103 etc. 

In the DW_LANG_* table I'd suggest to add a column with implied default 
DW_AT_language_version when that attribute is not explicitly specified.
Now, the DW_LANG_* table contains either unversioned names for some languages, 
those would be kept as is, or an unversioned (typically oldest) + some versioned 
ones, here I'd suggest to keep but deprecate the versioned ones and for other languages
there are only versioned ones, here I'd suggest to copy the oldest one to an unversioned
name (alias) and deprecate the versioned ones.

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2021 by DWARF Standards Committee.