summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-04 07:32:04 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-04 07:32:04 +0000
commitfd944c82b484fee0514fefed73ce1622127976cc (patch)
tree2ee77fc01b58627c217cdfa65bb2e8134086c70b
parent3d75d43c65cad1c53dd9b0321ff7e166c00d1d32 (diff)
downloadgcc-fd944c82b484fee0514fefed73ce1622127976cc.tar.gz
* cppfiles.c (cpp_make_system_header): Take 2 booleans,
and operate on current buffer. (cpp_read_file): Rename _cpp_read_file. * cpplib.c (do_line, do_pragma_system_header): Update calls to cpp_make_system_header. * fix-header.c: Similarly. * cpphash.h (_cpp_read_file): Move from... * cpplib.h: ... here. * cppinit.c (do_includes, cpp_start_read): Update appropriately. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37989 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/cppfiles.c19
-rw-r--r--gcc/cpphash.h1
-rw-r--r--gcc/cppinit.c4
-rw-r--r--gcc/cpplib.c17
-rw-r--r--gcc/cpplib.h3
-rw-r--r--gcc/fix-header.c2
7 files changed, 35 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d38d2d9f03c..f2ff46108ee 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2000-12-04 Neil Booth <neilb@earthling.net>
+
+ * cppfiles.c (cpp_make_system_header): Take 2 booleans,
+ and operate on current buffer.
+ (cpp_read_file): Rename _cpp_read_file.
+ * cpplib.c (do_line, do_pragma_system_header): Update calls to
+ cpp_make_system_header.
+ * fix-header.c: Similarly.
+ * cpphash.h (_cpp_read_file): Move from...
+ * cpplib.h: ... here.
+ * cppinit.c (do_includes, cpp_start_read): Update appropriately.
+
2000-12-03 Kaveh R. Ghazi <ghazi@teal.rutgers.edu>
* builtins.c (expand_builtin_strspn, expand_builtin_strcspn):
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 9af0c396cd7..4043a57c2b9 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -526,17 +526,16 @@ _cpp_fake_include (pfile, fname)
see the details of struct include_file. This is an exported interface
because fix-header needs it. */
void
-cpp_make_system_header (pfile, pbuf, flag)
+cpp_make_system_header (pfile, syshdr, externc)
cpp_reader *pfile;
- cpp_buffer *pbuf;
- int flag;
+ int syshdr, externc;
{
- if (flag < 0 || flag > 2)
- cpp_ice (pfile, "cpp_make_system_header: bad flag %d\n", flag);
- else if (!pbuf->inc)
- cpp_ice (pfile, "cpp_make_system_header called on non-file buffer");
- else
- pbuf->inc->sysp = flag;
+ int flags = 0;
+
+ /* 1 = system header, 2 = system header to be treated as C. */
+ if (syshdr)
+ flags = 1 + (externc != 0);
+ pfile->buffer->inc->sysp = flags;
}
/* Report on all files that might benefit from a multiple include guard.
@@ -714,7 +713,7 @@ _cpp_compare_file_date (pfile, f)
/* Push an input buffer and load it up with the contents of FNAME.
If FNAME is "" or NULL, read standard input. */
int
-cpp_read_file (pfile, fname)
+_cpp_read_file (pfile, fname)
cpp_reader *pfile;
const char *fname;
{
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 698f545cae2..2cab3628bb1 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -224,6 +224,7 @@ extern cpp_hashnode *_cpp_lookup_with_hash PARAMS ((cpp_reader*, size_t,
/* In cppfiles.c */
extern void _cpp_simplify_pathname PARAMS ((char *));
+extern int _cpp_read_file PARAMS ((cpp_reader *, const char *));
extern void _cpp_execute_include PARAMS ((cpp_reader *,
const cpp_token *, int,
struct file_name_list *));
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index e3d12213867..7e5d7f6af67 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -931,7 +931,7 @@ do_includes (pfile, p, scan)
/* Later: maybe update this to use the #include "" search path
if cpp_read_file fails. */
- if (cpp_read_file (pfile, p->arg) && scan)
+ if (_cpp_read_file (pfile, p->arg) && scan)
cpp_scan_buffer_nooutput (pfile, 0);
q = p->next;
free (p);
@@ -1002,7 +1002,7 @@ cpp_start_read (pfile, fname)
if (CPP_OPTION (pfile, out_fname) == NULL)
CPP_OPTION (pfile, out_fname) = "";
- if (!cpp_read_file (pfile, fname))
+ if (!_cpp_read_file (pfile, fname))
return 0;
initialize_dependency_output (pfile);
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index d4b243fc308..197faaf3c18 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -771,23 +771,23 @@ do_line (pfile)
if (action_number == 1)
{
reason = FC_ENTER;
- cpp_make_system_header (pfile, buffer, 0);
+ cpp_make_system_header (pfile, 0, 0);
read_line_number (pfile, &action_number);
}
else if (action_number == 2)
{
reason = FC_LEAVE;
- cpp_make_system_header (pfile, buffer, 0);
+ cpp_make_system_header (pfile, 0, 0);
read_line_number (pfile, &action_number);
}
if (action_number == 3)
{
- cpp_make_system_header (pfile, buffer, 1);
+ cpp_make_system_header (pfile, 1, 0);
read_line_number (pfile, &action_number);
}
if (action_number == 4)
{
- cpp_make_system_header (pfile, buffer, 2);
+ cpp_make_system_header (pfile, 1, 1);
read_line_number (pfile, &action_number);
}
}
@@ -1100,11 +1100,12 @@ static void
do_pragma_system_header (pfile)
cpp_reader *pfile;
{
- cpp_buffer *ip = CPP_BUFFER (pfile);
- if (CPP_PREV_BUFFER (ip) == NULL)
- cpp_warning (pfile, "#pragma system_header outside include file");
+ cpp_buffer *buffer = pfile->buffer;
+
+ if (buffer->prev == 0)
+ cpp_warning (pfile, "#pragma system_header ignored outside include file");
else
- cpp_make_system_header (pfile, ip, 1);
+ cpp_make_system_header (pfile, 1, 0);
check_eol (pfile);
}
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index faccc6a8bf3..524b8f6ed61 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -781,8 +781,7 @@ extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int));
/* In cppfiles.c */
extern int cpp_included PARAMS ((cpp_reader *, const char *));
-extern int cpp_read_file PARAMS ((cpp_reader *, const char *));
-extern void cpp_make_system_header PARAMS ((cpp_reader *, cpp_buffer *, int));
+extern void cpp_make_system_header PARAMS ((cpp_reader *, int, int));
/* These are inline functions instead of macros so we can get type
checking. */
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index 7e030d81f27..872751257ab 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -636,7 +636,7 @@ read_scan_file (in_fname, argc, argv)
exit (FATAL_EXIT_CODE);
/* We are scanning a system header, so mark it as such. */
- cpp_make_system_header (scan_in, CPP_BUFFER (scan_in), 1);
+ cpp_make_system_header (scan_in, 1, 0);
scan_decls (scan_in, argc, argv);
for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)