OSDN Git Service

libunwind related patch from David Mosberger
[pf3gnuchains/gcc-fork.git] / gcc / cpplib.h
index 434e455..b104295 100644 (file)
@@ -39,10 +39,9 @@ typedef struct cpp_string cpp_string;
 typedef struct cpp_hashnode cpp_hashnode;
 typedef struct cpp_macro cpp_macro;
 typedef struct cpp_callbacks cpp_callbacks;
-typedef struct cpp_path cpp_path;
+typedef struct cpp_dir cpp_dir;
 
 struct answer;
-struct file_name_map_list;
 
 /* The first three groups, apart from '=', can appear in preprocessor
    expressions (+= and -= are used to indicate unary + and - resp.).
@@ -175,7 +174,7 @@ struct cpp_string
    occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts.  */
 struct cpp_token
 {
-  unsigned int line;           /* Logical line of first char of token.  */
+  fileline line;               /* Logical line of first char of token.  */
   unsigned short col;          /* Column of first char of token.  */
   ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT;  /* token type */
   unsigned char flags;         /* flags - see above */
@@ -214,10 +213,6 @@ struct cpp_options
   /* Characters between tab stops.  */
   unsigned int tabstop;
 
-  /* Map between header names and file names, used only on DOS where
-     file names are limited in length.  */
-  struct file_name_map_list *map_list;
-
   /* The language we're preprocessing.  */
   enum c_lang lang;
 
@@ -272,9 +267,6 @@ struct cpp_options
   /* Nonzero means warn if there are any trigraphs.  */
   unsigned char warn_trigraphs;
 
-  /* Nonzero means warn if #import is used.  */
-  unsigned char warn_import;
-
   /* Nonzero means warn about multicharacter charconsts.  */
   unsigned char warn_multichar;
 
@@ -378,6 +370,11 @@ struct cpp_options
 
   /* Nonzero means __STDC__ should have the value 0 in system headers.  */
   unsigned char stdc_0_in_system_headers;
+
+  /* Nonzero means output a directory line marker right after the
+     initial file name line marker, and before a duplicate initial
+     line marker.  */
+  bool working_directory;
 };
 
 /* Call backs to cpplib client.  */
@@ -385,7 +382,14 @@ struct cpp_callbacks
 {
   /* Called when a new line of preprocessed output is started.  */
   void (*line_change) (cpp_reader *, const cpp_token *, int);
+
+  /* Called when switching to/from a new file.
+     The line_map is for the new file.  It is NULL if there is no new file.
+     (In C this happens when done with <built-in>+<command line> and also
+     when done with a main file.)  This can be used for resource cleanup.  */
   void (*file_change) (cpp_reader *, const struct line_map *);
+
+  void (*dir_change) (cpp_reader *, const char *);
   void (*include) (cpp_reader *, unsigned int, const unsigned char *,
                   const char *, int);
   void (*define) (cpp_reader *, unsigned int, cpp_hashnode *);
@@ -397,12 +401,12 @@ struct cpp_callbacks
 };
 
 /* Chain of directories to look for include files in.  */
-struct cpp_path
+struct cpp_dir
 {
   /* NULL-terminated singly-linked list.  */
-  struct cpp_path *next;
+  struct cpp_dir *next;
 
-  /* NAME need not be NUL-terminated once inside cpplib.  */
+  /* NAME of the directory, NUL-terminated.  */
   char *name;
   unsigned int len;
 
@@ -410,9 +414,9 @@ struct cpp_path
      "C" guards for C++.  */
   unsigned char sysp;
 
-  /* Mapping of file names for this directory for MS-DOS and
-     related platforms.  */
-  struct file_name_map *name_map;
+  /* Mapping of file names for this directory for MS-DOS and related
+     platforms.  A NULL-terminated array of (from, to) pairs.  */
+  const char **name_map;
     
   /* The C front end uses these to recognize duplicated
      directories in the search path.  */
@@ -516,7 +520,7 @@ extern void cpp_set_lang (cpp_reader *, enum c_lang);
 extern void cpp_add_dependency_target (cpp_reader *, const char *, int);
 
 /* Set the include paths.  */
-extern void cpp_set_include_chains (cpp_reader *, cpp_path *, cpp_path *, int);
+extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int);
 
 /* Call these to get pointers to the options and callback structures
    for a given reader.  These pointers are good until you call
@@ -528,20 +532,22 @@ extern const struct line_maps *cpp_get_line_maps (cpp_reader *);
 extern cpp_callbacks *cpp_get_callbacks (cpp_reader *);
 extern void cpp_set_callbacks (cpp_reader *, cpp_callbacks *);
 
-/* This function reads the file, but does not start preprocessing.  It
-   returns the name of the original file; this is the same as the
-   input file, except for preprocessed input.  This will generate at
-   least one file change callback, and possibly a line change callback
-   too.  If there was an error opening the file, it returns NULL.  */
-extern const char *cpp_read_main_file (cpp_reader *, const char *);
+/* This function finds the main file, but does not start reading it.
+   Returns true iff the file was found.  */
+extern bool cpp_find_main_file (cpp_reader *, const char *);
 
-/* This continues processing to a new file.  It will return false if
-   there was an error opening the file.  */
-extern bool cpp_read_next_file (cpp_reader *, const char *);
+/* This function reads the file, but does not start preprocessing.
+   This will generate at least one file change callback, and possibly
+   a line change callback.  */
+extern void cpp_push_main_file (cpp_reader *);
 
 /* Set up built-ins like __FILE__.  */
 extern void cpp_init_builtins (cpp_reader *, int);
 
+/* This is called after options have been parsed, and partially
+   processed.  */
+extern void cpp_post_options (cpp_reader *);
+
 /* Set up translation to the target character set.  */
 extern void cpp_init_iconv (cpp_reader *);
 
@@ -592,7 +598,7 @@ extern void cpp_unassert (cpp_reader *, const char *);
 extern void cpp_undef_all (cpp_reader *);
 
 extern cpp_buffer *cpp_push_buffer (cpp_reader *, const unsigned char *,
-                                   size_t, int, int);
+                                   size_t, int);
 extern int cpp_defined (cpp_reader *, const unsigned char *, int);
 
 /* A preprocessing number.  Code assumes that any unused high bits of
@@ -649,21 +655,21 @@ cpp_num cpp_num_sign_extend (cpp_num, size_t);
    with a line number of zero.  */
 
 /* Warning, an error with -Werror.  */
-#define DL_WARNING             0x00
-/* Same as DL_WARNING, except it is not suppressed in system headers.  */
-#define DL_WARNING_SYSHDR      0x01
+#define CPP_DL_WARNING         0x00
+/* Same as CPP_DL_WARNING, except it is not suppressed in system headers.  */
+#define CPP_DL_WARNING_SYSHDR  0x01
 /* Warning, an error with -pedantic-errors or -Werror.  */
-#define DL_PEDWARN             0x02
+#define CPP_DL_PEDWARN         0x02
 /* An error.  */
-#define DL_ERROR               0x03
+#define CPP_DL_ERROR           0x03
 /* An internal consistency check failed.  Prints "internal error: ",
-   otherwise the same as DL_ERROR.  */
-#define DL_ICE                 0x04
+   otherwise the same as CPP_DL_ERROR.  */
+#define CPP_DL_ICE             0x04
 /* Extracts a diagnostic level from an int.  */
-#define DL_EXTRACT(l)          (l & 0xf)
+#define CPP_DL_EXTRACT(l)      (l & 0xf)
 /* Nonzero if a diagnostic level is one of the warnings.  */
-#define DL_WARNING_P(l)                (DL_EXTRACT (l) >= DL_WARNING \
-                                && DL_EXTRACT (l) <= DL_PEDWARN)
+#define CPP_DL_WARNING_P(l)    (CPP_DL_EXTRACT (l) >= CPP_DL_WARNING \
+                                && CPP_DL_EXTRACT (l) <= CPP_DL_PEDWARN)
 
 /* N.B. The error-message-printer prototypes have not been nicely
    formatted because exgettext needs to see 'msgid' on the same line
@@ -682,8 +688,8 @@ extern void cpp_errno (cpp_reader *, int, const char *msgid);
 /* Same as cpp_error, except additionally specifies a position as a
    (translation unit) physical line and physical column.  If the line is
    zero, then no location is printed.  */
-extern void cpp_error_with_line (cpp_reader *, int, unsigned, unsigned, const char *msgid, ...)
-  ATTRIBUTE_PRINTF_5;
+extern void cpp_error_with_line (cpp_reader *, int, fileline, unsigned,
+                                const char *msgid, ...) ATTRIBUTE_PRINTF_5;
 
 /* In cpplex.c */
 extern int cpp_ideq (const cpp_token *, const char *);
@@ -715,9 +721,8 @@ extern unsigned char *cpp_quote_string (unsigned char *, const unsigned char *,
                                        unsigned int);
 
 /* In cppfiles.c */
-extern int cpp_included (cpp_reader *, const char *);
+extern bool cpp_included (cpp_reader *, const char *);
 extern void cpp_make_system_header (cpp_reader *, int, int);
-extern void cpp_simplify_path (char *);
 extern bool cpp_push_include (cpp_reader *, const char *);
 extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *);