public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] Fix PRAGMA_EOL location
@ 2020-01-31 13:35 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-01-31 13:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1fa99997b3a5ff6923916449fbd54f22059a4c6c

commit 1fa99997b3a5ff6923916449fbd54f22059a4c6c
Author: Nathan Sidwell <nathan@acm.org>
Date:   Thu Jan 30 08:04:02 2020 -0800

    Fix PRAGMA_EOL location
    
    	libcpp/
    	* lex.c (_cpp_lex_direct): Set location of PRAGMA_EOL.
    	gcc/testsuite/
    	* g++.dg/modules/exp-xlate-1_b.C: Add xfailed bogus-error.
    	* g++.dg/modules/cpp-2_c.C: Adjust output scan.
    	* g++.dg/modules/cpp-5_c.C: Likewise.
    	* g++.dg/modules/legacy-3_b.H: Likewise.
    	* g++.dg/modules/legacy-3_c.H: Likewise.
    	* g++.dg/modules/legacy-6_c.C: Likewise.
    	* g++.dg/modules/legacy-6_d.C: likewise.

Diff:
---
 ChangeLog.modules                            | 13 +++++++++++++
 gcc/testsuite/g++.dg/modules/cpp-2_c.C       |  2 +-
 gcc/testsuite/g++.dg/modules/cpp-5_c.C       |  2 +-
 gcc/testsuite/g++.dg/modules/exp-xlate-1_b.C |  4 +++-
 gcc/testsuite/g++.dg/modules/legacy-3_b.H    |  2 +-
 gcc/testsuite/g++.dg/modules/legacy-3_c.H    |  2 +-
 gcc/testsuite/g++.dg/modules/legacy-6_c.C    |  2 +-
 gcc/testsuite/g++.dg/modules/legacy-6_d.C    |  2 +-
 libcpp/lex.c                                 |  6 +++---
 9 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/ChangeLog.modules b/ChangeLog.modules
index efc15ac..b65ae07 100644
--- a/ChangeLog.modules
+++ b/ChangeLog.modules
@@ -1,3 +1,16 @@
+2020-01-30  Nathan Sidwell  <nathan@acm.org>
+
+	libcpp/
+	* lex.c (_cpp_lex_direct): Set location of PRAGMA_EOL.
+	gcc/testsuite/
+	* g++.dg/modules/exp-xlate-1_b.C: Add xfailed bogus-error.
+	* g++.dg/modules/cpp-2_c.C: Adjust output scan.
+	* g++.dg/modules/cpp-5_c.C: Likewise.
+	* g++.dg/modules/legacy-3_b.H: Likewise.
+	* g++.dg/modules/legacy-3_c.H: Likewise.
+	* g++.dg/modules/legacy-6_c.C: Likewise.
+	* g++.dg/modules/legacy-6_d.C: likewise.
+
 2020-01-27  Nathan Sidwell  <nathan@acm.org>
 
 	gcc/
diff --git a/gcc/testsuite/g++.dg/modules/cpp-2_c.C b/gcc/testsuite/g++.dg/modules/cpp-2_c.C
index 45643de..4a6d8ee 100644
--- a/gcc/testsuite/g++.dg/modules/cpp-2_c.C
+++ b/gcc/testsuite/g++.dg/modules/cpp-2_c.C
@@ -11,7 +11,7 @@ import nope;
 #endif
 think
 
-// { dg-final { scan-file cpp-2_c.i {cpp-2_c.C"\n\n\n\n__module bob;(\n# 4 "[^\n]*cpp-2_c.C"\n)?\n#pragma GCC unused\n__import "[^\n]*\./cpp-2_b.H" \[\[ CLOSE ]];(\n# 6 "[^\n]*cpp-2_c.C"\n)\n?__import "[^\n]*cpp-2_a.H" \[\[ ]];\n} } }
+// { dg-final { scan-file cpp-2_c.i {cpp-2_c.C"\n\n\n\n__module bob;\n#pragma GCC unused\n__import "[^\n]*\./cpp-2_b.H" \[\[ CLOSE ]];\n__import "[^\n]*cpp-2_a.H" \[\[ ]];\n} } }
 // { dg-final { scan-file cpp-2_c.i "int i;" } }
 // { dg-final { scan-file-not cpp-2_c.i "import nope;" } }
 // { dg-final { scan-file cpp-2_c.i "THIS IS STDIO\n" } }
diff --git a/gcc/testsuite/g++.dg/modules/cpp-5_c.C b/gcc/testsuite/g++.dg/modules/cpp-5_c.C
index b718bf7..9b562d7 100644
--- a/gcc/testsuite/g++.dg/modules/cpp-5_c.C
+++ b/gcc/testsuite/g++.dg/modules/cpp-5_c.C
@@ -7,4 +7,4 @@ import "cpp-5_a.H";
 
 Q
 
-// { dg-final { scan-file cpp-5_c.i {\n__import "[^\n]*cpp-5_a.H";(\n# 6 "[^\n]*cpp-5_c.C"\n)?\n\n0\n} } }
+// { dg-final { scan-file cpp-5_c.i {\n__import "[^\n]*cpp-5_a.H";\n\n0\n} } }
diff --git a/gcc/testsuite/g++.dg/modules/exp-xlate-1_b.C b/gcc/testsuite/g++.dg/modules/exp-xlate-1_b.C
index a953dd8..dd72f39 100644
--- a/gcc/testsuite/g++.dg/modules/exp-xlate-1_b.C
+++ b/gcc/testsuite/g++.dg/modules/exp-xlate-1_b.C
@@ -5,5 +5,7 @@ export module evil;
 // FIXME: xfailing until __import and co are actual keywords.
 export
 #include "exp-xlate-1_a.H" // { dg-error "not permitted" "" { xfail *-*-* } }
-// { dg-bogus "expected" "" { xfail *-*-* } .-1 }
+// { dg-bogus "-:before end of line" "" { xfail *-*-* } }
+// { dg-bogus "before .__import" "" { xfail *-*-* } .-2 }
+
 // { dg-prune-output {not writing module} }
diff --git a/gcc/testsuite/g++.dg/modules/legacy-3_b.H b/gcc/testsuite/g++.dg/modules/legacy-3_b.H
index 6ee6ec1..db62dd8 100644
--- a/gcc/testsuite/g++.dg/modules/legacy-3_b.H
+++ b/gcc/testsuite/g++.dg/modules/legacy-3_b.H
@@ -12,4 +12,4 @@ int move (int X = __LINE__); // Capture __LINE__ in a non-definition
 // this should not be diverted
 #include "legacy-3.h"
 
-// { dg-final { scan-file legacy-3_b.i {\n# 9 "[^\n]*legacy-3_b.H"\n__import "[^\n]*legacy-3_a.H";\n(# 9 "[^\n]*legacy-3_b.H"\n\n)?int move \(int X = 10\);\n} } }
+// { dg-final { scan-file legacy-3_b.i {\n# 9 "[^\n]*legacy-3_b.H"\n__import "[^\n]*legacy-3_a.H";\nint move \(int X = 10\);\n} } }
diff --git a/gcc/testsuite/g++.dg/modules/legacy-3_c.H b/gcc/testsuite/g++.dg/modules/legacy-3_c.H
index ce351a7..cbfa63f 100644
--- a/gcc/testsuite/g++.dg/modules/legacy-3_c.H
+++ b/gcc/testsuite/g++.dg/modules/legacy-3_c.H
@@ -17,7 +17,7 @@ MARK3 __LINE__
 // this should not be translated
 #include "legacy-3.h"
 
-// { dg-final { scan-file legacy-3_c.i {MARK1 8\n__import "[^\n]*legacy-3_a.H";\n(# 9 "[^\n]*legacy-3_c.H"\n\n)?MARK2 10\n} } }
+// { dg-final { scan-file legacy-3_c.i {MARK1 8\n__import "[^\n]*legacy-3_a.H";\nMARK2 10\n} } }
 // We should have stopped.
 // { dg-final { scan-file legacy-3_c.i {move} } }
 // { dg-final { scan-file legacy-3_c.i {MARK2 13\n\nMARK3 15\n} } }
diff --git a/gcc/testsuite/g++.dg/modules/legacy-6_c.C b/gcc/testsuite/g++.dg/modules/legacy-6_c.C
index 4a40c31..65fbc04 100644
--- a/gcc/testsuite/g++.dg/modules/legacy-6_c.C
+++ b/gcc/testsuite/g++.dg/modules/legacy-6_c.C
@@ -5,4 +5,4 @@
 #include "legacy-6_b.H"
 int i;
 
-// { dg-final { scan-file legacy-6_c.i {__import "[^\n]*legacy-6_a.H";(\n# 4 "[^\n]*legacy-6_c.C"\n)?\n__import "[^\n]*legacy-6_b.H";(\n# 5 "[^\n]*legacy-6_c.C"\n)?\nint i;} } }
+// { dg-final { scan-file legacy-6_c.i {__import "[^\n]*legacy-6_a.H";\n__import "[^\n]*legacy-6_b.H";\nint i;} } }
diff --git a/gcc/testsuite/g++.dg/modules/legacy-6_d.C b/gcc/testsuite/g++.dg/modules/legacy-6_d.C
index a83dfc6..19dd580 100644
--- a/gcc/testsuite/g++.dg/modules/legacy-6_d.C
+++ b/gcc/testsuite/g++.dg/modules/legacy-6_d.C
@@ -5,5 +5,5 @@
 int i;
 #include "legacy-6_b.H"
 
-// { dg-final { scan-file legacy-6_d.i {__import "[^\n]*legacy-6_a.H";\n(# 4 "[^\n]*legacy-6_d.C"\n\n)?int i;} } }
+// { dg-final { scan-file legacy-6_d.i {__import "[^\n]*legacy-6_a.H";\nint i;} } }
 // { dg-final { scan-file legacy-6_d.i {int i;\n__import "[^\n]*legacy-6_b.H";\n} } }
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 0d86d7d..2e76a00 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -2847,10 +2847,10 @@ _cpp_lex_direct (cpp_reader *pfile)
     {
       if (pfile->state.in_deferred_pragma)
 	{
-	  // FIXME: It is annoying that we emit a line marker to go
-	  // back one line, and then immediately advance to the next
-	  // line.  (Not modules-specific?)
+	  /* The location is at the start of the line following the
+	     pragma.  */
 	  result->type = CPP_PRAGMA_EOL;
+	  result->src_loc = pfile->line_table->highest_line;
 	  pfile->state.in_deferred_pragma = false;
 	  if (!pfile->state.pragma_allow_expansion)
 	    pfile->state.prevent_expansion--;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-31 13:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 13:35 [gcc/devel/c++-modules] Fix PRAGMA_EOL location Nathan Sidwell

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).