This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Failing to emit # directives for #line N "foo"
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: Failing to emit # directives for #line N "foo"
- From: Alexandre Oliva <oliva at lsd dot ic dot unicamp dot br>
- Date: 25 Feb 2000 02:23:22 -0300
- Cc: Zack Weinberg <zack at wolery dot cumb dot org>
- References: <orsnytlh8u.fsf@garnize.lsd.ic.unicamp.br>
On Feb 16, 2000, Alexandre Oliva <oliva@lsd.ic.unicamp.br> wrote:
> You'll notice that the error message printed by GCC refers to cpp-1.c,
> not to `foo' as it should because of the #line directive.
> Any ideas about how to test for this error in the testsuite?
Here's the testcase I've just installed.
/* Copyright (C) 2000 Free Software Foundation.
by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */
/* { dg-do preprocess } */
/* The line number below must be just a few lines greater than the
actual line number. */
#line 10 "baz"
/*
{ dg-final { if \{ [grep cpp-li1.i baz] != "" \} \{ } }
{ dg-final { pass "cpp-li1.i: #line directive optimization" } }
{ dg-final { \} else \{ } }
{ dg-final { fail "cpp-li1.i: #line directive optimization" } }
{ dg-final { \} } }
*/
While I was at it, I added two other testcases:
/* Copyright (C) 2000 Free Software Foundation.
by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */
/* { dg-do preprocess } */
#line 1
#line 0
#line 2
#line 32768
/* { dg-error "out of range" "line # too low" { target *-*-* } 1 } */
/* { dg-error "out of range" "line # too high" { target *-*-* } 2 } */
/* Copyright (C) 2000 Free Software Foundation.
by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */
/* { dg-do preprocess } */
#line 1 L"foo" /* { dg-error "not a string" "wide string in #line" } */
#include L"stdio.h" /* { dg-error "expects" "wide string in #include" } */
#pragma implementation L"test.h" /* { dg-error "malformed" "wide string in #pragma implementation" } */
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Enjoy Guaranį
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me