re PR preprocessor/7526 (cpp0 core dump when _Pragma implies #pragma dependency)

PR preprocessor/7526
	* cpplib.c (run_directive): Kludge so _Pragma dependency works.
testsuite:
	* gcc.dg/cpp/_Pragma3.c: New test.

From-SVN: r56332
This commit is contained in:
Neil Booth 2002-08-14 20:17:55 +00:00 committed by Neil Booth
parent 4168506336
commit 8bfb14674d
4 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-08-14 Neil Booth <neil@daikokuya.co.uk>
PR preprocessor/7526
* cpplib.c (run_directive): Kludge so _Pragma dependency works.
2002-08-14 Nathan Sidwell <nathan@codesourcery.com>
* doc/invoke.texi (-a): Remove documentation.

View File

@ -459,6 +459,9 @@ run_directive (pfile, dir_no, buf, count)
{
cpp_push_buffer (pfile, (const uchar *) buf, count,
/* from_stage3 */ true, 1);
/* Disgusting hack. */
if (dir_no == T_PRAGMA)
pfile->buffer->inc = pfile->buffer->prev->inc;
start_directive (pfile);
/* We don't want a leading # to be interpreted as a directive. */
pfile->buffer->saved_flags = 0;
@ -467,6 +470,8 @@ run_directive (pfile, dir_no, buf, count)
prepare_directive_trad (pfile);
(void) (*pfile->directive->handler) (pfile);
end_directive (pfile, 1);
if (dir_no == T_PRAGMA)
pfile->buffer->inc = NULL;
_cpp_pop_buffer (pfile);
}

View File

@ -1,3 +1,7 @@
2002-08-14 Neil Booth <neil@daikokuya.co.uk>
* gcc.dg/cpp/_Pragma3.c: New test.
2002-08-13 Mark Mitchell <mark@codesourcery.com>
* g++.dg/template/inherit3: New test.

View File

@ -0,0 +1,11 @@
/* Copyright (C) 2002 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* Pragma buffers have a NULL "inc" member, which we would dereference
when getting a file's date and time.
Based on PR 7526. 14 Aug 2002. */
#define GCC_PRAGMA(x) _Pragma (#x)
GCC_PRAGMA(GCC dependency "mi1c.h")