OSDN Git Service

2002-11-15 Eric Botcazou <ebotcazou@libertysurf.fr>
[pf3gnuchains/gcc-fork.git] / gcc / cpplib.h
index 7282df7..7b3a54a 100644 (file)
@@ -123,7 +123,7 @@ struct file_name_map_list;
   OP(CPP_SCOPE,                "::")                   \
   OP(CPP_DEREF_STAR,   "->*")                  \
   OP(CPP_DOT_STAR,     ".*")                   \
-  OP(CPP_ATSIGN,       "@")  /* used in Objective C */ \
+  OP(CPP_ATSIGN,       "@")  /* used in Objective-C */ \
 \
   TK(CPP_NAME,         SPELL_IDENT)    /* word */                      \
   TK(CPP_NUMBER,       SPELL_NUMBER)   /* 34_be+ta  */                 \
@@ -221,20 +221,12 @@ enum { dump_none = 0, dump_only, dump_names, dump_definitions };
    carries all the options visible to the command line.  */
 struct cpp_options
 {
-  /* Name of input and output files.  */
-  const char *in_fname;
-  const char *out_fname;
-
   /* Characters between tab stops.  */
   unsigned int tabstop;
 
   /* Pending options - -D, -U, -A, -I, -ixxx.  */
   struct cpp_pending *pending;
 
-  /* File name which deps are being written to.  This is 0 if deps are
-     being written to stdout.  */
-  const char *deps_file;
-
   /* Search paths for include files.  */
   struct search_path *quote_include;   /* "" */
   struct search_path *bracket_include;  /* <> */
@@ -280,21 +272,6 @@ struct cpp_options
   /* Nonzero means to allow hexadecimal floats and LL suffixes.  */
   unsigned char extended_numbers;
 
-  /* Nonzero means print the names of included files rather than the
-     preprocessed output.  1 means just the #include "...", 2 means
-     #include <...> as well.  */
-  unsigned char print_deps;
-
-  /* Nonzero if phony targets are created for each header.  */
-  unsigned char deps_phony_targets;
-
-  /* Nonzero if missing .h files in -M output are assumed to be
-     generated files and not errors.  */
-  unsigned char print_deps_missing_files;
-
-  /* If true, fopen (deps_file, "a") else fopen (deps_file, "w").  */
-  unsigned char print_deps_append;
-
   /* Nonzero means print names of header files (-H).  */
   unsigned char print_include_names;
 
@@ -395,16 +372,25 @@ struct cpp_options
   /* Nonzero means handle C++ alternate operator names.  */
   unsigned char operator_names;
 
-  /* True if --help, --version or --target-help appeared in the
-     options.  Stand-alone CPP should then bail out after option
-     parsing; drivers might want to continue printing help.  */
-  unsigned char help_only;
-
   /* True for traditional preprocessing.  */
   unsigned char traditional;
 
-  /* True if only preprocessing and not compiling.  */
-  unsigned char preprocess_only;
+  /* Dependency generation.  */
+  struct
+  {
+    /* Style of header dependencies to generate.  */
+    enum {DEPS_NONE = 0, DEPS_USER, DEPS_SYSTEM } style;
+
+    /* Assume missing files are generated files.  */
+    bool missing_files;
+
+    /* Generate phony targets for each dependency apart from the first
+       one.  */
+    bool phony_targets;
+
+    /* If true, no dependency is generated on the main file.  */
+    bool ignore_main_file;
+  } deps;
 
   /* Target-specific features set by the front end or client.  */
 
@@ -509,6 +495,18 @@ struct cpp_hashnode
 /* Call this first to get a handle to pass to other functions.  */
 extern cpp_reader *cpp_create_reader PARAMS ((enum c_lang));
 
+/* Call this to change the selected language standard (e.g. because of
+   command line options).  */
+extern void cpp_set_lang PARAMS ((cpp_reader *, enum c_lang));
+
+/* Add a dependency TARGET.  Quote it for "make" if QUOTE.  Can be
+   called any number of times before cpp_read_main_file().  If no
+   targets have been added before cpp_read_main_file(), then the
+   default target is used.  */
+extern void cpp_add_dependency_target PARAMS ((cpp_reader *,
+                                              const char * target,
+                                              int quote));
+
 /* Call these to get pointers to the options and callback structures
    for a given reader.  These pointers are good until you call
    cpp_finish on that reader.  You can either edit the callbacks
@@ -522,14 +520,10 @@ extern void cpp_set_callbacks PARAMS ((cpp_reader *, cpp_callbacks *));
 /* Now call cpp_handle_option[s] to handle 1[or more] switches.  The
    return value is the number of arguments used.  If
    cpp_handle_options returns without using all arguments, it couldn't
-   understand the next switch.  When there are no switches left, you
-   must call cpp_post_options before calling cpp_read_main_file.  Only
-   after cpp_post_options are the contents of the cpp_options
-   structure reliable.  Options processing is not completed until you
-   call cpp_finish_options.  */
+   understand the next switch.  Options processing is not completed
+   until you call cpp_finish_options.  */
 extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
 extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
-extern void cpp_post_options PARAMS ((cpp_reader *));
 
 /* This function reads the file, but does not start preprocessing.  It
    returns the name of the original file; this is the same as the
@@ -538,7 +532,7 @@ extern void cpp_post_options PARAMS ((cpp_reader *));
    too.  If there was an error opening the file, it returns NULL.
 
    If you want cpplib to manage its own hashtable, pass in a NULL
-   pointer.  Otherise you should pass in an initialised hash table
+   pointer.  Otherise you should pass in an initialized hash table
    that cpplib will share; this technique is used by the C front
    ends.  */
 extern const char *cpp_read_main_file PARAMS ((cpp_reader *, const char *,
@@ -551,10 +545,17 @@ extern const char *cpp_read_main_file PARAMS ((cpp_reader *, const char *,
    from cpp_read_main_file, before they get debug callbacks.  */
 extern void cpp_finish_options PARAMS ((cpp_reader *));
 
+/* Call this to finish preprocessing.  If you requested dependency
+   generation, pass an open stream to write the information to,
+   otherwise NULL.  It is your responsibility to close the stream.
+
+   Returns cpp_errors (pfile).  */
+extern int cpp_finish PARAMS ((cpp_reader *, FILE *deps_stream));
+
 /* Call this to release the handle at the end of preprocessing.  Any
    use of the handle after this function returns is invalid.  Returns
    cpp_errors (pfile).  */
-extern int cpp_destroy PARAMS ((cpp_reader *));
+extern void cpp_destroy PARAMS ((cpp_reader *));
 
 /* Error count.  */
 extern unsigned int cpp_errors PARAMS ((cpp_reader *));
@@ -568,7 +569,6 @@ extern void cpp_register_pragma PARAMS ((cpp_reader *,
                                         const char *, const char *,
                                         void (*) PARAMS ((cpp_reader *))));
 
-extern void cpp_finish PARAMS ((cpp_reader *));
 extern int cpp_avoid_paste PARAMS ((cpp_reader *, const cpp_token *,
                                    const cpp_token *));
 extern const cpp_token *cpp_get_token PARAMS ((cpp_reader *));
@@ -659,7 +659,7 @@ cpp_num cpp_num_sign_extend PARAMS ((cpp_num, size_t));
 #define DL_ICE                 0x04
 /* Extracts a diagnostic level from an int.  */
 #define DL_EXTRACT(l)          (l & 0xf)
-/* Non-zero if a diagnostic level is one of the warnings.  */
+/* 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)
 
@@ -723,7 +723,7 @@ extern int cpp_included     PARAMS ((cpp_reader *, const char *));
 extern void cpp_make_system_header PARAMS ((cpp_reader *, int, int));
 
 /* In cppmain.c */
-extern void cpp_preprocess_file PARAMS ((cpp_reader *));
+extern void cpp_preprocess_file PARAMS ((cpp_reader *, const char *, FILE *));
 
 #ifdef __cplusplus
 }