+2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+       * symtab.c (treg_matches_sym_type_name): Use
+       scoped_switch_to_sym_language_if_auto instead of local logic.
+       (print_symbol_info): Use scoped_switch_to_sym_language_if_auto
+       to switch to SYM language when language mode is auto.
+
 2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * language.h (scoped_switch_to_sym_language_if_auto): New class.
 
   if (sym_type == NULL)
     return false;
 
-  if (language_mode == language_mode_auto)
-    {
-      scoped_restore_current_language l;
+  {
+    scoped_switch_to_sym_language_if_auto l (sym);
 
-      set_language (SYMBOL_LANGUAGE (sym));
-      printed_sym_type_name = type_to_string (sym_type);
-    }
-  else
     printed_sym_type_name = type_to_string (sym_type);
+  }
+
 
   if (symbol_lookup_debug > 1)
     {
                   struct symbol *sym,
                   int block, const char *last)
 {
+  scoped_switch_to_sym_language_if_auto l (sym);
   struct symtab *s = symbol_symtab (sym);
 
   if (last != NULL)
 
+2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+       * gdb.dwarf2/dw2-case-insensitive.exp: Update due to auto switch to
+       FUNC_lang language syntax.
+
 2018-11-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * gdb.base/info_minsym.c: New file.
 
 gdb_test "set case-sensitive off" {warning: the current case sensitivity setting does not match the language\.}
 
 # The dot-leading symbol is for ppc64 function descriptors.
+# Note that info functions gives the FUNC_lang result using the fortran syntax
+# as specified in dw-case-insensitive-debug.S DW_AT_language.
 gdb_test "info functions fUnC_lang" \
-        "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(void\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \
+        "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \
         "regexp case-sensitive off"
 
 gdb_test "p fuNC_lang" { = {foo \(void\)} 0x[0-9a-f]+ <FUNC_lang>}