aboutsummaryrefslogtreecommitdiff
path: root/libcpp/directives.c
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-04 15:32:26 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-04 15:32:26 +0000
commit927b511f7eac5563ce4fbbd32dee24e10ef52357 (patch)
treeb221eae7c64169c5383839dda76552523ac6432e /libcpp/directives.c
parentd272bed8bba6a66ff9c40f4287c13481c8c996cf (diff)
libcpp
PR preprocessor/28165: * internal.h (cpp_in_primary_file): New function. * directives.c (do_include_next): Use cpp_in_primary_file. (do_pragma_once): Likewise. (do_pragma_system_header): Likewise. gcc/testsuite PR preprocessor/28165: * gcc.dg/cpp/pr28165.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120441 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r--libcpp/directives.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 7fb142e48c7..2ef914a435e 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1,6 +1,7 @@
/* CPP Library. (Directive handling.)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -772,7 +773,7 @@ do_include_next (cpp_reader *pfile)
/* If this is the primary source file, warn and use the normal
search logic. */
- if (! pfile->buffer->prev)
+ if (cpp_in_primary_file (pfile))
{
cpp_error (pfile, CPP_DL_WARNING,
"#include_next in primary source file");
@@ -1346,7 +1347,7 @@ do_pragma (cpp_reader *pfile)
static void
do_pragma_once (cpp_reader *pfile)
{
- if (pfile->buffer->prev == NULL)
+ if (cpp_in_primary_file (pfile))
cpp_error (pfile, CPP_DL_WARNING, "#pragma once in main file");
check_eol (pfile);
@@ -1396,9 +1397,7 @@ do_pragma_poison (cpp_reader *pfile)
static void
do_pragma_system_header (cpp_reader *pfile)
{
- cpp_buffer *buffer = pfile->buffer;
-
- if (buffer->prev == 0)
+ if (cpp_in_primary_file (pfile))
cpp_error (pfile, CPP_DL_WARNING,
"#pragma system_header ignored outside include file");
else