summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-26 06:54:54 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-26 06:54:54 +0000
commit2cafe21106dc81d9ec203120ef94e4e35527eaa4 (patch)
tree445f8e0a123deaa48447d0f3140806f626a413a0
parent33df9a15badf6dce67fcaa65338d2ce2c7384843 (diff)
downloadgcc-2cafe21106dc81d9ec203120ef94e4e35527eaa4.tar.gz
* diagnostic.h (file_name_as_prefix): Add context argument.
* diagnostic.c (file_name_as_prefix): Likewise. Colorize the string as locus. * langhooks.c (lhd_print_error_function): Adjust caller. cp/ * error.c (cp_print_error_function): Adjust file_name_as_prefix caller. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198331 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/error.c2
-rw-r--r--gcc/diagnostic.c7
-rw-r--r--gcc/diagnostic.h2
-rw-r--r--gcc/langhooks.c2
6 files changed, 20 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1768ae8b7ad..18a0ac0b47d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2013-04-26 Jakub Jelinek <jakub@redhat.com>
+
+ * diagnostic.h (file_name_as_prefix): Add context argument.
+ * diagnostic.c (file_name_as_prefix): Likewise. Colorize
+ the string as locus.
+ * langhooks.c (lhd_print_error_function): Adjust caller.
+
2013-04-25 Lawrence Crowl <crowl@google.com>
* var-tracking.c (shared_hash_def::htab):
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 33fc34a1444..39fbc46db44 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-26 Jakub Jelinek <jakub@redhat.com>
+
+ * error.c (cp_print_error_function): Adjust file_name_as_prefix
+ caller.
+
2013-04-25 Jason Merrill <jason@redhat.com>
PR c++/56859
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 4681e842002..c57a5aaa8db 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2962,7 +2962,7 @@ cp_print_error_function (diagnostic_context *context,
const char *file = LOCATION_FILE (diagnostic->location);
tree abstract_origin = diagnostic_abstract_origin (diagnostic);
char *new_prefix = (file && abstract_origin == NULL)
- ? file_name_as_prefix (file) : NULL;
+ ? file_name_as_prefix (context, file) : NULL;
pp_base_set_prefix (context->printer, new_prefix);
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index e454cf31af2..f9a236b9113 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -72,9 +72,12 @@ build_message_string (const char *msg, ...)
/* Same as diagnostic_build_prefix, but only the source FILE is given. */
char *
-file_name_as_prefix (const char *f)
+file_name_as_prefix (diagnostic_context *context, const char *f)
{
- return build_message_string ("%s: ", f);
+ const char *locus_cs
+ = colorize_start (pp_show_color (context->printer), "locus");
+ const char *locus_ce = colorize_stop (pp_show_color (context->printer));
+ return build_message_string ("%s%s:%s ", locus_cs, f, locus_ce);
}
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 3b500964c7d..ae6d2b22aa1 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -293,6 +293,6 @@ void diagnostic_set_caret_max_width (diagnostic_context *context, int value);
/* Pure text formatting support functions. */
-extern char *file_name_as_prefix (const char *);
+extern char *file_name_as_prefix (diagnostic_context *, const char *);
#endif /* ! GCC_DIAGNOSTIC_H */
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 70af8da4b30..901f9b4a300 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -372,7 +372,7 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
const char *old_prefix = context->printer->prefix;
tree abstract_origin = diagnostic_abstract_origin (diagnostic);
char *new_prefix = (file && abstract_origin == NULL)
- ? file_name_as_prefix (file) : NULL;
+ ? file_name_as_prefix (context, file) : NULL;
pp_set_prefix (context->printer, new_prefix);