OSDN Git Service

* cppfiles.c (cpp_make_system_header): Take 2 booleans,
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Dec 2000 07:32:04 +0000 (07:32 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Dec 2000 07:32:04 +0000 (07:32 +0000)
        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

gcc/ChangeLog
gcc/cppfiles.c
gcc/cpphash.h
gcc/cppinit.c
gcc/cpplib.c
gcc/cpplib.h
gcc/fix-header.c

index d38d2d9..f2ff461 100644 (file)
@@ -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):
index 9af0c39..4043a57 100644 (file)
@@ -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;
 {
index 698f545..2cab362 100644 (file)
@@ -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 *));
index e3d1221..7e5d7f6 100644 (file)
@@ -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);
index d4b243f..197faaf 100644 (file)
@@ -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);
 }
index faccc6a..524b8f6 100644 (file)
@@ -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.  */
index 7e030d8..8727512 100644 (file)
@@ -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++)