This change depends on the new DWARFv5 constants mentioned in the following draft: http://dwarfstd.org/doc/dwarf5.20141029.pdf
gcc/ChangeLog * dwarf2out.c (is_cxx): Add DW_LANG_C_plus_plus_11 and DW_LANG_C_plus_plus_14. (lower_bound_default): Likewise. Plus DW_LANG_C11. (gen_compile_unit_die): Output DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14 or DW_LANG_C11. gcc/testsuite/ChangeLog * gcc.dg/debug/dwarf2/lang-c11.c: New test. * g++.dg/debug/dwarf2/lang-cpp11.C: Likewise. * g++.dg/debug/dwarf2/lang-cpp14.C: Likewise. * g++.dg/debug/dwarf2/lang-cpp98.C: Likewise. include/ChangeLog * dwarf2.h: Add DW_LANG_C_plus_plus_11, DW_LANG_C11 and DW_LANG_C_plus_plus_14. --- gcc/ChangeLog | 8 ++++++++ gcc/dwarf2out.c | 28 ++++++++++++++++++++++---- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp11.C | 6 ++++++ gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp14.C | 6 ++++++ gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp98.C | 6 ++++++ gcc/testsuite/gcc.dg/debug/dwarf2/lang-c11.c | 6 ++++++ include/ChangeLog | 5 +++++ include/dwarf2.h | 4 ++++ 9 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp11.C create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp14.C create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp98.C create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/lang-c11.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 222558d..f7fabdf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2014-11-20 Mark Wielaard <m...@redhat.com> + * dwarf2out.c (is_cxx): Add DW_LANG_C_plus_plus_11 and + DW_LANG_C_plus_plus_14. + (lower_bound_default): Likewise. Plus DW_LANG_C11. + (gen_compile_unit_die): Output DW_LANG_C_plus_plus_11, + DW_LANG_C_plus_plus_14 or DW_LANG_C11. + +2014-11-20 Mark Wielaard <m...@redhat.com> + PR debug/38757 * config/avr/avr-c.c (avr_cpu_cpp_builtins): Use strncmp to check lang_hooks.name. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7844f33..c28deec 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -4684,7 +4684,8 @@ is_cxx (void) { unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language); - return lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus; + return (lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus + || lang == DW_LANG_C_plus_plus_11 || lang == DW_LANG_C_plus_plus_14); } /* Return TRUE if the language is Java. */ @@ -16402,7 +16403,10 @@ lower_bound_default (void) case DW_LANG_C: case DW_LANG_C89: case DW_LANG_C99: + case DW_LANG_C11: case DW_LANG_C_plus_plus: + case DW_LANG_C_plus_plus_11: + case DW_LANG_C_plus_plus_14: case DW_LANG_ObjC: case DW_LANG_ObjC_plus_plus: case DW_LANG_Java: @@ -16746,6 +16750,7 @@ add_prototyped_attribute (dw_die_ref die, tree func_type) case DW_LANG_C: case DW_LANG_C89: case DW_LANG_C99: + case DW_LANG_C11: case DW_LANG_ObjC: if (prototype_p (func_type)) add_AT_flag (die, DW_AT_prototyped, 1); @@ -19592,13 +19597,28 @@ gen_compile_unit_die (const char *filename) language = DW_LANG_C; if (strncmp (language_string, "GNU C++", 7) == 0) - language = DW_LANG_C_plus_plus; + { + language = DW_LANG_C_plus_plus; + if (dwarf_version >= 5 || !dwarf_strict) + { + if (strcmp (language_string, "GNU C++11") == 0) + language = DW_LANG_C_plus_plus_11; + else if (strcmp (language_string, "GNU C++14") == 0) + language = DW_LANG_C_plus_plus_14; + } + } else if (strncmp (language_string, "GNU C", 5) == 0) { language = DW_LANG_C89; if (dwarf_version >= 3 || !dwarf_strict) - if (strcmp (language_string, "GNU C99") == 0) - language = DW_LANG_C99; + { + if (strcmp (language_string, "GNU C89") != 0) + language = DW_LANG_C99; + + if (dwarf_version >= 5 || !dwarf_strict) + if (strcmp (language_string, "GNU C11") == 0) + language = DW_LANG_C11; + } } else if (strcmp (language_string, "GNU F77") == 0) language = DW_LANG_Fortran77; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9b29745..59f68ae 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2014-11-20 Mark Wielaard <m...@redhat.com> + * gcc.dg/debug/dwarf2/lang-c11.c: New test. + * g++.dg/debug/dwarf2/lang-cpp11.C: Likewise. + * g++.dg/debug/dwarf2/lang-cpp14.C: Likewise. + * g++.dg/debug/dwarf2/lang-cpp98.C: Likewise. + +2014-11-20 Mark Wielaard <m...@redhat.com> + PR debug/38757 * gcc.dg/debug/dwarf2/lang-c89.c: New test. * gcc.dg/debug/dwarf2/lang-c99.c: Likewise. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp11.C b/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp11.C new file mode 100644 index 0000000..0dfd372 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp11.C @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-O -std=c++11 -g -dA" } +// DW_LANG_C_plus_plus_11 = 0x001a +// { dg-final { scan-assembler "0x1a.*DW_AT_language" } } */ + +int version; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp14.C b/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp14.C new file mode 100644 index 0000000..cc183e6 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp14.C @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-O -std=c++14 -g -dA" } +// DW_LANG_C_plus_plus_14 = 0x0021 +// { dg-final { scan-assembler "0x21.*DW_AT_language" } } */ + +int version; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp98.C b/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp98.C new file mode 100644 index 0000000..065cc18 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp98.C @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-O -std=c++98 -g -dA" } +// DW_LANG_C_plus_plus = 0x0004 +// { dg-final { scan-assembler "0x4.*DW_AT_language" } } */ + +int version; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/lang-c11.c b/gcc/testsuite/gcc.dg/debug/dwarf2/lang-c11.c new file mode 100644 index 0000000..ba3723f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/lang-c11.c @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-O -std=c11 -g -dA" } +// DW_LANG_C11 = 0x001d +// { dg-final { scan-assembler "0x1d.*DW_AT_language" } } */ + +int version; diff --git a/include/ChangeLog b/include/ChangeLog index d9cb8a0..fce06a8 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2014-11-20 Mark Wielaard <m...@redhat.com> + + * dwarf2.h: Add DW_LANG_C_plus_plus_11, DW_LANG_C11 and + DW_LANG_C_plus_plus_14. + 2014-11-11 Anthony Brandon <anthony.bran...@gmail.com> Manuel López-Ibáñez <m...@gcc.gnu.org> diff --git a/include/dwarf2.h b/include/dwarf2.h index 120e2c1..ca440dd 100644 --- a/include/dwarf2.h +++ b/include/dwarf2.h @@ -309,6 +309,10 @@ enum dwarf_source_language /* DWARF 5. */ DW_LANG_Go = 0x0016, + DW_LANG_C_plus_plus_11 = 0x001a, /* dwarf5.20141029.pdf DRAFT */ + DW_LANG_C11 = 0x001d, + DW_LANG_C_plus_plus_14 = 0x0021, + DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */ DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */ -- 1.8.3.1