aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-05-17 18:07:16 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-05-17 18:07:16 +0000
commit2c0b35cb894747518533852e3a60cde8a8e6250b (patch)
tree9be6e344dab33858e4721bbe595b287ff04e34ee /gcc/cpplib.c
parent3f69bd930cb156f6b33e8e9d2126c1f956849370 (diff)
downloadgcc-2c0b35cb894747518533852e3a60cde8a8e6250b.zip
gcc-2c0b35cb894747518533852e3a60cde8a8e6250b.tar.gz
gcc-2c0b35cb894747518533852e3a60cde8a8e6250b.tar.bz2
cpplib.c: New feature, #pragma system_header.
* cpplib.c: New feature, #pragma system_header. * cpp.texi: Document special treatment of system headers, and the various mechanisms to get a header that special treatment. From-SVN: r33962
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index c4b6aa4..e249555 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -811,6 +811,7 @@ do_ident (pfile)
static int do_pragma_once PARAMS ((cpp_reader *));
static int do_pragma_implementation PARAMS ((cpp_reader *));
static int do_pragma_poison PARAMS ((cpp_reader *));
+static int do_pragma_system_header PARAMS ((cpp_reader *));
static int do_pragma_default PARAMS ((cpp_reader *));
static int
@@ -846,6 +847,8 @@ do_pragma (pfile)
pop = do_pragma_implementation (pfile);
else if (tokis ("poison"))
pop = do_pragma_poison (pfile);
+ else if (tokis ("system_header"))
+ pop = do_pragma_system_header (pfile);
else
pop = do_pragma_default (pfile);
#undef tokis
@@ -979,6 +982,25 @@ do_pragma_poison (pfile)
}
return !writeit;
}
+
+/* Mark the current header as a system header. This will suppress
+ some categories of warnings (notably those from -pedantic). It is
+ intended for use in system libraries that cannot be implemented in
+ conforming C, but cannot be certain that their headers appear in a
+ system include directory. To prevent abuse, it is rejected in the
+ primary source file. */
+static int
+do_pragma_system_header (pfile)
+ cpp_reader *pfile;
+{
+ cpp_buffer *ip = cpp_file_buffer (pfile);
+ if (CPP_PREV_BUFFER (ip) == NULL)
+ cpp_warning (pfile, "#pragma system_header outside include file");
+ else
+ ip->system_header_p = 1;
+
+ return 1;
+}
/* Just ignore #sccs, on systems where we define it at all. */
#ifdef SCCS_DIRECTIVE