[PATCH, cpp] Fix pr61817 and 69391

Jakub Jelinek jakub@redhat.com
Wed Apr 6 14:39:00 GMT 2016


On Tue, Apr 05, 2016 at 09:22:37AM -0700, Richard Henderson wrote:
> These two related PRs are all about remembering where a macro is expanded.
> Worse, we've got two competing goals -- the real location of the expansion,
> for __LINE__, and the virtual location of the expansion, for diagnostics.
> 
> There seems to be no way to unify the two competing goals.  If we simply
> "fix" the first, we break the second.  Therefore, I resort to passing down
> both locations.
> 
> Ok?
> 
> 
> r~


Missing PR numbers here.

> 	* internal.h (_cpp_builtin_macro_text): Update decl.
> 	* macro.c (_cpp_builtin_macro_text): Accept location for __LINE__.
> 	(builtin_macro): Accept a second location for __LINE__.
> 	(enter_macro_context): Compute both virtual and real expansion
> 	locations for the macro.
> 
> 	* gcc.dg/pr61817.c: New test.
> 	* gcc.dg/pr69391-1.c: New test.
> 	* gcc.dg/pr69391-2.c: New test.
> 
> 
> diff --git a/gcc/testsuite/gcc.dg/pr61817.c b/gcc/testsuite/gcc.dg/pr61817.c
> new file mode 100644
> index 0000000..4230485
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr61817.c
> @@ -0,0 +1,19 @@
> +/* { dg-do compile } */
> +/* { dg-options "-std=c11 -ftrack-macro-expansion=0" } */

Wouldn't it make sense to provide this test also as -1.c and -2.c, one
with -ftrack-macro-expansion=0 and one with -ftrack-macro-expansion=1?

Otherwise LGTM.

	Jakub



More information about the Gcc-patches mailing list