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; /* <> */
/* 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;
/* Nonzero means warn about text after an #endif (or #else). */
unsigned char warn_endif_labels;
+ /* Nonzero means warn about implicit sign changes owing to integer
+ promotions. */
+ unsigned char warn_num_sign_change;
+
/* Nonzero means turn warnings into errors. */
unsigned char warnings_are_errors;
/* Nonzero means warn if undefined identifiers are evaluated in an #if. */
unsigned char warn_undef;
+ /* Nonzero means warn of unused macros from the main file. */
+ unsigned char warn_unused_macros;
+
/* Nonzero for the 1999 C Standard, including corrigenda and amendments. */
unsigned char c99;
+ /* Nonzero if we are conforming to a specific C or C++ standard. */
+ unsigned char std;
+
/* Nonzero means give all the error messages the ANSI standard requires. */
unsigned char pedantic;
/* 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;
+ /* 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. */
/* Precision for target CPP arithmetic, target characters, target
ints and target wide characters, respectively. */
size_t precision, char_precision, int_precision, wchar_precision;
- /* Nonzero means chars (wide chars) are unsigned. */
- unsigned char unsigned_char, unsigned_wchar;
+ /* True means chars (wide chars) are unsigned. */
+ bool unsigned_char, unsigned_wchar;
/* Nonzero means __STDC__ should have the value 0 in system headers. */
unsigned char stdc_0_in_system_headers;
/* 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
/* 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 **, int));
-extern void cpp_post_options PARAMS ((cpp_reader *));
+extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
/* This function reads the file, but does not start preprocessing. It
returns the name of the original file; this is the same as the
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 *));
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 *));
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
}