summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-23 08:56:02 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-23 08:56:02 +0000
commit8222ea4b6d0d19cd5cc860f24a02896577ff41cc (patch)
tree70f21e8dae3bc404f841f5e72c4f9b383cbea207 /gcc/fortran
parent5dec75684b8a6935aa1f7c18284342102bbe85f2 (diff)
downloadgcc-8222ea4b6d0d19cd5cc860f24a02896577ff41cc.tar.gz
2012-03-23 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 185727 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@185729 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/error.c18
2 files changed, 15 insertions, 11 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 115747ea960..a316336b52d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2012-03-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/52559
+ * error.c (gfc_widechar_display_length): Consider tabs as
+ one character wide, as they're displayed as spaces.
+ (show_locus): Move tab handling to...
+ (print_wide_char_into_buffer): ... here.
+
2012-03-17 Tobias Burnus <burnus@net-b.de>
PR fortran/52585
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index a8c2b63a6d9..e9308374ac6 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -178,8 +178,8 @@ error_integer (long int i)
static size_t
gfc_widechar_display_length (gfc_char_t c)
{
- if (gfc_wide_is_printable (c))
- /* Simple ASCII character */
+ if (gfc_wide_is_printable (c) || c == '\t')
+ /* Printable ASCII character, or tabulation (output as a space). */
return 1;
else if (c < ((gfc_char_t) 1 << 8))
/* Displayed as \x?? */
@@ -213,10 +213,11 @@ print_wide_char_into_buffer (gfc_char_t c, char *buf)
static const char xdigit[16] = { '0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- if (gfc_wide_is_printable (c))
+ if (gfc_wide_is_printable (c) || c == '\t')
{
buf[1] = '\0';
- buf[0] = (unsigned char) c;
+ /* Tabulation is output as a space. */
+ buf[0] = (unsigned char) (c == '\t' ? ' ' : c);
return 1;
}
else if (c < ((gfc_char_t) 1 << 8))
@@ -291,7 +292,7 @@ show_locus (locus *loc, int c1, int c2)
{
gfc_linebuf *lb;
gfc_file *f;
- gfc_char_t c, *p;
+ gfc_char_t *p;
int i, offset, cmax;
/* TODO: Either limit the total length and number of included files
@@ -370,12 +371,7 @@ show_locus (locus *loc, int c1, int c2)
while (i > 0)
{
static char buffer[11];
-
- c = *p++;
- if (c == '\t')
- c = ' ';
-
- i -= print_wide_char_into_buffer (c, buffer);
+ i -= print_wide_char_into_buffer (*p++, buffer);
error_string (buffer);
}