]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cppfiles.c (_cpp_find_include_file): Make sure ih->name is initialized.
authorZack Weinberg <zack@wolery.cumb.org>
Tue, 7 Mar 2000 20:58:47 +0000 (20:58 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Tue, 7 Mar 2000 20:58:47 +0000 (20:58 +0000)
* cppfiles.c (_cpp_find_include_file): Make sure ih->name is
initialized.
* cppinit.c (cpp_cleanup): Free imp->nshort also.

* cpperror.c (cpp_print_containing_files,
cpp_print_file_and_line, v_cpp_message): Rename to
print_containing_files, print_file_and_line, and v_message.
* cppexp.c (cpp_parse_expr, cpp_parse_escape, cpp_lex): Rename
to _cpp_parse_expr, parse_escape, and lex.
(parse_charconst): Remove broken multibyte support.
* cppfiles.c (include_hash): Make static.
(cpp_included): New function.
(merge_include_chains, find_include_file, finclude,
simplify_pathname): Rename to _cpp_merge_include_chains,
_cpp_find_include_file, _cpp_read_include_file, and
_cpp_simplify_pathname.
* cpphash.c (cpp_lookup, free_definition, delete_macro,
cpp_install, create_definition, macroexpand, compare_defs,
dump_definition): Rename to _cpp_lookup, _cpp_free_definition,
_cpp_delete_macro, _cpp_install, _cpp_create_definition,
_cpp_macroexpand, _cpp_compare_defs, and _cpp_dump_definition.
* cppinit.c (cpp_handle_option): Rename to handle_option, make
static.
* cpplib.c: Remove extern prototype of cpp_parse_expr.

* cpphash.h: Update prototypes.
* cpplib.h: Likewise.  Prototype _cpp_parse_expr here.

From-SVN: r32390

gcc/ChangeLog
gcc/cpperror.c
gcc/cppexp.c
gcc/cppfiles.c
gcc/cpphash.c
gcc/cpphash.h
gcc/cppinit.c
gcc/cpplib.c
gcc/cpplib.h

index 140d7ef1af8dfa00cc93ce57ac2aa87d2a15aeff..f26f2e0f004b84ba5269fbe1fdf08d4bbddbb32f 100644 (file)
@@ -1,3 +1,33 @@
+2000-03-07  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * cppfiles.c (_cpp_find_include_file): Make sure ih->name is
+       initialized.
+       * cppinit.c (cpp_cleanup): Free imp->nshort also.
+
+       * cpperror.c (cpp_print_containing_files,
+       cpp_print_file_and_line, v_cpp_message): Rename to
+       print_containing_files, print_file_and_line, and v_message.
+       * cppexp.c (cpp_parse_expr, cpp_parse_escape, cpp_lex): Rename
+       to _cpp_parse_expr, parse_escape, and lex.
+       (parse_charconst): Remove broken multibyte support.
+       * cppfiles.c (include_hash): Make static.
+       (cpp_included): New function.
+       (merge_include_chains, find_include_file, finclude,
+       simplify_pathname): Rename to _cpp_merge_include_chains,
+       _cpp_find_include_file, _cpp_read_include_file, and
+       _cpp_simplify_pathname.
+       * cpphash.c (cpp_lookup, free_definition, delete_macro,
+       cpp_install, create_definition, macroexpand, compare_defs,
+       dump_definition): Rename to _cpp_lookup, _cpp_free_definition,
+       _cpp_delete_macro, _cpp_install, _cpp_create_definition,
+       _cpp_macroexpand, _cpp_compare_defs, and _cpp_dump_definition.
+       * cppinit.c (cpp_handle_option): Rename to handle_option, make
+       static.
+       * cpplib.c: Remove extern prototype of cpp_parse_expr.
+
+       * cpphash.h: Update prototypes.
+       * cpplib.h: Likewise.  Prototype _cpp_parse_expr here.
+
 2000-03-07  Andrew Haley  <aph@cygnus.com>
 
        * config/mips/mips.h (PTRDIFF_TYPE): Revert broken change;
index b72740ce70d99ef8195d90a17d4b9d2e1e61f5cc..577840b3e9743aa6cc47e4fdad89993a33f64428 100644 (file)
@@ -28,9 +28,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #include "cpplib.h"
 #include "intl.h"
 
-static void cpp_print_containing_files PARAMS ((cpp_reader *, cpp_buffer *));
-static void cpp_print_file_and_line    PARAMS ((const char *, long, long));
-static void v_cpp_message              PARAMS ((cpp_reader *, int,
+static void print_containing_files     PARAMS ((cpp_reader *, cpp_buffer *));
+static void print_file_and_line                PARAMS ((const char *, long, long));
+static void v_message                  PARAMS ((cpp_reader *, int,
                                                 const char *, long, long,
                                                 const char *, va_list));
 
@@ -38,7 +38,7 @@ static void v_cpp_message             PARAMS ((cpp_reader *, int,
    commands which led to the current file.  */
 
 static void
-cpp_print_containing_files (pfile, ip)
+print_containing_files (pfile, ip)
      cpp_reader *pfile;
      cpp_buffer *ip;
 {
@@ -86,7 +86,7 @@ cpp_print_containing_files (pfile, ip)
 }
 
 static void
-cpp_print_file_and_line (filename, line, column)
+print_file_and_line (filename, line, column)
      const char *filename;
      long line, column;
 {
@@ -104,7 +104,7 @@ cpp_print_file_and_line (filename, line, column)
    1 for error, 0 for warning.  */
 
 static void
-v_cpp_message (pfile, is_error, file, line, col, msg, ap)
+v_message (pfile, is_error, file, line, col, msg, ap)
      cpp_reader *pfile;
      int is_error;
      const char *file;
@@ -122,8 +122,8 @@ v_cpp_message (pfile, is_error, file, line, col, msg, ap)
       if (line == -1)
        cpp_buf_line_and_col (ip, &line, &col);
 
-      cpp_print_containing_files (pfile, ip);
-      cpp_print_file_and_line (file, line, col);
+      print_containing_files (pfile, ip);
+      print_file_and_line (file, line, col);
     }
   else
     fprintf (stderr, "%s: ", progname);
@@ -145,7 +145,7 @@ v_cpp_message (pfile, is_error, file, line, col, msg, ap)
       pfile->errors = CPP_FATAL_LIMIT;
       break;
     default:
-      cpp_ice (pfile, "bad is_error(%d) in v_cpp_message", is_error);
+      cpp_ice (pfile, "bad is_error(%d) in v_message", is_error);
     }
 
   vfprintf (stderr, _(msg), ap);
@@ -173,7 +173,7 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
   msgid = va_arg (ap, const char *);
 #endif
 
-  v_cpp_message (pfile, 3, NULL, -1, -1, msgid, ap);
+  v_message (pfile, 3, NULL, -1, -1, msgid, ap);
   va_end(ap);
 }
 
@@ -199,7 +199,7 @@ cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
   msgid = va_arg (ap, const char *);
 #endif
 
-  v_cpp_message (pfile, 2, NULL, -1, -1, msgid, ap);
+  v_message (pfile, 2, NULL, -1, -1, msgid, ap);
   va_end(ap);
 }
 
@@ -222,7 +222,7 @@ cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
   if (CPP_OPTIONS (pfile)->inhibit_errors)
     return;
 
-  v_cpp_message (pfile, 1, NULL, -1, -1, msgid, ap);
+  v_message (pfile, 1, NULL, -1, -1, msgid, ap);
   va_end(ap);
 }
 
@@ -250,7 +250,7 @@ cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
   if (CPP_OPTIONS (pfile)->inhibit_errors)
     return;
 
-  v_cpp_message (pfile, 1, NULL, line, column, msgid, ap);
+  v_message (pfile, 1, NULL, line, column, msgid, ap);
   va_end(ap);
 }
 
@@ -282,7 +282,7 @@ cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
   if (CPP_OPTIONS (pfile)->inhibit_warnings)
     return;
 
-  v_cpp_message (pfile, 0, NULL, -1, -1, msgid, ap);
+  v_message (pfile, 0, NULL, -1, -1, msgid, ap);
   va_end(ap);
 }
 
@@ -310,7 +310,7 @@ cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
   if (CPP_OPTIONS (pfile)->inhibit_warnings)
     return;
 
-  v_cpp_message (pfile, 0, NULL, line, column, msgid, ap);
+  v_message (pfile, 0, NULL, line, column, msgid, ap);
   va_end(ap);
 }
 
@@ -335,7 +335,7 @@ cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
       : CPP_OPTIONS (pfile)->inhibit_warnings)
     return;
 
-  v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
+  v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
                 NULL, -1, -1, msgid, ap);
   va_end(ap);
 }
@@ -366,7 +366,7 @@ cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
       : CPP_OPTIONS (pfile)->inhibit_warnings)
     return;
 
-  v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
+  v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
                 NULL, line, column, msgid, ap);
   va_end(ap);
 }
@@ -403,7 +403,7 @@ cpp_pedwarn_with_file_and_line VPARAMS ((cpp_reader *pfile,
       : CPP_OPTIONS (pfile)->inhibit_warnings)
     return;
 
-  v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
+  v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
                 file, line, col, msgid, ap);
   va_end(ap);
 }
index 01f94698b24d0688e5a954c2d584f8438e64558d..e3c1bdf1430fd1498fb113e1490dbe870c643754 100644 (file)
@@ -1,4 +1,4 @@
-/* Parse C expressions for CCCP.
+/* Parse C expressions for cpplib.
    Copyright (C) 1987, 92, 94, 95, 97, 98, 1999, 2000 Free Software Foundation.
 
 This program is free software; you can redistribute it and/or modify it
@@ -65,11 +65,11 @@ Written by Per Bothner 1994.  */
 #endif
 
 #define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \
-                           ? (~ (~ (HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
+                           ? (~(~(HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
                            : ~ (HOST_WIDEST_INT) 0)
 
 #define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \
-                            ? ~ (~ (HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
+                            ? ~(~(HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
                             : ~ (HOST_WIDEST_INT) 0)
 
 /* Yield nonzero if adding two numbers with A's and B's signs can yield a
@@ -77,14 +77,19 @@ Written by Per Bothner 1994.  */
 #define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
 
 static void integer_overflow PARAMS ((cpp_reader *));
-static HOST_WIDEST_INT left_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT, int, unsigned HOST_WIDEST_INT));
-static HOST_WIDEST_INT right_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT, int, unsigned HOST_WIDEST_INT));
-static struct operation parse_number PARAMS ((cpp_reader *, U_CHAR *, U_CHAR *));
-static struct operation parse_charconst PARAMS ((cpp_reader *, U_CHAR *, U_CHAR *));
+static HOST_WIDEST_INT left_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT,
+                                          int, unsigned HOST_WIDEST_INT));
+static HOST_WIDEST_INT right_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT,
+                                           int, unsigned HOST_WIDEST_INT));
+static struct operation parse_number PARAMS ((cpp_reader *, U_CHAR *,
+                                             U_CHAR *));
+static struct operation parse_charconst PARAMS ((cpp_reader *, U_CHAR *,
+                                                U_CHAR *));
 static struct operation parse_defined PARAMS ((cpp_reader *));
-static struct operation cpp_lex PARAMS ((cpp_reader *, int));
-extern HOST_WIDEST_INT cpp_parse_expr PARAMS ((cpp_reader *));
-static HOST_WIDEST_INT cpp_parse_escape PARAMS ((cpp_reader *, U_CHAR **, HOST_WIDEST_INT));
+static HOST_WIDEST_INT parse_escape PARAMS ((cpp_reader *, U_CHAR **,
+                                            HOST_WIDEST_INT));
+static struct operation lex PARAMS ((cpp_reader *, int));
+
 
 #define ERROR 299
 #define OROR 300
@@ -107,12 +112,13 @@ static HOST_WIDEST_INT cpp_parse_escape PARAMS ((cpp_reader *, U_CHAR **, HOST_W
 #define SKIP_OPERAND 8
 /*#define UNSIGNEDP 16*/
 
-struct operation {
-    short op;
-    char rprio; /* Priority of op (relative to it right operand).  */
-    char flags;
-    char unsignedp;    /* true if value should be treated as unsigned */
-    HOST_WIDEST_INT value;        /* The value logically "right" of op.  */
+struct operation
+{
+  short op;
+  char rprio; /* Priority of op (relative to it right operand).  */
+  char flags;
+  char unsignedp;    /* true if value should be treated as unsigned */
+  HOST_WIDEST_INT value;        /* The value logically "right" of op.  */
 };
 
 /* Parse and convert an integer for #if.  Accepts decimal, hex, or octal
@@ -258,13 +264,7 @@ parse_charconst (pfile, start, end)
   int max_chars;
   U_CHAR *ptr = start;
 
-  /* FIXME: Should use reentrant multibyte functions.  */
-#ifdef MULTIBYTE_CHARS
-  wchar_t c = (wchar_t)-1;
-  (void) mbtowc (NULL_PTR, NULL_PTR, 0);
-#else
   int c = -1;
-#endif
 
   if (*ptr == 'L')
     {
@@ -277,22 +277,12 @@ parse_charconst (pfile, start, end)
 
   while (ptr < end)
     {
-#ifndef MULTIBYTE_CHARS
       c = *ptr++;
-#else
-      ptr += mbtowc (&c, ptr, end - ptr);
-#endif
       if (c == '\'' || c == '\0')
        break;
       else if (c == '\\')
        {
-         /* Hopefully valid assumption: if mbtowc returns a backslash,
-            we are in initial shift state.  No valid escape-sequence
-            character can take us out of initial shift state or begin
-            an unshifted multibyte char, so cpp_parse_escape doesn't
-            need to know about multibyte chars.  */
-
-         c = cpp_parse_escape (pfile, &ptr, mask);
+         c = parse_escape (pfile, &ptr, mask);
          if (width < HOST_BITS_PER_INT
              && (unsigned int) c >= (unsigned int)(1 << width))
            cpp_pedwarn (pfile, "escape sequence out of range for character");
@@ -420,7 +410,7 @@ static const struct token tokentab2[] = {
 /* Read one token.  */
 
 static struct operation
-cpp_lex (pfile, skip_evaluation)
+lex (pfile, skip_evaluation)
      cpp_reader *pfile;
      int skip_evaluation;
 {
@@ -510,7 +500,7 @@ cpp_lex (pfile, skip_evaluation)
    after the zeros.  A value of 0 does not mean end of string.  */
 
 static HOST_WIDEST_INT
-cpp_parse_escape (pfile, string_ptr, result_mask)
+parse_escape (pfile, string_ptr, result_mask)
      cpp_reader *pfile;
      U_CHAR **string_ptr;
      HOST_WIDEST_INT result_mask;
@@ -681,7 +671,7 @@ right_shift (pfile, a, unsignedp, b)
    Returns the value of the expression.  */
 
 HOST_WIDEST_INT
-cpp_parse_expr (pfile)
+_cpp_parse_expr (pfile)
      cpp_reader *pfile;
 {
   /* The implementation is an operator precedence parser,
@@ -710,7 +700,7 @@ cpp_parse_expr (pfile)
       char flags = 0;
 
       /* Read a token */
-      op =  cpp_lex (pfile, skip_evaluation);
+      op =  lex (pfile, skip_evaluation);
 
       /* See if the token is an operand, in which case go to set_value.
         If the token is an operator, figure out its left and right
@@ -719,7 +709,7 @@ cpp_parse_expr (pfile)
       switch (op.op)
        {
        case NAME:
-         cpp_ice (pfile, "cpp_lex returns a NAME");
+         cpp_ice (pfile, "lex returns a NAME");
          goto syntax_error;
        case INT:  case CHAR:
          goto set_value;
@@ -1027,7 +1017,7 @@ cpp_parse_expr (pfile)
          else
            {
              new_stack = (struct operation *) xmalloc (new_size);
-             bcopy ((char *) stack, (char *) new_stack, old_size);
+             memcpy (new_stack, stack, old_size);
            }
          stack = new_stack;
          top = (struct operation *) ((char *) new_stack + old_size);
index d8d518d062047b4bfb78d88f68825198939f7fb9..dc56b24ada5c4300050d4920962c510592427697 100644 (file)
@@ -29,11 +29,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #include "cpplib.h"
 #include "intl.h"
 
-/* The entry points to this file are: find_include_file,
-   cpp_read_file, finclude, include_hash, append_include_chain, and
-   file_cleanup.  file_cleanup is only called through
-   CPP_BUFFER(pfile)->cleanup, so it's static anyway. */
-
+static struct include_hash *include_hash PARAMS ((cpp_reader *,
+                                                 const char *, int));
 static struct include_hash *redundant_include_p
                                        PARAMS ((cpp_reader *,
                                                 struct include_hash *,
@@ -83,7 +80,7 @@ static void hack_vms_include_specification PARAMS ((char *));
    how?) and possibly preload the include hash. */
 
 void
-merge_include_chains (opts)
+_cpp_merge_include_chains (opts)
      struct cpp_options *opts;
 {
   struct file_name_list *prev, *cur, *other;
@@ -208,7 +205,7 @@ merge_include_chains (opts)
  #include name (there are at least three ways this can happen).  The
  hash function could probably be improved a bit. */
 
-struct include_hash *
+static struct include_hash *
 include_hash (pfile, fname, add)
      cpp_reader *pfile;
      const char *fname;
@@ -293,6 +290,19 @@ redundant_include_p (pfile, ihash, ilist)
   return 0;
 }
 
+/* Return 1 if the file named by FNAME has been included before in
+   any context, 0 otherwise.  */
+int
+cpp_included (pfile, fname)
+     cpp_reader *pfile;
+     const char *fname;
+{
+  struct include_hash *ptr;
+
+  ptr = include_hash (pfile, fname, 0);
+  return (ptr != NULL);
+}
+
 static int
 file_cleanup (pbuf, pfile)
      cpp_buffer *pbuf;
@@ -316,7 +326,7 @@ file_cleanup (pbuf, pfile)
    *BEFORE is 1 if the file was included before (but needs to be read
    again). */
 int
-find_include_file (pfile, fname, search_start, ihash, before)
+_cpp_find_include_file (pfile, fname, search_start, ihash, before)
      cpp_reader *pfile;
      const char *fname;
      struct file_name_list *search_start;
@@ -362,6 +372,7 @@ find_include_file (pfile, fname, search_start, ihash, before)
     }
   *before = 0;
   *ihash = ih;
+  ih->name = NULL;
   ih->nshort = xstrdup (fname);
   ih->control_macro = NULL;
   
@@ -383,7 +394,7 @@ find_include_file (pfile, fname, search_start, ihash, before)
       bcopy (l->name, name, l->nlen);
       name[l->nlen] = '/';
       strcpy (&name[l->nlen+1], fname);
-      simplify_pathname (name);
+      _cpp_simplify_pathname (name);
       if (CPP_OPTIONS (pfile)->remap)
        name = remap_filename (pfile, name, l);
 
@@ -626,10 +637,11 @@ cpp_read_file (pfile, fname)
     }
 
   /* Open the file in nonblocking mode, so we don't get stuck if
-     someone clever has asked cpp to process /dev/rmt0.  finclude()
-     will check that we have a real file to work with.  Also take
-     care not to acquire a controlling terminal by mistake (this can't
-     happen on sane systems, but paranoia is a virtue).  */
+     someone clever has asked cpp to process /dev/rmt0.
+     _cpp_read_include_file will check that we have a real file to
+     work with.  Also take care not to acquire a controlling terminal
+     by mistake (this can't happen on sane systems, but paranoia is a
+     virtue).  */
   else if ((f = open (fname, O_RDONLY|O_NONBLOCK|O_NOCTTY, 0666)) < 0)
     {
       cpp_notice_from_errno (pfile, fname);
@@ -651,7 +663,7 @@ cpp_read_file (pfile, fname)
   ih_fake->control_macro = 0;
   ih_fake->buf = (char *)-1;
   ih_fake->limit = 0;
-  if (!finclude (pfile, f, ih_fake))
+  if (!_cpp_read_include_file (pfile, f, ih_fake))
     goto failed_finclude;
 
   return 1;
@@ -672,7 +684,7 @@ cpp_read_file (pfile, fname)
    The caller is responsible for the cpp_push_buffer.  */
 
 int
-finclude (pfile, fd, ihash)
+_cpp_read_include_file (pfile, fd, ihash)
      cpp_reader *pfile;
      int fd;
      struct include_hash *ihash;
@@ -1245,7 +1257,7 @@ initialize_input_buffer (pfile, fd, st)
    of the string.
  */
 void
-simplify_pathname (path)
+_cpp_simplify_pathname (path)
     char *path;
 {
     char *from, *to;
index bcb55389e3e610bffee3595be5c4183814028309..e5c4c713812286be1e9b66ad0cbbadea856d7843 100644 (file)
@@ -116,7 +116,7 @@ hashf (s, len)
    Otherwise, compute the length by scanning the entire name.  */
 
 HASHNODE *
-cpp_lookup (pfile, name, len)
+_cpp_lookup (pfile, name, len)
      cpp_reader *pfile;
      const U_CHAR *name;
      int len;
@@ -147,7 +147,7 @@ cpp_lookup (pfile, name, len)
    do_define when redefining macros.  */
 
 void
-free_definition (d)
+_cpp_free_definition (d)
      DEFINITION *d;
 {
   struct reflist *ap, *nextap;
@@ -169,7 +169,7 @@ free_definition (d)
  */
 
 void
-delete_macro (hp)
+_cpp_delete_macro (hp)
      HASHNODE *hp;
 {
   if (hp->prev != NULL)
@@ -183,7 +183,7 @@ delete_macro (hp)
     *hp->bucket_hdr = hp->next;
 
   if (hp->type == T_MACRO)
-    free_definition (hp->value.defn);
+    _cpp_free_definition (hp->value.defn);
 
   free (hp);
 }
@@ -202,7 +202,7 @@ delete_macro (hp)
    Otherwise, compute the hash code.  */
 
 HASHNODE *
-cpp_install (pfile, name, len, type, value)
+_cpp_install (pfile, name, len, type, value)
      cpp_reader *pfile;
      const U_CHAR *name;
      int len;
@@ -698,7 +698,7 @@ collect_formal_parameters (pfile)
    macro.  */
 
 DEFINITION *
-create_definition (pfile, funlike)
+_cpp_create_definition (pfile, funlike)
      cpp_reader *pfile;
      int funlike;
 {
@@ -959,7 +959,7 @@ special_symbol (hp, pfile)
    an argument list follows; arguments come from the input stack.  */
 
 void
-macroexpand (pfile, hp)
+_cpp_macroexpand (pfile, hp)
      cpp_reader *pfile;
      HASHNODE *hp;
 {
@@ -1484,7 +1484,7 @@ push_macro_expansion (pfile, xbuf, xbuf_len, hp)
 /* Return zero if two DEFINITIONs are isomorphic.  */
 
 int
-compare_defs (pfile, d1, d2)
+_cpp_compare_defs (pfile, d1, d2)
      cpp_reader *pfile;
      DEFINITION *d1, *d2;
 {
@@ -1576,7 +1576,7 @@ comp_def_part (first, beg1, len1, beg2, len2, last)
    to be read back in again. */
 
 void
-dump_definition (pfile, sym, len, defn)
+_cpp_dump_definition (pfile, sym, len, defn)
      cpp_reader *pfile;
      const U_CHAR *sym;
      long len;
index 278ad24de64a07ddc9f62cafe3e53e93dd34c2a2..53af56510b191cf501bc42fbd477f061db734953 100644 (file)
@@ -92,17 +92,18 @@ struct hashnode {
   union hashval value;         /* pointer to expansion, or whatever */
 };
 
-extern HASHNODE *cpp_install     PARAMS ((cpp_reader *, const U_CHAR *, int,
+extern HASHNODE *_cpp_install    PARAMS ((cpp_reader *, const U_CHAR *, int,
                                           enum node_type, const char *));
-extern HASHNODE *cpp_lookup      PARAMS ((cpp_reader *, const U_CHAR *, int));
-extern void free_definition      PARAMS ((DEFINITION *));
-extern void delete_macro         PARAMS ((HASHNODE *));
+extern HASHNODE *_cpp_lookup     PARAMS ((cpp_reader *, const U_CHAR *, int));
+extern void _cpp_free_definition  PARAMS ((DEFINITION *));
+extern void _cpp_delete_macro    PARAMS ((HASHNODE *));
 
-extern DEFINITION *create_definition PARAMS ((cpp_reader *, int));
-extern int compare_defs                  PARAMS ((cpp_reader *, DEFINITION *,
+extern DEFINITION *_cpp_create_definition
+                                 PARAMS ((cpp_reader *, int));
+extern int _cpp_compare_defs             PARAMS ((cpp_reader *, DEFINITION *,
                                           DEFINITION *));
-extern void macroexpand                  PARAMS ((cpp_reader *, HASHNODE *));
-extern void dump_definition      PARAMS ((cpp_reader *, const U_CHAR *, long,
+extern void _cpp_macroexpand     PARAMS ((cpp_reader *, HASHNODE *));
+extern void _cpp_dump_definition  PARAMS ((cpp_reader *, const U_CHAR *, long,
                                           DEFINITION *));
 
 #endif
index 4286ecbe31506dbff416b85e53e383b04311f100..0991a950fa387662ffda4878296f3a97633f29fc 100644 (file)
@@ -183,6 +183,7 @@ static void initialize_dependency_output PARAMS ((cpp_reader *));
 static void initialize_standard_includes PARAMS ((cpp_reader *));
 static void new_pending_define         PARAMS ((struct cpp_options *,
                                                 const char *));
+static int handle_option               PARAMS ((cpp_reader *, int, char **));
 
 /* Fourth argument to append_include_chain: chain to use */
 enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
@@ -293,7 +294,7 @@ append_include_chain (pfile, pend, dir, path, cxx_aware)
   struct stat st;
   unsigned int len;
 
-  simplify_pathname (dir);
+  _cpp_simplify_pathname (dir);
   if (stat (dir, &st))
     {
       /* Dirs that don't exist are silently ignored. */
@@ -428,6 +429,7 @@ cpp_cleanup (pfile)
          struct include_hash *next = imp->next;
 
          free ((PTR) imp->name);
+         free ((PTR) imp->nshort);
          free (imp);
          imp = next;
        }
@@ -437,7 +439,7 @@ cpp_cleanup (pfile)
   for (i = HASHSIZE; --i >= 0;)
     {
       while (pfile->hashtab[i])
-       delete_macro (pfile->hashtab[i]);
+       _cpp_delete_macro (pfile->hashtab[i]);
     }
   free (pfile->hashtab);
 }
@@ -507,7 +509,7 @@ initialize_builtins (pfile)
       val = (b->flags & ULP) ? user_label_prefix : b->value;
       len = strlen (b->name);
 
-      cpp_install (pfile, b->name, len, b->type, val);
+      _cpp_install (pfile, b->name, len, b->type, val);
       if ((b->flags & DUMP) && CPP_OPTIONS (pfile)->debug_output)
        dump_special_to_buffer (pfile, b->name);
     }
@@ -719,7 +721,7 @@ cpp_start_read (pfile, fname)
   if (! opts->no_standard_includes)
     initialize_standard_includes (pfile);
 
-  merge_include_chains (opts);
+  _cpp_merge_include_chains (opts);
 
   /* With -v, print the list of dirs to search.  */
   if (opts->verbose)
@@ -876,7 +878,8 @@ cpp_finish (pfile)
          for (h = pfile->hashtab[i]; h; h = h->next)
            if (h->type == T_MACRO)
              {
-               dump_definition (pfile, h->name, h->length, h->value.defn);
+               _cpp_dump_definition (pfile, h->name, h->length,
+                                     h->value.defn);
                CPP_PUTC (pfile, '\n');
              }
        }
@@ -901,8 +904,8 @@ new_pending_define (opts, text)
    Can be called multiple times, to handle multiple sets of options.
    Returns number of strings consumed.  */
 
-int
-cpp_handle_option (pfile, argc, argv)
+static int
+handle_option (pfile, argc, argv)
      cpp_reader *pfile;
      int argc;
      char **argv;
@@ -1493,7 +1496,7 @@ cpp_handle_options (pfile, argc, argv)
   int strings_processed;
   for (i = 0; i < argc; i += strings_processed)
     {
-      strings_processed = cpp_handle_option (pfile, argc - i, argv + i);
+      strings_processed = handle_option (pfile, argc - i, argv + i);
       if (strings_processed == 0)
        break;
     }
index 567f94002845a6562e321a9a56abbd0f114f0994..c97af568c8fc4fd14d59ac45fd395d1f96c9ed6c 100644 (file)
@@ -41,10 +41,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    case CPP_BUMP_LINE must not be called.  */
 #define ACTIVE_MARK_P() (CPP_BUFFER (pfile)->mark != -1)
 
-/* External declarations.  */
-
-extern HOST_WIDEST_INT cpp_parse_expr PARAMS ((cpp_reader *));
-
 /* `struct directive' defines one #-directive, including how to handle it.  */
 
 struct directive
@@ -259,7 +255,7 @@ cpp_defined (pfile, id, len)
      const U_CHAR *id;
      int len;
 {
-  HASHNODE *hp = cpp_lookup (pfile, id, len);
+  HASHNODE *hp = _cpp_lookup (pfile, id, len);
   if (hp && hp->type == T_POISON)
     {
       cpp_error (pfile, "attempt to use poisoned `%s'", hp->name);
@@ -686,17 +682,17 @@ do_define (pfile, keyword)
        as an object-like macro if this happens, with a warning.  */
     cpp_pedwarn (pfile, "missing white space after `#define %.*s'", len, sym);
 
-  def = create_definition (pfile, funlike);
+  def = _cpp_create_definition (pfile, funlike);
   if (def == 0)
     return 0;
 
-  if ((hp = cpp_lookup (pfile, sym, len)) != NULL)
+  if ((hp = _cpp_lookup (pfile, sym, len)) != NULL)
     {
       int ok;
 
       /* Redefining a macro is ok if the definitions are the same.  */
       if (hp->type == T_MACRO)
-       ok = ! compare_defs (pfile, def, hp->value.defn);
+       ok = ! _cpp_compare_defs (pfile, def, hp->value.defn);
       /* Redefining a constant is ok with -D.  */
       else if (hp->type == T_CONST || hp->type == T_STDC)
         ok = ! CPP_OPTIONS (pfile)->done_initializing;
@@ -721,17 +717,17 @@ do_define (pfile, keyword)
        {
          /* Replace the old definition.  */
          if (hp->type == T_MACRO)
-           free_definition (hp->value.defn);
+           _cpp_free_definition (hp->value.defn);
          hp->type = T_MACRO;
          hp->value.defn = def;
        }
     }
   else
-    cpp_install (pfile, sym, len, T_MACRO, (char *) def);
+    _cpp_install (pfile, sym, len, T_MACRO, (char *) def);
 
   if (CPP_OPTIONS (pfile)->debug_output
       || CPP_OPTIONS (pfile)->dump_macros == dump_definitions)
-    dump_definition (pfile, sym, len, def);
+    _cpp_dump_definition (pfile, sym, len, def);
   else if (CPP_OPTIONS (pfile)->dump_macros == dump_names)
     pass_thru_directive (sym, len, pfile, keyword);
 
@@ -1201,7 +1197,7 @@ do_include (pfile, keyword)
       return 0;
     }
 
-  fd = find_include_file (pfile, ftok, search_start, &ihash, &before);
+  fd = _cpp_find_include_file (pfile, ftok, search_start, &ihash, &before);
 
   if (fd == -2)
     return 0;
@@ -1280,7 +1276,7 @@ do_include (pfile, keyword)
   if (angle_brackets)
     pfile->system_include_depth++;   /* Decremented in file_cleanup. */
 
-  if (finclude (pfile, fd, ihash))
+  if (_cpp_read_include_file (pfile, fd, ihash))
     {
       output_line_command (pfile, enter_file);
       pfile->only_seen_white = 2;
@@ -1479,7 +1475,7 @@ do_undef (pfile, keyword)
   }
   CPP_SET_WRITTEN (pfile, here);
 
-  while ((hp = cpp_lookup (pfile, name, len)) != NULL)
+  while ((hp = _cpp_lookup (pfile, name, len)) != NULL)
     {
       /* If we are generating additional info for debugging (with -g) we
         need to pass through all effective #undef commands.  */
@@ -1491,7 +1487,7 @@ do_undef (pfile, keyword)
        {
          if (hp->type != T_MACRO)
            cpp_warning (pfile, "undefining `%s'", hp->name);
-         delete_macro (hp);
+         _cpp_delete_macro (hp);
        }
     }
 
@@ -1705,7 +1701,6 @@ do_pragma_implementation (pfile)
 {
   /* Be quiet about `#pragma implementation' for a file only if it hasn't
      been included yet.  */
-  struct include_hash *ptr;
   enum cpp_token token;
   long written = CPP_WRITTEN (pfile);
   U_CHAR *name;
@@ -1723,9 +1718,8 @@ do_pragma_implementation (pfile)
   name = pfile->token_buffer + written + 1;
   copy = xstrdup (name);
   copy[strlen(copy)] = '\0';  /* trim trailing quote */
-  
-  ptr = include_hash (pfile, copy, 0);
-  if (ptr)
+
+  if (cpp_included (pfile, copy))
     cpp_warning (pfile,
         "`#pragma implementation' for `%s' appears after file is included",
                 copy);
@@ -1766,18 +1760,19 @@ do_pragma_poison (pfile)
 
       p = pfile->token_buffer + written;
       len = strlen (p);
-      if ((hp = cpp_lookup (pfile, p, len)))
+      if ((hp = _cpp_lookup (pfile, p, len)))
        {
          if (hp->type != T_POISON)
            {
              cpp_warning (pfile, "poisoning existing macro `%s'", p);
-             free_definition (hp->value.defn);
+             if (hp->type == T_MACRO)
+               _cpp_free_definition (hp->value.defn);
              hp->value.defn = 0;
              hp->type = T_POISON;
            }
        }
       else
-       cpp_install (pfile, p, len, T_POISON, 0);
+       _cpp_install (pfile, p, len, T_POISON, 0);
       if (writeit)
        CPP_PUTC (pfile, ' ');
     }
@@ -1952,7 +1947,7 @@ eval_if_expression (pfile)
   long old_written = CPP_WRITTEN (pfile);
 
   pfile->parsing_if_directive++;
-  value = cpp_parse_expr (pfile);
+  value = _cpp_parse_expr (pfile);
   pfile->parsing_if_directive--;
 
   skip_rest_of_line (pfile);
@@ -2683,7 +2678,7 @@ cpp_get_token (pfile)
              return CPP_NAME;
            ident = pfile->token_buffer + before_name_written;
            ident_len = CPP_PWRITTEN (pfile) - ident;
-           hp = cpp_lookup (pfile, ident, ident_len);
+           hp = _cpp_lookup (pfile, ident, ident_len);
            if (!hp)
              return CPP_NAME;
            if (hp->type == T_DISABLED)
@@ -2751,7 +2746,7 @@ cpp_get_token (pfile)
            /* This is now known to be a macro call.
               Expand the macro, reading arguments as needed,
               and push the expansion on the input stack.  */
-           macroexpand (pfile, hp);
+           _cpp_macroexpand (pfile, hp);
            CPP_SET_WRITTEN (pfile, before_name_written);
          }
          goto get_next;
@@ -3085,16 +3080,16 @@ do_assert (pfile, keyword)
 
   thislen = strlen (sym);
   baselen = index (sym, '(') - sym;
-  this = cpp_lookup (pfile, sym, thislen);
+  this = _cpp_lookup (pfile, sym, thislen);
   if (this)
     {
       cpp_warning (pfile, "`%s' re-asserted", sym);
       goto error;
     }
 
-  base = cpp_lookup (pfile, sym, baselen);
+  base = _cpp_lookup (pfile, sym, baselen);
   if (! base)
-    base = cpp_install (pfile, sym, baselen, T_ASSERT, 0);
+    base = _cpp_install (pfile, sym, baselen, T_ASSERT, 0);
   else if (base->type != T_ASSERT)
   {
     /* Token clash - but with what?! */
@@ -3102,7 +3097,7 @@ do_assert (pfile, keyword)
     goto error;
   }
 
-  this = cpp_install (pfile, sym, thislen, T_ASSERT,
+  this = _cpp_install (pfile, sym, thislen, T_ASSERT,
                      (char *)base->value.aschain);
   base->value.aschain = this;
   
@@ -3143,7 +3138,7 @@ do_unassert (pfile, keyword)
   thislen = strlen (sym);
   if (ret == 1)
     {
-      base = cpp_lookup (pfile, sym, thislen);
+      base = _cpp_lookup (pfile, sym, thislen);
       if (! base)
        goto error;  /* It isn't an error to #undef what isn't #defined,
                        so it isn't an error to #unassert what isn't
@@ -3152,16 +3147,16 @@ do_unassert (pfile, keyword)
       for (this = base->value.aschain; this; this = next)
         {
          next = this->value.aschain;
-         delete_macro (this);
+         _cpp_delete_macro (this);
        }
-      delete_macro (base);
+      _cpp_delete_macro (base);
     }
   else
     {
       baselen = index (sym, '(') - sym;
-      base = cpp_lookup (pfile, sym, baselen);
+      base = _cpp_lookup (pfile, sym, baselen);
       if (! base) goto error;
-      this = cpp_lookup (pfile, sym, thislen);
+      this = _cpp_lookup (pfile, sym, thislen);
       if (! this) goto error;
 
       next = base;
@@ -3169,10 +3164,10 @@ do_unassert (pfile, keyword)
        next = next->value.aschain;
 
       next->value.aschain = this->value.aschain;
-      delete_macro (this);
+      _cpp_delete_macro (this);
 
       if (base->value.aschain == NULL)
-       delete_macro (base);  /* Last answer for this predicate deleted. */
+       _cpp_delete_macro (base);  /* Last answer for this predicate deleted. */
     }
   
   pfile->limit = (unsigned char *) sym; /* Pop */
index 19a9c3e9a25138e32fc12411da7bf22e494e4649..bb098c2b6d57f02273d285ce5989648fb843f6cb 100644 (file)
@@ -64,7 +64,6 @@ enum cpp_token
 typedef enum cpp_token (*parse_underflow_t) PARAMS((cpp_reader *));
 typedef int (*parse_cleanup_t) PARAMS((cpp_buffer *, cpp_reader *));
 
-extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
 extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
 extern enum cpp_token cpp_get_token PARAMS ((cpp_reader *));
 extern enum cpp_token cpp_get_non_space_token PARAMS ((cpp_reader *));
@@ -694,16 +693,21 @@ extern void output_line_command           PARAMS ((cpp_reader *,
                                                 enum file_change_code));
 
 /* In cppfiles.c */
-extern void simplify_pathname          PARAMS ((char *));
-extern void merge_include_chains       PARAMS ((struct cpp_options *));
-extern int find_include_file           PARAMS ((cpp_reader *, const char *,
+extern int cpp_included                        PARAMS ((cpp_reader *, const char *));
+extern int cpp_read_file               PARAMS ((cpp_reader *, const char *));
+
+extern void _cpp_simplify_pathname     PARAMS ((char *));
+extern void _cpp_merge_include_chains  PARAMS ((struct cpp_options *));
+extern int _cpp_find_include_file      PARAMS ((cpp_reader *, const char *,
                                                struct file_name_list *,
                                                struct include_hash **,
                                                int *));
-extern int finclude                    PARAMS ((cpp_reader *, int,
+extern int _cpp_read_include_file      PARAMS ((cpp_reader *, int,
                                                struct include_hash *));
-extern int cpp_read_file               PARAMS ((cpp_reader *, const char *));
-extern struct include_hash *include_hash PARAMS ((cpp_reader *, const char *, int));
+
+/* In cppexp.c */
+extern HOST_WIDEST_INT _cpp_parse_expr PARAMS ((cpp_reader *));
+
 
 #ifdef __cplusplus
 }