]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
langhooks.c (lhd_print_error_function): Move from diagnostic.c.
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Sun, 7 Sep 2003 10:11:28 +0000 (10:11 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Sun, 7 Sep 2003 10:11:28 +0000 (10:11 +0000)
* langhooks.c (lhd_print_error_function): Move from diagnostic.c.
* Makefile.in (langhooks.o): Depend on diagnostic.h

From-SVN: r71165

gcc/ChangeLog
gcc/Makefile.in
gcc/diagnostic.c
gcc/langhooks.c

index 7669b77a036a1b4cf68af567843eebad26f1b79f..492f6d7fdd7314ba2dfa2fa8ec2300a49943b89f 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-07  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       * langhooks.c (lhd_print_error_function): Move from diagnostic.c.
+       * Makefile.in (langhooks.o): Depend on diagnostic.h
+
 2003-09-06  James E Wilson  <wilson@tuliptree.org>
 
        * loop.c (loop_regs_update): Delete else clause for PATTERN rtx and
index 679a7d4db94749f4cb5cdc764b1b4d5486e34dbe..732e8f8122e3e165270e3d6d93ac0960c029a63e 100644 (file)
@@ -1462,7 +1462,7 @@ convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) flags
 
 langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) toplev.h \
    tree-inline.h $(RTL_H) insn-config.h $(INTEGRATE_H) langhooks.h \
-   $(LANGHOOKS_DEF_H) flags.h $(GGC_H) gt-langhooks.h
+   $(LANGHOOKS_DEF_H) flags.h $(GGC_H) gt-langhooks.h diagnostic.h
 tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) flags.h function.h \
    toplev.h $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h \
    real.h gt-tree.h
index 8d01a2b0561b142ebc74206c70d84a8d8b17f4dc..8c8a86c2b381e4747b97c4e91be7a52b0b98240d 100644 (file)
@@ -279,40 +279,6 @@ diagnostic_action_after_output (diagnostic_context *context,
     }
 }
 
-/* The default function to print out name of current function that caused
-   an error.  */
-void
-lhd_print_error_function (diagnostic_context *context, const char *file)
-{
-  if (diagnostic_last_function_changed (context))
-    {
-      const char *old_prefix = context->printer->prefix;
-      char *new_prefix = file ? build_message_string ("%s: ", file) : NULL;
-
-      pp_set_prefix (context->printer, new_prefix);
-
-      if (current_function_decl == NULL)
-       pp_string (context->printer, _("At top level:"));
-      else
-       {
-         if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
-           pp_printf
-             (context->printer, "In member function `%s':",
-              (*lang_hooks.decl_printable_name) (current_function_decl, 2));
-         else
-           pp_printf
-             (context->printer, "In function `%s':",
-              (*lang_hooks.decl_printable_name) (current_function_decl, 2));
-       }
-      pp_newline (context->printer);
-
-      diagnostic_set_last_function (context);
-      pp_flush (context->printer);
-      context->printer->prefix = old_prefix;
-      free ((char*) new_prefix);
-    }
-}
-
 /* Prints out, if necessary, the name of the current function
   that caused an error.  Called from all error and warning functions.
   We ignore the FILE parameter, as it cannot be relied upon.  */
index 665a06a55695eb2b05289914cd43634eac631c60..622e0626801d54c6d7d37642b68fac8b6996dd83 100644 (file)
@@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA.  */
 #include "langhooks.h"
 #include "langhooks-def.h"
 #include "ggc.h"
+#include "diagnostic.h"
 
 /* Do nothing; in many cases the default hook.  */
 
@@ -493,4 +494,38 @@ lhd_initialize_diagnostics (struct diagnostic_context *ctx ATTRIBUTE_UNUSED)
 {
 }
 
+/* The default function to print out name of current function that caused
+   an error.  */
+void
+lhd_print_error_function (diagnostic_context *context, const char *file)
+{
+  if (diagnostic_last_function_changed (context))
+    {
+      const char *old_prefix = context->printer->prefix;
+      char *new_prefix = file ? file_name_as_prefix (file) : NULL;
+
+      pp_set_prefix (context->printer, new_prefix);
+
+      if (current_function_decl == NULL)
+       pp_printf (context->printer, "At top level:");
+      else
+       {
+         if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
+           pp_printf
+             (context->printer, "In member function `%s':",
+              (*lang_hooks.decl_printable_name) (current_function_decl, 2));
+         else
+           pp_printf
+             (context->printer, "In function `%s':",
+              (*lang_hooks.decl_printable_name) (current_function_decl, 2));
+       }
+      pp_newline (context->printer);
+
+      diagnostic_set_last_function (context);
+      pp_flush (context->printer);
+      context->printer->prefix = old_prefix;
+      free ((char*) new_prefix);
+    }
+}
+
 #include "gt-langhooks.h"