public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR cpp/36674 #include location is offset by one row in errors from preprocessed files
@ 2008-08-27  8:24 Manuel López-Ibáñez
  2008-08-27  9:21 ` Manuel López-Ibáñez
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Manuel López-Ibáñez @ 2008-08-27  8:24 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
--enable-languages=all,ada

OK for trunk?

2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR cpp/36674
libcpp/
	* directives (do_linemarker): Compensate for the increment in
	location that occurs when we reach the end of line.
	* files (_cpp_stack_include): Mention _cpp_find_file in the
	comment.
testsuite/
	* gcc.dg/cpp/pr36674.i: New.

[-- Attachment #2: fix-pr36674.diff --]
[-- Type: text/plain, Size: 3226 bytes --]

Index: gcc/testsuite/gcc.dg/cpp/pr36674.i
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
@@ -0,0 +1,12 @@
+/* PR cpp/36674  #include location is offset by one row in errors from preprocessed files */
+/* { dg-do compile } */
+/* { dg-options "-fshow-column" } */
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1
+not_declared_yet();
+# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2
+/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */
+/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */
\ No newline at end of file
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 139373)
+++ libcpp/directives.c	(working copy)
@@ -999,10 +999,18 @@ do_linemarker (cpp_reader *pfile)
 		 cpp_token_as_text (pfile, token));
       return;
     }
 
   skip_rest_of_line (pfile);
+
+  /* Compensate for the increment in linemap_add that occurs in
+     skip_rest_of_line.  We're currently at the start of the line
+     *following* the #line directive.  A separate source_location for this
+     location makes no sense (until we do the LC_LEAVE), and
+     complicates LAST_SOURCE_LINE_LOCATION.  */
+  pfile->line_table->highest_location--;
+
   _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
 }
 
 /* Arrange the file_change callback.  pfile->line has changed to
    FILE_LINE of TO_FILE, for reason REASON.  SYSP is 1 for a system
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 139373)
+++ libcpp/files.c	(working copy)
@@ -910,17 +910,18 @@ _cpp_stack_include (cpp_reader *pfile, c
   if (!dir)
     return false;
 
   file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
 
-  /* Compensate for the increment in linemap_add.  In the case of a
-     normal #include, we're currently at the start of the line
-     *following* the #include.  A separate source_location for this
-     location makes no sense (until we do the LC_LEAVE), and
-     complicates LAST_SOURCE_LINE_LOCATION.  This does not apply if we
-     found a PCH file (in which case linemap_add is not called) or we
-     were included from the command-line.  */
+  /* Compensate for the increment in linemap_add that occured in
+     _cpp_find_file.  In the case of a normal #include, we're
+     currently at the start of the line *following* the #include.  A
+     separate source_location for this location makes no sense (until
+     we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
+     This does not apply if we found a PCH file (in which case
+     linemap_add is not called) or we were included from the
+     command-line.  */
   if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
     pfile->line_table->highest_location--;
 
   return _cpp_stack_file (pfile, file, type == IT_IMPORT);
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* PR cpp/36674 #include location is offset by one row in errors from preprocessed files
  2008-08-27  8:24 PR cpp/36674 #include location is offset by one row in errors from preprocessed files Manuel López-Ibáñez
@ 2008-08-27  9:21 ` Manuel López-Ibáñez
  2008-08-27 15:39 ` Manuel López-Ibáñez
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Manuel López-Ibáñez @ 2008-08-27  9:21 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
--enable-languages=all,ada

OK for trunk?

2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR cpp/36674
libcpp/
	* directives (do_linemarker): Compensate for the increment in
	location that occurs when we reach the end of line.
	* files (_cpp_stack_include): Mention _cpp_find_file in the
	comment.
testsuite/
	* gcc.dg/cpp/pr36674.i: New.

[-- Attachment #2: fix-pr36674.diff --]
[-- Type: text/plain, Size: 3226 bytes --]

Index: gcc/testsuite/gcc.dg/cpp/pr36674.i
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
@@ -0,0 +1,12 @@
+/* PR cpp/36674  #include location is offset by one row in errors from preprocessed files */
+/* { dg-do compile } */
+/* { dg-options "-fshow-column" } */
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1
+not_declared_yet();
+# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2
+/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */
+/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */
\ No newline at end of file
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 139373)
+++ libcpp/directives.c	(working copy)
@@ -999,10 +999,18 @@ do_linemarker (cpp_reader *pfile)
 		 cpp_token_as_text (pfile, token));
       return;
     }
 
   skip_rest_of_line (pfile);
+
+  /* Compensate for the increment in linemap_add that occurs in
+     skip_rest_of_line.  We're currently at the start of the line
+     *following* the #line directive.  A separate source_location for this
+     location makes no sense (until we do the LC_LEAVE), and
+     complicates LAST_SOURCE_LINE_LOCATION.  */
+  pfile->line_table->highest_location--;
+
   _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
 }
 
 /* Arrange the file_change callback.  pfile->line has changed to
    FILE_LINE of TO_FILE, for reason REASON.  SYSP is 1 for a system
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 139373)
+++ libcpp/files.c	(working copy)
@@ -910,17 +910,18 @@ _cpp_stack_include (cpp_reader *pfile, c
   if (!dir)
     return false;
 
   file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
 
-  /* Compensate for the increment in linemap_add.  In the case of a
-     normal #include, we're currently at the start of the line
-     *following* the #include.  A separate source_location for this
-     location makes no sense (until we do the LC_LEAVE), and
-     complicates LAST_SOURCE_LINE_LOCATION.  This does not apply if we
-     found a PCH file (in which case linemap_add is not called) or we
-     were included from the command-line.  */
+  /* Compensate for the increment in linemap_add that occured in
+     _cpp_find_file.  In the case of a normal #include, we're
+     currently at the start of the line *following* the #include.  A
+     separate source_location for this location makes no sense (until
+     we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
+     This does not apply if we found a PCH file (in which case
+     linemap_add is not called) or we were included from the
+     command-line.  */
   if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
     pfile->line_table->highest_location--;
 
   return _cpp_stack_file (pfile, file, type == IT_IMPORT);
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* PR cpp/36674 #include location is offset by one row in errors from preprocessed files
  2008-08-27  8:24 PR cpp/36674 #include location is offset by one row in errors from preprocessed files Manuel López-Ibáñez
  2008-08-27  9:21 ` Manuel López-Ibáñez
@ 2008-08-27 15:39 ` Manuel López-Ibáñez
  2008-08-27 17:24 ` Manuel López-Ibáñez
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Manuel López-Ibáñez @ 2008-08-27 15:39 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
--enable-languages=all,ada

OK for trunk?

2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR cpp/36674
libcpp/
	* directives (do_linemarker): Compensate for the increment in
	location that occurs when we reach the end of line.
	* files (_cpp_stack_include): Mention _cpp_find_file in the
	comment.
testsuite/
	* gcc.dg/cpp/pr36674.i: New.

[-- Attachment #2: fix-pr36674.diff --]
[-- Type: text/plain, Size: 3226 bytes --]

Index: gcc/testsuite/gcc.dg/cpp/pr36674.i
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
@@ -0,0 +1,12 @@
+/* PR cpp/36674  #include location is offset by one row in errors from preprocessed files */
+/* { dg-do compile } */
+/* { dg-options "-fshow-column" } */
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1
+not_declared_yet();
+# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2
+/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */
+/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */
\ No newline at end of file
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 139373)
+++ libcpp/directives.c	(working copy)
@@ -999,10 +999,18 @@ do_linemarker (cpp_reader *pfile)
 		 cpp_token_as_text (pfile, token));
       return;
     }
 
   skip_rest_of_line (pfile);
+
+  /* Compensate for the increment in linemap_add that occurs in
+     skip_rest_of_line.  We're currently at the start of the line
+     *following* the #line directive.  A separate source_location for this
+     location makes no sense (until we do the LC_LEAVE), and
+     complicates LAST_SOURCE_LINE_LOCATION.  */
+  pfile->line_table->highest_location--;
+
   _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
 }
 
 /* Arrange the file_change callback.  pfile->line has changed to
    FILE_LINE of TO_FILE, for reason REASON.  SYSP is 1 for a system
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 139373)
+++ libcpp/files.c	(working copy)
@@ -910,17 +910,18 @@ _cpp_stack_include (cpp_reader *pfile, c
   if (!dir)
     return false;
 
   file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
 
-  /* Compensate for the increment in linemap_add.  In the case of a
-     normal #include, we're currently at the start of the line
-     *following* the #include.  A separate source_location for this
-     location makes no sense (until we do the LC_LEAVE), and
-     complicates LAST_SOURCE_LINE_LOCATION.  This does not apply if we
-     found a PCH file (in which case linemap_add is not called) or we
-     were included from the command-line.  */
+  /* Compensate for the increment in linemap_add that occured in
+     _cpp_find_file.  In the case of a normal #include, we're
+     currently at the start of the line *following* the #include.  A
+     separate source_location for this location makes no sense (until
+     we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
+     This does not apply if we found a PCH file (in which case
+     linemap_add is not called) or we were included from the
+     command-line.  */
   if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
     pfile->line_table->highest_location--;
 
   return _cpp_stack_file (pfile, file, type == IT_IMPORT);
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* PR cpp/36674 #include location is offset by one row in errors from preprocessed files
  2008-08-27  8:24 PR cpp/36674 #include location is offset by one row in errors from preprocessed files Manuel López-Ibáñez
  2008-08-27  9:21 ` Manuel López-Ibáñez
  2008-08-27 15:39 ` Manuel López-Ibáñez
@ 2008-08-27 17:24 ` Manuel López-Ibáñez
  2008-08-27 19:22 ` Manuel López-Ibáñez
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Manuel López-Ibáñez @ 2008-08-27 17:24 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
--enable-languages=all,ada

OK for trunk?

2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR cpp/36674
libcpp/
	* directives (do_linemarker): Compensate for the increment in
	location that occurs when we reach the end of line.
	* files (_cpp_stack_include): Mention _cpp_find_file in the
	comment.
testsuite/
	* gcc.dg/cpp/pr36674.i: New.

[-- Attachment #2: fix-pr36674.diff --]
[-- Type: text/plain, Size: 3226 bytes --]

Index: gcc/testsuite/gcc.dg/cpp/pr36674.i
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
@@ -0,0 +1,12 @@
+/* PR cpp/36674  #include location is offset by one row in errors from preprocessed files */
+/* { dg-do compile } */
+/* { dg-options "-fshow-column" } */
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1
+not_declared_yet();
+# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2
+/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */
+/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */
\ No newline at end of file
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 139373)
+++ libcpp/directives.c	(working copy)
@@ -999,10 +999,18 @@ do_linemarker (cpp_reader *pfile)
 		 cpp_token_as_text (pfile, token));
       return;
     }
 
   skip_rest_of_line (pfile);
+
+  /* Compensate for the increment in linemap_add that occurs in
+     skip_rest_of_line.  We're currently at the start of the line
+     *following* the #line directive.  A separate source_location for this
+     location makes no sense (until we do the LC_LEAVE), and
+     complicates LAST_SOURCE_LINE_LOCATION.  */
+  pfile->line_table->highest_location--;
+
   _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
 }
 
 /* Arrange the file_change callback.  pfile->line has changed to
    FILE_LINE of TO_FILE, for reason REASON.  SYSP is 1 for a system
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 139373)
+++ libcpp/files.c	(working copy)
@@ -910,17 +910,18 @@ _cpp_stack_include (cpp_reader *pfile, c
   if (!dir)
     return false;
 
   file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
 
-  /* Compensate for the increment in linemap_add.  In the case of a
-     normal #include, we're currently at the start of the line
-     *following* the #include.  A separate source_location for this
-     location makes no sense (until we do the LC_LEAVE), and
-     complicates LAST_SOURCE_LINE_LOCATION.  This does not apply if we
-     found a PCH file (in which case linemap_add is not called) or we
-     were included from the command-line.  */
+  /* Compensate for the increment in linemap_add that occured in
+     _cpp_find_file.  In the case of a normal #include, we're
+     currently at the start of the line *following* the #include.  A
+     separate source_location for this location makes no sense (until
+     we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
+     This does not apply if we found a PCH file (in which case
+     linemap_add is not called) or we were included from the
+     command-line.  */
   if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
     pfile->line_table->highest_location--;
 
   return _cpp_stack_file (pfile, file, type == IT_IMPORT);
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* PR cpp/36674 #include location is offset by one row in errors from preprocessed files
  2008-08-27  8:24 PR cpp/36674 #include location is offset by one row in errors from preprocessed files Manuel López-Ibáñez
                   ` (2 preceding siblings ...)
  2008-08-27 17:24 ` Manuel López-Ibáñez
@ 2008-08-27 19:22 ` Manuel López-Ibáñez
  2008-08-27 21:17 ` Manuel López-Ibáñez
  2008-10-21 16:30 ` Manuel López-Ibáñez
  5 siblings, 0 replies; 12+ messages in thread
From: Manuel López-Ibáñez @ 2008-08-27 19:22 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
--enable-languages=all,ada

OK for trunk?

2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR cpp/36674
libcpp/
	* directives (do_linemarker): Compensate for the increment in
	location that occurs when we reach the end of line.
	* files (_cpp_stack_include): Mention _cpp_find_file in the
	comment.
testsuite/
	* gcc.dg/cpp/pr36674.i: New.

[-- Attachment #2: fix-pr36674.diff --]
[-- Type: text/plain, Size: 3226 bytes --]

Index: gcc/testsuite/gcc.dg/cpp/pr36674.i
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
@@ -0,0 +1,12 @@
+/* PR cpp/36674  #include location is offset by one row in errors from preprocessed files */
+/* { dg-do compile } */
+/* { dg-options "-fshow-column" } */
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1
+not_declared_yet();
+# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2
+/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */
+/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */
\ No newline at end of file
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 139373)
+++ libcpp/directives.c	(working copy)
@@ -999,10 +999,18 @@ do_linemarker (cpp_reader *pfile)
 		 cpp_token_as_text (pfile, token));
       return;
     }
 
   skip_rest_of_line (pfile);
+
+  /* Compensate for the increment in linemap_add that occurs in
+     skip_rest_of_line.  We're currently at the start of the line
+     *following* the #line directive.  A separate source_location for this
+     location makes no sense (until we do the LC_LEAVE), and
+     complicates LAST_SOURCE_LINE_LOCATION.  */
+  pfile->line_table->highest_location--;
+
   _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
 }
 
 /* Arrange the file_change callback.  pfile->line has changed to
    FILE_LINE of TO_FILE, for reason REASON.  SYSP is 1 for a system
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 139373)
+++ libcpp/files.c	(working copy)
@@ -910,17 +910,18 @@ _cpp_stack_include (cpp_reader *pfile, c
   if (!dir)
     return false;
 
   file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
 
-  /* Compensate for the increment in linemap_add.  In the case of a
-     normal #include, we're currently at the start of the line
-     *following* the #include.  A separate source_location for this
-     location makes no sense (until we do the LC_LEAVE), and
-     complicates LAST_SOURCE_LINE_LOCATION.  This does not apply if we
-     found a PCH file (in which case linemap_add is not called) or we
-     were included from the command-line.  */
+  /* Compensate for the increment in linemap_add that occured in
+     _cpp_find_file.  In the case of a normal #include, we're
+     currently at the start of the line *following* the #include.  A
+     separate source_location for this location makes no sense (until
+     we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
+     This does not apply if we found a PCH file (in which case
+     linemap_add is not called) or we were included from the
+     command-line.  */
   if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
     pfile->line_table->highest_location--;
 
   return _cpp_stack_file (pfile, file, type == IT_IMPORT);
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* PR cpp/36674 #include location is offset by one row in errors from preprocessed files
  2008-08-27  8:24 PR cpp/36674 #include location is offset by one row in errors from preprocessed files Manuel López-Ibáñez
                   ` (3 preceding siblings ...)
  2008-08-27 19:22 ` Manuel López-Ibáñez
@ 2008-08-27 21:17 ` Manuel López-Ibáñez
  2008-10-21 16:30 ` Manuel López-Ibáñez
  5 siblings, 0 replies; 12+ messages in thread
From: Manuel López-Ibáñez @ 2008-08-27 21:17 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
--enable-languages=all,ada

OK for trunk?

2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR cpp/36674
libcpp/
	* directives (do_linemarker): Compensate for the increment in
	location that occurs when we reach the end of line.
	* files (_cpp_stack_include): Mention _cpp_find_file in the
	comment.
testsuite/
	* gcc.dg/cpp/pr36674.i: New.

[-- Attachment #2: fix-pr36674.diff --]
[-- Type: text/plain, Size: 3226 bytes --]

Index: gcc/testsuite/gcc.dg/cpp/pr36674.i
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
@@ -0,0 +1,12 @@
+/* PR cpp/36674  #include location is offset by one row in errors from preprocessed files */
+/* { dg-do compile } */
+/* { dg-options "-fshow-column" } */
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1
+not_declared_yet();
+# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2
+/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */
+/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */
\ No newline at end of file
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 139373)
+++ libcpp/directives.c	(working copy)
@@ -999,10 +999,18 @@ do_linemarker (cpp_reader *pfile)
 		 cpp_token_as_text (pfile, token));
       return;
     }
 
   skip_rest_of_line (pfile);
+
+  /* Compensate for the increment in linemap_add that occurs in
+     skip_rest_of_line.  We're currently at the start of the line
+     *following* the #line directive.  A separate source_location for this
+     location makes no sense (until we do the LC_LEAVE), and
+     complicates LAST_SOURCE_LINE_LOCATION.  */
+  pfile->line_table->highest_location--;
+
   _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
 }
 
 /* Arrange the file_change callback.  pfile->line has changed to
    FILE_LINE of TO_FILE, for reason REASON.  SYSP is 1 for a system
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 139373)
+++ libcpp/files.c	(working copy)
@@ -910,17 +910,18 @@ _cpp_stack_include (cpp_reader *pfile, c
   if (!dir)
     return false;
 
   file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
 
-  /* Compensate for the increment in linemap_add.  In the case of a
-     normal #include, we're currently at the start of the line
-     *following* the #include.  A separate source_location for this
-     location makes no sense (until we do the LC_LEAVE), and
-     complicates LAST_SOURCE_LINE_LOCATION.  This does not apply if we
-     found a PCH file (in which case linemap_add is not called) or we
-     were included from the command-line.  */
+  /* Compensate for the increment in linemap_add that occured in
+     _cpp_find_file.  In the case of a normal #include, we're
+     currently at the start of the line *following* the #include.  A
+     separate source_location for this location makes no sense (until
+     we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
+     This does not apply if we found a PCH file (in which case
+     linemap_add is not called) or we were included from the
+     command-line.  */
   if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
     pfile->line_table->highest_location--;
 
   return _cpp_stack_file (pfile, file, type == IT_IMPORT);
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PR cpp/36674 #include location is offset by one row in errors from preprocessed files
  2008-08-27  8:24 PR cpp/36674 #include location is offset by one row in errors from preprocessed files Manuel López-Ibáñez
                   ` (4 preceding siblings ...)
  2008-08-27 21:17 ` Manuel López-Ibáñez
@ 2008-10-21 16:30 ` Manuel López-Ibáñez
  2009-04-21 16:33   ` Manuel López-Ibáñez
  5 siblings, 1 reply; 12+ messages in thread
From: Manuel López-Ibáñez @ 2008-10-21 16:30 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

I have updated the patch to a recent revision, bootstrapped and
regression tested.

OK for trunk?

Manuel.

2008/8/26 Manuel López-Ibáñez <lopezibanez@gmail.com>:
> Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
> --enable-languages=all,ada
>
> OK for trunk?
>
> 2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
>
>        PR cpp/36674
> libcpp/
>        * directives (do_linemarker): Compensate for the increment in
>        location that occurs when we reach the end of line.
>        * files (_cpp_stack_include): Mention _cpp_find_file in the
>        comment.
> testsuite/
>        * gcc.dg/cpp/pr36674.i: New.
>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-pr36674.diff --]
[-- Type: text/x-diff; name=fix-pr36674.diff, Size: 3228 bytes --]

Index: gcc/testsuite/gcc.dg/cpp/pr36674.i
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
@@ -0,0 +1,12 @@
+/* PR cpp/36674  #include location is offset by one row in errors from preprocessed files */
+/* { dg-do compile } */
+/* { dg-options "-fshow-column" } */
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1
+not_declared_yet();
+# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2
+/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */
+/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */
\ No newline at end of file
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 141202)
+++ libcpp/directives.c	(working copy)
@@ -999,10 +999,18 @@ do_linemarker (cpp_reader *pfile)
 		 cpp_token_as_text (pfile, token));
       return;
     }
 
   skip_rest_of_line (pfile);
+
+  /* Compensate for the increment in linemap_add that occurs in
+     _cpp_do_file_change.  We're currently at the start of the line
+     *following* the #line directive.  A separate source_location for this
+     location makes no sense (until we do the LC_LEAVE), and
+     complicates LAST_SOURCE_LINE_LOCATION.  */
+  pfile->line_table->highest_location--;
+
   _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
 }
 
 /* Arrange the file_change callback.  pfile->line has changed to
    FILE_LINE of TO_FILE, for reason REASON.  SYSP is 1 for a system
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 141202)
+++ libcpp/files.c	(working copy)
@@ -910,17 +910,18 @@ _cpp_stack_include (cpp_reader *pfile, c
   if (!dir)
     return false;
 
   file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
 
-  /* Compensate for the increment in linemap_add.  In the case of a
-     normal #include, we're currently at the start of the line
-     *following* the #include.  A separate source_location for this
-     location makes no sense (until we do the LC_LEAVE), and
-     complicates LAST_SOURCE_LINE_LOCATION.  This does not apply if we
-     found a PCH file (in which case linemap_add is not called) or we
-     were included from the command-line.  */
+  /* Compensate for the increment in linemap_add that occurs in
+     _cpp_stack_file.  In the case of a normal #include, we're
+     currently at the start of the line *following* the #include.  A
+     separate source_location for this location makes no sense (until
+     we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
+     This does not apply if we found a PCH file (in which case
+     linemap_add is not called) or we were included from the
+     command-line.  */
   if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
     pfile->line_table->highest_location--;
 
   return _cpp_stack_file (pfile, file, type == IT_IMPORT);
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PR cpp/36674 #include location is offset by one row in errors   from preprocessed files
  2008-10-21 16:30 ` Manuel López-Ibáñez
@ 2009-04-21 16:33   ` Manuel López-Ibáñez
  2009-05-01 14:14     ` Manuel López-Ibáñez
  0 siblings, 1 reply; 12+ messages in thread
From: Manuel López-Ibáñez @ 2009-04-21 16:33 UTC (permalink / raw)
  To: Gcc Patch List; +Cc: Joseph Myers, Tom Tromey, Mark Mitchell

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

PING2.

I have updated the patch to a recent revision, bootstrapped and
regression tested.

Cheers,

Manuel.

2008/10/21 Manuel López-Ibáñez <lopezibanez@gmail.com>:
> I have updated the patch to a recent revision, bootstrapped and
> regression tested.
>
> OK for trunk?
>
> Manuel.
>
> 2008/8/26 Manuel López-Ibáñez <lopezibanez@gmail.com>:
>> Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
>> --enable-languages=all,ada
>>
>> OK for trunk?
>>
>> 2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
>>
>>        PR cpp/36674
>> libcpp/
>>        * directives (do_linemarker): Compensate for the increment in
>>        location that occurs when we reach the end of line.
>>        * files (_cpp_stack_include): Mention _cpp_find_file in the
>>        comment.
>> testsuite/
>>        * gcc.dg/cpp/pr36674.i: New.
>>
>

[-- Attachment #2: fix-pr36674.diff --]
[-- Type: text/x-diff, Size: 3230 bytes --]

Index: gcc/testsuite/gcc.dg/cpp/pr36674.i
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr36674.i	(revision 0)
@@ -0,0 +1,12 @@
+/* PR cpp/36674  #include location is offset by one row in errors from preprocessed files */
+/* { dg-do compile } */
+/* { dg-options "-fshow-column" } */
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "gcc/testsuite/gcc.dg/pr36674.c"
+# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1
+not_declared_yet();
+# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2
+/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */
+/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */
\ No newline at end of file
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 146528)
+++ libcpp/directives.c	(working copy)
@@ -1002,10 +1002,18 @@ do_linemarker (cpp_reader *pfile)
 		 cpp_token_as_text (pfile, token));
       return;
     }
 
   skip_rest_of_line (pfile);
+
+  /* Compensate for the increment in linemap_add that occurs in
+     _cpp_do_file_change.  We're currently at the start of the line
+     *following* the #line directive.  A separate source_location for this
+     location makes no sense (until we do the LC_LEAVE), and
+     complicates LAST_SOURCE_LINE_LOCATION.  */
+  pfile->line_table->highest_location--;
+
   _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
 }
 
 /* Arrange the file_change callback.  pfile->line has changed to
    FILE_LINE of TO_FILE, for reason REASON.  SYSP is 1 for a system
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 146528)
+++ libcpp/files.c	(working copy)
@@ -910,17 +910,18 @@ _cpp_stack_include (cpp_reader *pfile, c
   if (!dir)
     return false;
 
   file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
 
-  /* Compensate for the increment in linemap_add.  In the case of a
-     normal #include, we're currently at the start of the line
-     *following* the #include.  A separate source_location for this
-     location makes no sense (until we do the LC_LEAVE), and
-     complicates LAST_SOURCE_LINE_LOCATION.  This does not apply if we
-     found a PCH file (in which case linemap_add is not called) or we
-     were included from the command-line.  */
+  /* Compensate for the increment in linemap_add that occurs in
+     _cpp_stack_file.  In the case of a normal #include, we're
+     currently at the start of the line *following* the #include.  A
+     separate source_location for this location makes no sense (until
+     we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION.
+     This does not apply if we found a PCH file (in which case
+     linemap_add is not called) or we were included from the
+     command-line.  */
   if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
     pfile->line_table->highest_location--;
 
   return _cpp_stack_file (pfile, file, type == IT_IMPORT);
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PR cpp/36674 #include location is offset by one row in errors   from preprocessed files
  2009-04-21 16:33   ` Manuel López-Ibáñez
@ 2009-05-01 14:14     ` Manuel López-Ibáñez
  2009-05-11 13:26       ` Manuel López-Ibáñez
  0 siblings, 1 reply; 12+ messages in thread
From: Manuel López-Ibáñez @ 2009-05-01 14:14 UTC (permalink / raw)
  To: Gcc Patch List; +Cc: Joseph Myers, Tom Tromey, Mark Mitchell

PING3. http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01649.html


2009/4/21 Manuel López-Ibáñez <lopezibanez@gmail.com>:
> PING2.
>
> I have updated the patch to a recent revision, bootstrapped and
> regression tested.
>
> Cheers,
>
> Manuel.
>
> 2008/10/21 Manuel López-Ibáñez <lopezibanez@gmail.com>:
>> I have updated the patch to a recent revision, bootstrapped and
>> regression tested.
>>
>> OK for trunk?
>>
>> Manuel.
>>
>> 2008/8/26 Manuel López-Ibáñez <lopezibanez@gmail.com>:
>>> Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
>>> --enable-languages=all,ada
>>>
>>> OK for trunk?
>>>
>>> 2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
>>>
>>>        PR cpp/36674
>>> libcpp/
>>>        * directives (do_linemarker): Compensate for the increment in
>>>        location that occurs when we reach the end of line.
>>>        * files (_cpp_stack_include): Mention _cpp_find_file in the
>>>        comment.
>>> testsuite/
>>>        * gcc.dg/cpp/pr36674.i: New.
>>>
>>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PR cpp/36674 #include location is offset by one row in errors   from preprocessed files
  2009-05-01 14:14     ` Manuel López-Ibáñez
@ 2009-05-11 13:26       ` Manuel López-Ibáñez
  2009-05-12  7:15         ` Gabriel Dos Reis
  2009-05-13 12:29         ` Joseph S. Myers
  0 siblings, 2 replies; 12+ messages in thread
From: Manuel López-Ibáñez @ 2009-05-11 13:26 UTC (permalink / raw)
  To: Gcc Patch List; +Cc: Joseph Myers, Tom Tromey, Mark Mitchell

PING4

2009/5/1 Manuel López-Ibáñez <lopezibanez@gmail.com>:
> PING3. http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01649.html
>
>
> 2009/4/21 Manuel López-Ibáñez <lopezibanez@gmail.com>:
>> PING2.
>>
>> I have updated the patch to a recent revision, bootstrapped and
>> regression tested.
>>
>> Cheers,
>>
>> Manuel.
>>
>> 2008/10/21 Manuel López-Ibáñez <lopezibanez@gmail.com>:
>>> I have updated the patch to a recent revision, bootstrapped and
>>> regression tested.
>>>
>>> OK for trunk?
>>>
>>> Manuel.
>>>
>>> 2008/8/26 Manuel López-Ibáñez <lopezibanez@gmail.com>:
>>>> Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
>>>> --enable-languages=all,ada
>>>>
>>>> OK for trunk?
>>>>
>>>> 2008-08-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
>>>>
>>>>        PR cpp/36674
>>>> libcpp/
>>>>        * directives (do_linemarker): Compensate for the increment in
>>>>        location that occurs when we reach the end of line.
>>>>        * files (_cpp_stack_include): Mention _cpp_find_file in the
>>>>        comment.
>>>> testsuite/
>>>>        * gcc.dg/cpp/pr36674.i: New.
>>>>
>>>
>>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PR cpp/36674 #include location is offset by one row in errors   from preprocessed files
  2009-05-11 13:26       ` Manuel López-Ibáñez
@ 2009-05-12  7:15         ` Gabriel Dos Reis
  2009-05-13 12:29         ` Joseph S. Myers
  1 sibling, 0 replies; 12+ messages in thread
From: Gabriel Dos Reis @ 2009-05-12  7:15 UTC (permalink / raw)
  To: Manuel López-Ibáñez
  Cc: Gcc Patch List, Joseph Myers, Tom Tromey, Mark Mitchell

On Mon, May 11, 2009 at 8:26 AM, Manuel López-Ibáñez
<lopezibanez@gmail.com> wrote:
> PING4

OK -- from diagnostics perspective.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PR cpp/36674 #include location is offset by one row in errors    from preprocessed files
  2009-05-11 13:26       ` Manuel López-Ibáñez
  2009-05-12  7:15         ` Gabriel Dos Reis
@ 2009-05-13 12:29         ` Joseph S. Myers
  1 sibling, 0 replies; 12+ messages in thread
From: Joseph S. Myers @ 2009-05-13 12:29 UTC (permalink / raw)
  To: Manuel López-Ibáñez
  Cc: Gcc Patch List, Tom Tromey, Mark Mitchell

[-- Attachment #1: Type: TEXT/PLAIN, Size: 397 bytes --]

On Mon, 11 May 2009, Manuel López-Ibáñez wrote:

> PING4
> 
> 2009/5/1 Manuel López-Ibáñez <lopezibanez@gmail.com>:
> > PING3. http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01649.html

OK with the "\ No newline at end of file" in the testcase fixed, unless 
the missing newline is essential for the testcase to demonstrate the bug 
and fix.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-05-13 12:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-27  8:24 PR cpp/36674 #include location is offset by one row in errors from preprocessed files Manuel López-Ibáñez
2008-08-27  9:21 ` Manuel López-Ibáñez
2008-08-27 15:39 ` Manuel López-Ibáñez
2008-08-27 17:24 ` Manuel López-Ibáñez
2008-08-27 19:22 ` Manuel López-Ibáñez
2008-08-27 21:17 ` Manuel López-Ibáñez
2008-10-21 16:30 ` Manuel López-Ibáñez
2009-04-21 16:33   ` Manuel López-Ibáñez
2009-05-01 14:14     ` Manuel López-Ibáñez
2009-05-11 13:26       ` Manuel López-Ibáñez
2009-05-12  7:15         ` Gabriel Dos Reis
2009-05-13 12:29         ` Joseph S. Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).