2 Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000 Free Software Foundation, Inc.
4 Contributed by Per Bothner, 1994-95.
5 Based on CCCP program by Paul Rubin, June 1986
6 Adapted to ANSI C, Richard Stallman, Jan 1987
8 This program is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
33 /* Predefined symbols, built-in macros, and the default include path. */
35 #ifndef GET_ENV_PATH_LIST
36 #define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0)
39 #ifndef STANDARD_INCLUDE_DIR
40 #define STANDARD_INCLUDE_DIR "/usr/include"
43 /* We let tm.h override the types used here, to handle trivial differences
44 such as the choice of unsigned int or long unsigned int for size_t.
45 When machines start needing nontrivial differences in the size type,
46 it would be best to do something here to figure out automatically
47 from other information what type to use. */
49 /* The string value for __SIZE_TYPE__. */
52 #define SIZE_TYPE "long unsigned int"
55 /* The string value for __PTRDIFF_TYPE__. */
58 #define PTRDIFF_TYPE "long int"
61 /* The string value for __WCHAR_TYPE__. */
64 #define WCHAR_TYPE "int"
67 /* The string value for __USER_LABEL_PREFIX__ */
69 #ifndef USER_LABEL_PREFIX
70 #define USER_LABEL_PREFIX ""
73 /* The string value for __REGISTER_PREFIX__ */
75 #ifndef REGISTER_PREFIX
76 #define REGISTER_PREFIX ""
79 /* Suffix for object files, and known input-file extensions. */
80 static const char * const known_suffixes
[] =
82 ".c", ".C", ".s", ".S", ".m",
83 ".cc", ".cxx", ".cpp", ".cp", ".c++",
89 # define OBJECT_SUFFIX ".obj"
91 # define OBJECT_SUFFIX ".o"
96 /* This is the default list of directories to search for include files.
97 It may be overridden by the various -I and -ixxx options.
99 #include "file" looks in the same directory as the current file,
101 #include <file> just looks in this list.
103 All these directories are treated as `system' include directories
104 (they are not subject to pedantic warnings in some cases). */
106 static struct default_include
108 const char *fname
; /* The name of the directory. */
109 const char *component
; /* The component containing the directory
110 (see update_path in prefix.c) */
111 int cplusplus
; /* Only look here if we're compiling C++. */
112 int cxx_aware
; /* Includes in this directory don't need to
113 be wrapped in extern "C" when compiling
116 include_defaults_array
[]
117 #ifdef INCLUDE_DEFAULTS
121 /* Pick up GNU C++ specific include files. */
122 { GPLUSPLUS_INCLUDE_DIR
, "G++", 1, 1 },
124 /* This is the dir for fixincludes. Put it just before
125 the files that we fix. */
126 { GCC_INCLUDE_DIR
, "GCC", 0, 0 },
127 /* For cross-compilation, this dir name is generated
128 automatically in Makefile.in. */
129 { CROSS_INCLUDE_DIR
, "GCC", 0, 0 },
130 #ifdef TOOL_INCLUDE_DIR
131 /* This is another place that the target system's headers might be. */
132 { TOOL_INCLUDE_DIR
, "BINUTILS", 0, 1 },
134 #else /* not CROSS_COMPILE */
135 #ifdef LOCAL_INCLUDE_DIR
136 /* This should be /usr/local/include and should come before
137 the fixincludes-fixed header files. */
138 { LOCAL_INCLUDE_DIR
, 0, 0, 1 },
140 #ifdef TOOL_INCLUDE_DIR
141 /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
142 Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */
143 { TOOL_INCLUDE_DIR
, "BINUTILS", 0, 1 },
145 /* This is the dir for fixincludes. Put it just before
146 the files that we fix. */
147 { GCC_INCLUDE_DIR
, "GCC", 0, 0 },
148 /* Some systems have an extra dir of include files. */
149 #ifdef SYSTEM_INCLUDE_DIR
150 { SYSTEM_INCLUDE_DIR
, 0, 0, 0 },
152 #ifndef STANDARD_INCLUDE_COMPONENT
153 #define STANDARD_INCLUDE_COMPONENT 0
155 { STANDARD_INCLUDE_DIR
, STANDARD_INCLUDE_COMPONENT
, 0, 0 },
156 #endif /* not CROSS_COMPILE */
159 #endif /* no INCLUDE_DEFAULTS */
161 /* Internal structures and prototypes. */
163 /* A `struct pending_option' remembers one -D, -A, -U, -include, or -imacros
164 switch. There are four lists: one for -D and -U, one for -A, one
165 for -include, one for -imacros. `undef' is set for -U, clear for
166 -D, ignored for the others.
167 (Future: add an equivalent of -U for -A) */
168 struct pending_option
170 struct pending_option
*next
;
176 #define APPEND(pend, list, elt) \
177 do { if (!(pend)->list##_head) (pend)->list##_head = (elt); \
178 else (pend)->list##_tail->next = (elt); \
179 (pend)->list##_tail = (elt); \
182 #define APPEND(pend, list, elt) \
183 do { if (!(pend)->list/**/_head) (pend)->list/**/_head = (elt); \
184 else (pend)->list/**/_tail->next = (elt); \
185 (pend)->list/**/_tail = (elt); \
189 static void print_help
PARAMS ((void));
190 static void path_include
PARAMS ((cpp_reader
*,
191 struct cpp_pending
*,
193 static void initialize_builtins
PARAMS ((cpp_reader
*));
194 static void append_include_chain
PARAMS ((cpp_reader
*,
195 struct cpp_pending
*,
197 static char *base_name
PARAMS ((const char *));
198 static void dump_special_to_buffer
PARAMS ((cpp_reader
*, const char *));
199 static void initialize_dependency_output
PARAMS ((cpp_reader
*));
200 static void initialize_standard_includes
PARAMS ((cpp_reader
*));
201 static void new_pending_define
PARAMS ((struct cpp_options
*,
204 /* Fourth argument to append_include_chain: chain to use */
205 enum { QUOTE
= 0, BRACKET
, SYSTEM
, AFTER
};
207 /* If gcc is in use (stage2/stage3) we can make this table initialized data. */
209 #define CAT(a, b) a##b
211 #define CAT(a, b) a/**/b
214 #if (GCC_VERSION >= 2007)
215 #define TABLE(id) static inline void CAT(init_, id) PARAMS ((void)) {} \
216 unsigned char id[256] = {
217 #define s(p, v) [p] = v,
220 #define TABLE(id) unsigned char id[256] = { 0 }; \
221 static void CAT(init_,id) PARAMS ((void)) { \
222 unsigned char *x = id;
223 #define s(p, v) x[p] = v;
227 #define A(x) s(x, ISidnum|ISidstart)
228 #define N(x) s(x, ISidnum|ISnumstart)
229 #define H(x) s(x, IShspace|ISspace)
230 #define S(x) s(x, ISspace)
235 A('a') A('b') A('c') A('d') A('e') A('f') A('g') A('h') A('i')
236 A('j') A('k') A('l') A('m') A('n') A('o') A('p') A('q') A('r')
237 A('s') A('t') A('u') A('v') A('w') A('x') A('y') A('z')
239 A('A') A('B') A('C') A('D') A('E') A('F') A('G') A('H') A('I')
240 A('J') A('K') A('L') A('M') A('N') A('O') A('P') A('Q') A('R')
241 A('S') A('T') A('U') A('V') A('W') A('X') A('Y') A('Z')
243 N('1') N('2') N('3') N('4') N('5') N('6') N('7') N('8') N('9') N('0')
245 H(' ') H('\t') H('\v') H('\f')
259 /* Given a colon-separated list of file names PATH,
260 add all the names to the search path for include files. */
263 path_include (pfile
, pend
, list
, path
)
265 struct cpp_pending
*pend
;
275 /* Find the end of this name. */
277 while (*q
!= 0 && *q
!= PATH_SEPARATOR
) q
++;
280 /* An empty name in the path stands for the current directory. */
281 name
= (char *) xmalloc (2);
287 /* Otherwise use the directory that is named. */
288 name
= (char *) xmalloc (q
- p
+ 1);
289 memcpy (name
, p
, q
- p
);
293 append_include_chain (pfile
, pend
, name
, path
, 0);
295 /* Advance past this name. */
303 /* Find the base name of a (partial) pathname FNAME.
304 Returns a pointer into the string passed in.
305 Accepts Unix (/-separated) paths on all systems,
306 DOS and VMS paths on those systems. */
311 char *s
= (char *)fname
;
313 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
314 if (ISALPHA (s
[0]) && s
[1] == ':') s
+= 2;
315 if ((p
= rindex (s
, '\\'))) s
= p
+ 1;
317 if ((p
= rindex (s
, ':'))) s
= p
+ 1; /* Skip device. */
318 if ((p
= rindex (s
, ']'))) s
= p
+ 1; /* Skip directory. */
319 if ((p
= rindex (s
, '>'))) s
= p
+ 1; /* Skip alternate (int'n'l) dir. */
321 if ((p
= rindex (s
, '/'))) s
= p
+ 1;
326 /* Append DIR to include path PATH. DIR must be permanently allocated
329 append_include_chain (pfile
, pend
, dir
, path
, cxx_aware
)
331 struct cpp_pending
*pend
;
336 struct file_name_list
*new;
340 simplify_pathname (dir
);
343 /* Dirs that don't exist are silently ignored. */
345 cpp_notice_from_errno (pfile
, dir
);
346 else if (CPP_OPTIONS (pfile
)->verbose
)
347 fprintf (stderr
, _("ignoring nonexistent directory `%s'\n"), dir
);
351 if (!S_ISDIR (st
.st_mode
))
353 cpp_notice (pfile
, "%s: Not a directory", dir
);
358 if (len
> pfile
->max_include_len
)
359 pfile
->max_include_len
= len
;
361 new = (struct file_name_list
*)xmalloc (sizeof (struct file_name_list
));
364 new->ino
= st
.st_ino
;
365 new->dev
= st
.st_dev
;
367 new->sysp
= cxx_aware
? 1 : 2;
370 new->name_map
= NULL
;
376 case QUOTE
: APPEND (pend
, quote
, new); break;
377 case BRACKET
: APPEND (pend
, brack
, new); break;
378 case SYSTEM
: APPEND (pend
, systm
, new); break;
379 case AFTER
: APPEND (pend
, after
, new); break;
384 /* Write out a #define command for the special named MACRO_NAME
385 to PFILE's token_buffer. */
388 dump_special_to_buffer (pfile
, macro_name
)
390 const char *macro_name
;
392 static const char define_directive
[] = "#define ";
393 int macro_name_length
= strlen (macro_name
);
394 output_line_command (pfile
, same_file
);
395 CPP_RESERVE (pfile
, sizeof(define_directive
) + macro_name_length
);
396 CPP_PUTS_Q (pfile
, define_directive
, sizeof(define_directive
)-1);
397 CPP_PUTS_Q (pfile
, macro_name
, macro_name_length
);
398 CPP_PUTC_Q (pfile
, ' ');
399 cpp_expand_to_buffer (pfile
, macro_name
, macro_name_length
);
400 CPP_PUTC (pfile
, '\n');
403 /* Initialize a cpp_options structure. */
405 cpp_options_init (opts
)
408 bzero ((char *) opts
, sizeof (struct cpp_options
));
410 opts
->dollars_in_ident
= 1;
411 opts
->cplusplus_comments
= 1;
412 opts
->warn_import
= 1;
413 opts
->discard_comments
= 1;
416 (struct cpp_pending
*) xcalloc (1, sizeof (struct cpp_pending
));
419 /* Initialize a cpp_reader structure. */
421 cpp_reader_init (pfile
)
424 bzero ((char *) pfile
, sizeof (cpp_reader
));
426 pfile
->token_buffer_size
= 200;
427 pfile
->token_buffer
= (U_CHAR
*) xmalloc (pfile
->token_buffer_size
);
428 CPP_SET_WRITTEN (pfile
, 0);
430 pfile
->hashtab
= (HASHNODE
**) xcalloc (HASHSIZE
, sizeof (HASHNODE
*));
433 /* Free resources used by PFILE.
434 This is the cpp_reader 'finalizer' or 'destructor' (in C++ terminology). */
440 while (CPP_BUFFER (pfile
) != CPP_NULL_BUFFER (pfile
))
441 cpp_pop_buffer (pfile
);
443 if (pfile
->token_buffer
)
445 free (pfile
->token_buffer
);
446 pfile
->token_buffer
= NULL
;
449 if (pfile
->deps_buffer
)
451 free (pfile
->deps_buffer
);
452 pfile
->deps_buffer
= NULL
;
453 pfile
->deps_allocated_size
= 0;
456 if (pfile
->input_buffer
)
458 free (pfile
->input_buffer
);
459 free (pfile
->input_speccase
);
460 pfile
->input_buffer
= pfile
->input_speccase
= NULL
;
461 pfile
->input_buffer_len
= 0;
464 while (pfile
->if_stack
)
466 IF_STACK_FRAME
*temp
= pfile
->if_stack
;
467 pfile
->if_stack
= temp
->next
;
471 for (i
= ALL_INCLUDE_HASHSIZE
; --i
>= 0; )
473 struct include_hash
*imp
= pfile
->all_include_files
[i
];
476 struct include_hash
*next
= imp
->next
;
478 /* This gets freed elsewhere - I think. */
484 pfile
->all_include_files
[i
] = 0;
487 for (i
= HASHSIZE
; --i
>= 0;)
489 while (pfile
->hashtab
[i
])
490 delete_macro (pfile
->hashtab
[i
]);
492 free (pfile
->hashtab
);
496 /* This structure defines one built-in macro. A node of type TYPE will
497 be entered in the macro hash table under the name NAME, with value
498 VALUE (if any). FLAGS tweaks the behavior a little:
499 DUMP write debug info for this macro
500 STDC define only if not -traditional
501 ULP value is the global user_label_prefix (which can't be
502 put directly into the table).
510 unsigned short flags
;
516 static const struct builtin builtin_array
[] =
518 { "__TIME__", 0, T_TIME
, DUMP
},
519 { "__DATE__", 0, T_DATE
, DUMP
},
520 { "__FILE__", 0, T_FILE
, 0 },
521 { "__BASE_FILE__", 0, T_BASE_FILE
, 0 },
522 { "__LINE__", 0, T_SPECLINE
, 0 },
523 { "__INCLUDE_LEVEL__", 0, T_INCLUDE_LEVEL
, 0 },
524 { "__VERSION__", 0, T_VERSION
, DUMP
},
525 { "__STDC__", 0, T_STDC
, DUMP
|STDC
},
527 { "__USER_LABEL_PREFIX__", 0, T_CONST
, ULP
},
528 { "__REGISTER_PREFIX__", REGISTER_PREFIX
, T_CONST
, 0 },
529 { "__HAVE_BUILTIN_SETJMP__", "1", T_CONST
, 0 },
530 #ifndef NO_BUILTIN_SIZE_TYPE
531 { "__SIZE_TYPE__", SIZE_TYPE
, T_CONST
, DUMP
},
533 #ifndef NO_BUILTIN_PTRDIFF_TYPE
534 { "__PTRDIFF_TYPE__", PTRDIFF_TYPE
, T_CONST
, DUMP
},
536 #ifndef NO_BUILTIN_WCHAR_TYPE
537 { "__WCHAR_TYPE__", WCHAR_TYPE
, T_CONST
, DUMP
},
542 /* Subroutine of cpp_start_read; reads the builtins table above and
543 enters the macros into the hash table. */
546 initialize_builtins (pfile
)
550 const struct builtin
*b
;
552 for(b
= builtin_array
; b
->name
; b
++)
554 if ((b
->flags
& STDC
) && CPP_TRADITIONAL (pfile
))
557 val
= (b
->flags
& ULP
) ? user_label_prefix
: b
->value
;
558 len
= strlen (b
->name
);
560 cpp_install (pfile
, b
->name
, len
, b
->type
, val
);
561 if ((b
->flags
& DUMP
) && CPP_OPTIONS (pfile
)->debug_output
)
562 dump_special_to_buffer (pfile
, b
->name
);
570 /* Another subroutine of cpp_start_read. This one sets up to do
571 dependency-file output. */
573 initialize_dependency_output (pfile
)
576 cpp_options
*opts
= CPP_OPTIONS (pfile
);
577 char *spec
, *s
, *output_file
;
579 /* Either of two environment variables can specify output of deps.
580 Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET",
581 where OUTPUT_FILE is the file to write deps info to
582 and DEPS_TARGET is the target to mention in the deps. */
584 if (opts
->print_deps
== 0)
586 spec
= getenv ("DEPENDENCIES_OUTPUT");
588 opts
->print_deps
= 1;
591 spec
= getenv ("SUNPRO_DEPENDENCIES");
593 opts
->print_deps
= 2;
598 /* Find the space before the DEPS_TARGET, if there is one. */
599 s
= strchr (spec
, ' ');
602 opts
->deps_target
= s
+ 1;
603 output_file
= (char *) xmalloc (s
- spec
+ 1);
604 memcpy (output_file
, spec
, s
- spec
);
605 output_file
[s
- spec
] = 0;
609 opts
->deps_target
= 0;
613 opts
->deps_file
= output_file
;
614 opts
->print_deps_append
= 1;
617 /* Print the expected object file name as the target of this Make-rule. */
618 pfile
->deps_allocated_size
= 200;
619 pfile
->deps_buffer
= (char *) xmalloc (pfile
->deps_allocated_size
);
620 pfile
->deps_buffer
[0] = 0;
621 pfile
->deps_size
= 0;
622 pfile
->deps_column
= 0;
624 if (opts
->deps_target
)
625 deps_output (pfile
, opts
->deps_target
, ':');
626 else if (*opts
->in_fname
== 0)
627 deps_output (pfile
, "-", ':');
633 /* Discard all directory prefixes from filename. */
634 q
= base_name (opts
->in_fname
);
636 /* Copy remainder to mungable area. */
638 p
= (char *) alloca (len
+ 8);
641 /* Output P, but remove known suffixes. */
643 /* Point to the filename suffix. */
644 r
= strrchr (p
, '.');
646 /* Compare against the known suffixes. */
647 for (x
= 0; known_suffixes
[x
]; x
++)
648 if (strncmp (known_suffixes
[x
], r
, q
- r
) == 0)
650 /* Make q point to the bit we're going to overwrite
651 with an object suffix. */
656 /* Supply our own suffix. */
657 strcpy (q
, OBJECT_SUFFIX
);
659 deps_output (pfile
, p
, ':');
660 deps_output (pfile
, opts
->in_fname
, ' ');
664 /* And another subroutine. This one sets up the standard include path. */
666 initialize_standard_includes (pfile
)
669 cpp_options
*opts
= CPP_OPTIONS (pfile
);
671 struct default_include
*p
= include_defaults_array
;
672 char *specd_prefix
= opts
->include_prefix
;
674 /* Several environment variables may add to the include search path.
675 CPATH specifies an additional list of directories to be searched
676 as if specified with -I, while C_INCLUDE_PATH, CPLUS_INCLUDE_PATH,
677 etc. specify an additional list of directories to be searched as
678 if specified with -isystem, for the language indicated. */
680 GET_ENV_PATH_LIST (path
, "CPATH");
681 if (path
!= 0 && *path
!= 0)
682 path_include (pfile
, opts
->pending
, path
, BRACKET
);
684 switch ((opts
->objc
<< 1) + opts
->cplusplus
)
687 GET_ENV_PATH_LIST (path
, "C_INCLUDE_PATH");
690 GET_ENV_PATH_LIST (path
, "CPLUS_INCLUDE_PATH");
693 GET_ENV_PATH_LIST (path
, "OBJC_INCLUDE_PATH");
696 GET_ENV_PATH_LIST (path
, "OBJCPLUS_INCLUDE_PATH");
699 if (path
!= 0 && *path
!= 0)
700 path_include (pfile
, opts
->pending
, path
, SYSTEM
);
702 /* Search "translated" versions of GNU directories.
703 These have /usr/local/lib/gcc... replaced by specd_prefix. */
704 if (specd_prefix
!= 0)
706 char *default_prefix
= alloca (sizeof GCC_INCLUDE_DIR
- 7);
707 /* Remove the `include' from /usr/local/lib/gcc.../include.
708 GCC_INCLUDE_DIR will always end in /include. */
709 int default_len
= sizeof GCC_INCLUDE_DIR
- 8;
710 int specd_len
= strlen (specd_prefix
);
712 memcpy (default_prefix
, GCC_INCLUDE_DIR
, default_len
);
713 default_prefix
[default_len
] = '\0';
715 for (p
= include_defaults_array
; p
->fname
; p
++)
717 /* Some standard dirs are only for C++. */
720 && !opts
->no_standard_cplusplus_includes
))
722 /* Does this dir start with the prefix? */
723 if (!strncmp (p
->fname
, default_prefix
, default_len
))
725 /* Yes; change prefix and add to search list. */
726 int flen
= strlen (p
->fname
);
727 int this_len
= specd_len
+ flen
- default_len
;
728 char *str
= (char *) xmalloc (this_len
+ 1);
729 memcpy (str
, specd_prefix
, specd_len
);
730 memcpy (str
+ specd_len
,
731 p
->fname
+ default_len
,
732 flen
- default_len
+ 1);
734 append_include_chain (pfile
, opts
->pending
,
735 str
, SYSTEM
, p
->cxx_aware
);
741 /* Search ordinary names for GNU include directories. */
742 for (p
= include_defaults_array
; p
->fname
; p
++)
744 /* Some standard dirs are only for C++. */
747 && !opts
->no_standard_cplusplus_includes
))
749 /* XXX Potential memory leak! */
750 char *str
= xstrdup (update_path (p
->fname
, p
->component
));
751 append_include_chain (pfile
, opts
->pending
, str
, SYSTEM
,
757 /* This is called after options have been processed.
758 * Check options for consistency, and setup for processing input
759 * from the file named FNAME. (Use standard input if FNAME==NULL.)
760 * Return 1 on success, 0 on failure.
764 cpp_start_read (pfile
, fname
)
768 struct cpp_options
*opts
= CPP_OPTIONS (pfile
);
769 struct pending_option
*p
, *q
;
771 /* -MG doesn't select the form of output and must be specified with one of
772 -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't
773 inhibit compilation. */
774 if (opts
->print_deps_missing_files
775 && (opts
->print_deps
== 0 || !opts
->no_output
))
777 cpp_fatal (pfile
, "-MG must be specified with one of -M or -MM");
781 /* Chill should not be used with -trigraphs. */
782 if (opts
->chill
&& opts
->trigraphs
)
784 cpp_warning (pfile
, "-lang-chill and -trigraphs are mutually exclusive");
788 /* Set this if it hasn't been set already. */
789 if (user_label_prefix
== NULL
)
790 user_label_prefix
= USER_LABEL_PREFIX
;
792 /* Don't bother trying to do macro expansion if we've already done
794 if (opts
->preprocessed
)
795 pfile
->no_macro_expand
++;
797 /* Now that we know dollars_in_ident, we can initialize the syntax
800 /* XXX Get rid of code that depends on this, then IStable can
802 if (opts
->dollars_in_ident
)
803 IStable
['$'] = ISidstart
|ISidnum
;
805 /* Set up the include search path now. */
806 if (! opts
->no_standard_includes
)
807 initialize_standard_includes (pfile
);
809 merge_include_chains (opts
);
811 /* With -v, print the list of dirs to search. */
814 struct file_name_list
*l
;
815 fprintf (stderr
, _("#include \"...\" search starts here:\n"));
816 for (l
= opts
->quote_include
; l
; l
= l
->next
)
818 if (l
== opts
->bracket_include
)
819 fprintf (stderr
, _("#include <...> search starts here:\n"));
820 fprintf (stderr
, " %s\n", l
->name
);
822 fprintf (stderr
, _("End of search list.\n"));
825 initialize_dependency_output (pfile
);
827 /* Open the main input file. This must be done before -D processing
828 so we have a buffer to stand on. */
829 if (opts
->in_fname
== NULL
|| *opts
->in_fname
== 0)
831 opts
->in_fname
= fname
;
832 if (opts
->in_fname
== NULL
)
836 if (!cpp_read_file (pfile
, fname
))
839 /* -D and friends may produce output, which should be identified
842 CPP_BUFFER (pfile
)->lineno
= 0;
844 /* Install __LINE__, etc. */
845 initialize_builtins (pfile
);
847 /* Do -U's, -D's and -A's in the order they were seen. */
848 p
= opts
->pending
->define_head
;
852 cpp_undef (pfile
, p
->arg
);
854 cpp_define (pfile
, p
->arg
);
861 p
= opts
->pending
->assert_head
;
865 cpp_unassert (pfile
, p
->arg
);
867 cpp_assert (pfile
, p
->arg
);
874 opts
->done_initializing
= 1;
875 CPP_BUFFER (pfile
)->lineno
= 1;
877 if (opts
->preprocessed
)
878 /* If we've already processed this code, we want to trust the #line
879 directives in the input. But we still need to update our line
880 counter accordingly. */
881 pfile
->lineno
= CPP_BUFFER (pfile
)->lineno
;
883 output_line_command (pfile
, same_file
);
884 pfile
->only_seen_white
= 2;
886 /* The -imacros files can be scanned now, but the -include files
887 have to be pushed onto the include stack and processed later,
888 in the main loop calling cpp_get_token. */
891 p
= opts
->pending
->imacros_head
;
894 if (cpp_read_file (pfile
, p
->arg
))
895 cpp_scan_buffer (pfile
);
903 p
= opts
->pending
->include_head
;
906 if (cpp_read_file (pfile
, p
->arg
))
907 output_line_command (pfile
, enter_file
);
914 free (opts
->pending
);
915 opts
->pending
= NULL
;
920 /* This is called at the end of preprocessing. It pops the
921 last buffer and writes dependency output. It should also
922 clear macro definitions, such that you could call cpp_start_read
923 with a new filename to restart processing. */
928 struct cpp_options
*opts
= CPP_OPTIONS (pfile
);
930 if (CPP_PREV_BUFFER (CPP_BUFFER (pfile
)) != CPP_NULL_BUFFER (pfile
))
931 cpp_ice (pfile
, "buffers still stacked in cpp_finish");
932 cpp_pop_buffer (pfile
);
934 if (opts
->print_deps
)
936 /* Stream on which to print the dependency information. */
937 FILE *deps_stream
= 0;
939 /* Don't actually write the deps file if compilation has failed. */
940 if (pfile
->errors
== 0)
942 const char *deps_mode
= opts
->print_deps_append
? "a" : "w";
943 if (opts
->deps_file
== 0)
944 deps_stream
= stdout
;
945 else if ((deps_stream
= fopen (opts
->deps_file
, deps_mode
)) == 0)
946 cpp_notice_from_errno (pfile
, opts
->deps_file
);
950 fputs (pfile
->deps_buffer
, deps_stream
);
951 putc ('\n', deps_stream
);
954 if (ferror (deps_stream
) || fclose (deps_stream
) != 0)
955 cpp_fatal (pfile
, "I/O error on output");
961 if (opts
->dump_macros
== dump_only
)
965 for (i
= HASHSIZE
; --i
>= 0;)
967 for (h
= pfile
->hashtab
[i
]; h
; h
= h
->next
)
968 if (h
->type
== T_MACRO
)
970 dump_definition (pfile
, h
->name
, h
->length
, h
->value
.defn
);
971 CPP_PUTC (pfile
, '\n');
978 new_pending_define (opts
, text
)
979 struct cpp_options
*opts
;
982 struct pending_option
*o
= (struct pending_option
*)
983 xmalloc (sizeof (struct pending_option
));
985 o
->arg
= (char *) text
;
988 APPEND (opts
->pending
, define
, o
);
991 /* Handle one command-line option in (argc, argv).
992 Can be called multiple times, to handle multiple sets of options.
993 Returns number of strings consumed. */
996 cpp_handle_option (pfile
, argc
, argv
)
1001 struct cpp_options
*opts
= CPP_OPTIONS (pfile
);
1004 if (argv
[i
][0] != '-')
1006 if (opts
->out_fname
!= NULL
)
1009 cpp_fatal (pfile
, "Too many arguments");
1011 else if (opts
->in_fname
!= NULL
)
1012 opts
->out_fname
= argv
[i
];
1014 opts
->in_fname
= argv
[i
];
1020 if (!strcmp (argv
[i
], "-fleading-underscore"))
1021 user_label_prefix
= "_";
1022 else if (!strcmp (argv
[i
], "-fno-leading-underscore"))
1023 user_label_prefix
= "";
1024 else if (!strcmp (argv
[i
], "-fpreprocessed"))
1025 opts
->preprocessed
= 1;
1026 else if (!strcmp (argv
[i
], "-fno-preprocessed"))
1027 opts
->preprocessed
= 0;
1034 case 'I': /* Add directory to path for includes. */
1035 if (!strcmp (argv
[i
] + 2, "-"))
1038 Use the preceding -I directories for #include "..."
1039 but not #include <...>.
1040 Don't search the directory of the present file
1041 for #include "...". (Note that -I. -I- is not the same as
1042 the default setup; -I. uses the compiler's working dir.) */
1043 if (! opts
->ignore_srcdir
)
1045 opts
->ignore_srcdir
= 1;
1046 opts
->pending
->quote_head
= opts
->pending
->brack_head
;
1047 opts
->pending
->quote_tail
= opts
->pending
->brack_tail
;
1048 opts
->pending
->brack_head
= 0;
1049 opts
->pending
->brack_tail
= 0;
1053 cpp_fatal (pfile
, "-I- specified twice");
1060 if (argv
[i
][2] != 0)
1061 fname
= argv
[i
] + 2;
1062 else if (i
+ 1 == argc
)
1063 goto missing_dirname
;
1066 append_include_chain (pfile
, opts
->pending
,
1067 xstrdup (fname
), BRACKET
, 0);
1072 /* Add directory to beginning of system include path, as a system
1073 include directory. */
1074 if (!strcmp (argv
[i
], "-isystem"))
1077 goto missing_filename
;
1078 append_include_chain (pfile
, opts
->pending
,
1079 xstrdup (argv
[++i
]), SYSTEM
, 0);
1081 else if (!strcmp (argv
[i
], "-include"))
1084 goto missing_filename
;
1087 struct pending_option
*o
= (struct pending_option
*)
1088 xmalloc (sizeof (struct pending_option
));
1091 /* This list has to be built in reverse order so that
1092 when cpp_start_read pushes all the -include files onto
1093 the buffer stack, they will be scanned in forward order. */
1094 o
->next
= opts
->pending
->include_head
;
1095 opts
->pending
->include_head
= o
;
1098 else if (!strcmp (argv
[i
], "-imacros"))
1101 goto missing_filename
;
1104 struct pending_option
*o
= (struct pending_option
*)
1105 xmalloc (sizeof (struct pending_option
));
1109 APPEND (opts
->pending
, imacros
, o
);
1112 /* Add directory to end of path for includes,
1113 with the default prefix at the front of its name. */
1114 else if (!strcmp (argv
[i
], "-iwithprefix"))
1119 goto missing_dirname
;
1121 len
= strlen (argv
[i
]);
1123 if (opts
->include_prefix
!= 0)
1125 fname
= xmalloc (opts
->include_prefix_len
+ len
+ 1);
1126 memcpy (fname
, opts
->include_prefix
, opts
->include_prefix_len
);
1127 memcpy (fname
+ opts
->include_prefix_len
, argv
[i
], len
+ 1);
1131 fname
= xmalloc (sizeof GCC_INCLUDE_DIR
- 8 + len
);
1132 memcpy (fname
, GCC_INCLUDE_DIR
, sizeof GCC_INCLUDE_DIR
- 9);
1133 memcpy (fname
+ sizeof GCC_INCLUDE_DIR
- 9, argv
[i
], len
+ 1);
1136 append_include_chain (pfile
, opts
->pending
, fname
, SYSTEM
, 0);
1138 /* Add directory to main path for includes,
1139 with the default prefix at the front of its name. */
1140 else if (!strcmp (argv
[i
], "-iwithprefixbefore"))
1145 goto missing_dirname
;
1147 len
= strlen (argv
[i
]);
1149 if (opts
->include_prefix
!= 0)
1151 fname
= xmalloc (opts
->include_prefix_len
+ len
+ 1);
1152 memcpy (fname
, opts
->include_prefix
, opts
->include_prefix_len
);
1153 memcpy (fname
+ opts
->include_prefix_len
, argv
[i
], len
+ 1);
1157 fname
= xmalloc (sizeof GCC_INCLUDE_DIR
- 8 + len
);
1158 memcpy (fname
, GCC_INCLUDE_DIR
, sizeof GCC_INCLUDE_DIR
- 9);
1159 memcpy (fname
+ sizeof GCC_INCLUDE_DIR
- 9, argv
[i
], len
+ 1);
1162 append_include_chain (pfile
, opts
->pending
, fname
, BRACKET
, 0);
1164 /* Add directory to end of path for includes. */
1165 else if (!strcmp (argv
[i
], "-idirafter"))
1168 goto missing_dirname
;
1169 append_include_chain (pfile
, opts
->pending
,
1170 xstrdup (argv
[++i
]), AFTER
, 0);
1172 else if (!strcmp (argv
[i
], "-iprefix"))
1175 goto missing_filename
;
1178 opts
->include_prefix
= argv
[++i
];
1179 opts
->include_prefix_len
= strlen (argv
[i
]);
1185 if (opts
->out_fname
!= NULL
)
1187 cpp_fatal (pfile
, "Output filename specified twice");
1191 goto missing_filename
;
1192 opts
->out_fname
= argv
[++i
];
1193 if (!strcmp (opts
->out_fname
, "-"))
1194 opts
->out_fname
= "";
1198 if (!strcmp (argv
[i
], "-pedantic"))
1200 else if (!strcmp (argv
[i
], "-pedantic-errors"))
1203 opts
->pedantic_errors
= 1;
1208 if (!strcmp (argv
[i
], "-traditional"))
1210 opts
->traditional
= 1;
1211 opts
->cplusplus_comments
= 0;
1212 opts
->trigraphs
= 0;
1213 opts
->warn_trigraphs
= 0;
1215 else if (!strcmp (argv
[i
], "-trigraphs"))
1216 opts
->trigraphs
= 1;
1220 if (! strcmp (argv
[i
], "-lang-c"))
1221 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1, opts
->c89
= 0,
1222 opts
->c99
= 1, opts
->objc
= 0;
1223 if (! strcmp (argv
[i
], "-lang-c89"))
1225 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 0;
1226 opts
->c89
= 1, opts
->c99
= 0, opts
->objc
= 0;
1227 opts
->trigraphs
= 1;
1228 new_pending_define (opts
, "__STRICT_ANSI__");
1230 if (! strcmp (argv
[i
], "-lang-c++"))
1231 opts
->cplusplus
= 1, opts
->cplusplus_comments
= 1, opts
->c89
= 0,
1232 opts
->c99
= 0, opts
->objc
= 0;
1233 if (! strcmp (argv
[i
], "-lang-objc"))
1234 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1, opts
->c89
= 0,
1235 opts
->c99
= 0, opts
->objc
= 1;
1236 if (! strcmp (argv
[i
], "-lang-objc++"))
1237 opts
->cplusplus
= 1, opts
->cplusplus_comments
= 1, opts
->c89
= 0,
1238 opts
->c99
= 0, opts
->objc
= 1;
1239 if (! strcmp (argv
[i
], "-lang-asm"))
1241 if (! strcmp (argv
[i
], "-lang-fortran"))
1242 opts
->lang_fortran
= 1, opts
->cplusplus_comments
= 0;
1243 if (! strcmp (argv
[i
], "-lang-chill"))
1244 opts
->objc
= 0, opts
->cplusplus
= 0, opts
->chill
= 1,
1245 opts
->traditional
= 1;
1249 opts
->cplusplus
= 1, opts
->cplusplus_comments
= 1;
1253 if (!strcmp (argv
[i
], "-std=gnu89"))
1255 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1;
1256 opts
->c89
= 1, opts
->c99
= 0, opts
->objc
= 0;
1258 else if (!strcmp (argv
[i
], "-std=gnu9x")
1259 || !strcmp (argv
[i
], "-std=gnu99"))
1261 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1;
1262 opts
->c89
= 0, opts
->c99
= 1, opts
->objc
= 0;
1263 new_pending_define (opts
, "__STDC_VERSION__=199901L");
1265 else if (!strcmp (argv
[i
], "-std=iso9899:1990")
1266 || !strcmp (argv
[i
], "-std=c89"))
1268 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 0;
1269 opts
->c89
= 1, opts
->c99
= 0, opts
->objc
= 0;
1270 opts
->trigraphs
= 1;
1271 new_pending_define (opts
, "__STRICT_ANSI__");
1273 else if (!strcmp (argv
[i
], "-std=iso9899:199409"))
1275 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 0;
1276 opts
->c89
= 1, opts
->c99
= 0, opts
->objc
= 0;
1277 opts
->trigraphs
= 1;
1278 new_pending_define (opts
, "__STRICT_ANSI__");
1279 new_pending_define (opts
, "__STDC_VERSION__=199409L");
1281 else if (!strcmp (argv
[i
], "-std=iso9899:199x")
1282 || !strcmp (argv
[i
], "-std=iso9899:1999")
1283 || !strcmp (argv
[i
], "-std=c9x")
1284 || !strcmp (argv
[i
], "-std=c99"))
1286 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1;
1287 opts
->c89
= 0, opts
->c99
= 1, opts
->objc
= 0;
1288 opts
->trigraphs
= 1;
1289 new_pending_define (opts
, "__STRICT_ANSI__");
1290 new_pending_define (opts
, "__STDC_VERSION__=199901L");
1295 opts
->inhibit_warnings
= 1;
1299 if (!strcmp (argv
[i
], "-Wtrigraphs"))
1300 opts
->warn_trigraphs
= 1;
1301 else if (!strcmp (argv
[i
], "-Wno-trigraphs"))
1302 opts
->warn_trigraphs
= 0;
1303 else if (!strcmp (argv
[i
], "-Wcomment"))
1304 opts
->warn_comments
= 1;
1305 else if (!strcmp (argv
[i
], "-Wno-comment"))
1306 opts
->warn_comments
= 0;
1307 else if (!strcmp (argv
[i
], "-Wcomments"))
1308 opts
->warn_comments
= 1;
1309 else if (!strcmp (argv
[i
], "-Wno-comments"))
1310 opts
->warn_comments
= 0;
1311 else if (!strcmp (argv
[i
], "-Wtraditional"))
1312 opts
->warn_stringify
= 1;
1313 else if (!strcmp (argv
[i
], "-Wno-traditional"))
1314 opts
->warn_stringify
= 0;
1315 else if (!strcmp (argv
[i
], "-Wundef"))
1316 opts
->warn_undef
= 1;
1317 else if (!strcmp (argv
[i
], "-Wno-undef"))
1318 opts
->warn_undef
= 0;
1319 else if (!strcmp (argv
[i
], "-Wimport"))
1320 opts
->warn_import
= 1;
1321 else if (!strcmp (argv
[i
], "-Wno-import"))
1322 opts
->warn_import
= 0;
1323 else if (!strcmp (argv
[i
], "-Werror"))
1324 opts
->warnings_are_errors
= 1;
1325 else if (!strcmp (argv
[i
], "-Wno-error"))
1326 opts
->warnings_are_errors
= 0;
1327 else if (!strcmp (argv
[i
], "-Wall"))
1329 opts
->warn_trigraphs
= 1;
1330 opts
->warn_comments
= 1;
1335 /* The style of the choices here is a bit mixed.
1336 The chosen scheme is a hybrid of keeping all options in one string
1337 and specifying each option in a separate argument:
1338 -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
1339 -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
1340 -M[M][G][D file]. This is awkward to handle in specs, and is not
1342 /* ??? -MG must be specified in addition to one of -M or -MM.
1343 This can be relaxed in the future without breaking anything.
1344 The converse isn't true. */
1346 /* -MG isn't valid with -MD or -MMD. This is checked for later. */
1347 if (!strcmp (argv
[i
], "-MG"))
1349 opts
->print_deps_missing_files
= 1;
1352 if (!strcmp (argv
[i
], "-M"))
1353 opts
->print_deps
= 2;
1354 else if (!strcmp (argv
[i
], "-MM"))
1355 opts
->print_deps
= 1;
1356 else if (!strcmp (argv
[i
], "-MD"))
1357 opts
->print_deps
= 2;
1358 else if (!strcmp (argv
[i
], "-MMD"))
1359 opts
->print_deps
= 1;
1360 /* For -MD and -MMD options, write deps on file named by next arg. */
1361 if (!strcmp (argv
[i
], "-MD") || !strcmp (argv
[i
], "-MMD"))
1364 goto missing_filename
;
1365 opts
->deps_file
= argv
[++i
];
1369 /* For -M and -MM, write deps on standard output
1370 and suppress the usual output. */
1371 opts
->no_output
= 1;
1377 char *p
= argv
[i
] + 2;
1379 while ((c
= *p
++) != 0)
1381 /* Arg to -d specifies what parts of macros to dump */
1385 opts
->dump_macros
= dump_only
;
1386 opts
->no_output
= 1;
1389 opts
->dump_macros
= dump_names
;
1392 opts
->dump_macros
= dump_definitions
;
1395 opts
->dump_includes
= 1;
1403 if (argv
[i
][2] == '3')
1404 opts
->debug_output
= 1;
1408 if (!strcmp (argv
[i
], "--help"))
1410 else if (!strcmp (argv
[i
], "--version"))
1411 fprintf (stderr
, _("GNU CPP version %s (cpplib)\n"), version_string
);
1416 fprintf (stderr
, _("GNU CPP version %s (cpplib)\n"), version_string
);
1417 #ifdef TARGET_VERSION
1420 fputc ('\n', stderr
);
1425 opts
->print_include_names
= 1;
1431 if (argv
[i
][2] != 0)
1433 else if (i
+ 1 == argc
)
1435 cpp_fatal (pfile
, "Macro name missing after -D option");
1440 new_pending_define (opts
, text
);
1448 if (argv
[i
][2] != 0)
1450 else if (i
+ 1 == argc
)
1452 cpp_fatal (pfile
, "Assertion missing after -A option");
1458 if (strcmp (p
, "-"))
1460 struct pending_option
*o
= (struct pending_option
*)
1461 xmalloc (sizeof (struct pending_option
));
1466 APPEND (opts
->pending
, assert, o
);
1470 /* -A- eliminates all predefined macros and assertions.
1471 Let's include also any that were specified earlier
1472 on the command line. That way we can get rid of any
1473 that were passed automatically in from GCC. */
1474 struct pending_option
*o1
, *o2
;
1476 o1
= opts
->pending
->define_head
;
1483 o1
= opts
->pending
->assert_head
;
1490 opts
->pending
->assert_head
= NULL
;
1491 opts
->pending
->assert_tail
= NULL
;
1492 opts
->pending
->define_head
= NULL
;
1493 opts
->pending
->define_tail
= NULL
;
1500 struct pending_option
*o
= (struct pending_option
*)
1501 xmalloc (sizeof (struct pending_option
));
1503 if (argv
[i
][2] != 0)
1504 o
->arg
= argv
[i
] + 2;
1505 else if (i
+ 1 == argc
)
1507 cpp_fatal (pfile
, "Macro name missing after -U option");
1515 APPEND (opts
->pending
, define
, o
);
1520 opts
->discard_comments
= 0;
1523 case 'E': /* -E comes from cc -E; ignore it. */
1527 opts
->no_line_commands
= 1;
1530 case '$': /* Don't include $ in identifiers. */
1531 opts
->dollars_in_ident
= 0;
1535 if (!strcmp (argv
[i
], "-nostdinc"))
1536 /* -nostdinc causes no default include directories.
1537 You must specify all include-file directories with -I. */
1538 opts
->no_standard_includes
= 1;
1539 else if (!strcmp (argv
[i
], "-nostdinc++"))
1540 /* -nostdinc++ causes no default C++-specific include directories. */
1541 opts
->no_standard_cplusplus_includes
= 1;
1545 if (!strcmp (argv
[i
], "-remap"))
1549 case '\0': /* JF handle '-' as file name meaning stdin or stdout */
1550 if (opts
->in_fname
== NULL
)
1551 opts
->in_fname
= "";
1552 else if (opts
->out_fname
== NULL
)
1553 opts
->out_fname
= "";
1555 return i
; /* error */
1565 cpp_fatal (pfile
, "Filename missing after `%s' option", argv
[i
]);
1568 cpp_fatal (pfile
, "Directory name missing after `%s' option", argv
[i
]);
1572 /* Handle command-line options in (argc, argv).
1573 Can be called multiple times, to handle multiple sets of options.
1574 Returns if an unrecognized option is seen.
1575 Returns number of strings consumed. */
1578 cpp_handle_options (pfile
, argc
, argv
)
1584 int strings_processed
;
1585 for (i
= 0; i
< argc
; i
+= strings_processed
)
1587 strings_processed
= cpp_handle_option (pfile
, argc
- i
, argv
+ i
);
1588 if (strings_processed
== 0)
1597 fprintf (stderr
, _("Usage: %s [switches] input output\n"), progname
);
1600 -include <file> Include the contents of <file> before other files\n\
1601 -imacros <file> Accept definition of macros in <file>\n\
1602 -iprefix <path> Specify <path> as a prefix for next two options\n\
1603 -iwithprefix <dir> Add <dir> to the end of the system include path\n\
1604 -iwithprefixbefore <dir> Add <dir> to the end of the main include path\n\
1605 -isystem <dir> Add <dir> to the start of the system include path\n\
1606 -idirafter <dir> Add <dir> to the end of the system include path\n\
1607 -I <dir> Add <dir> to the end of the main include path\n\
1608 -nostdinc Do not search system include directories\n\
1609 (dirs specified with -isystem will still be used)\n\
1610 -nostdinc++ Do not search system include directories for C++\n\
1611 -o <file> Put output into <file>\n\
1612 -pedantic Issue all warnings demanded by strict ANSI C\n\
1613 -traditional Follow K&R pre-processor behaviour\n\
1614 -trigraphs Support ANSI C trigraphs\n\
1615 -lang-c Assume that the input sources are in C\n\
1616 -lang-c89 Assume that the input sources are in C89\n\
1617 -lang-c++ Assume that the input sources are in C++\n\
1618 -lang-objc Assume that the input sources are in ObjectiveC\n\
1619 -lang-objc++ Assume that the input sources are in ObjectiveC++\n\
1620 -lang-asm Assume that the input sources are in assembler\n\
1621 -lang-fortran Assume that the input sources are in Fortran\n\
1622 -lang-chill Assume that the input sources are in Chill\n\
1623 -std=<std name> Specify the conformance standard; one of:\n\
1624 gnu89, gnu99, c89, c99, iso9899:1990,\n\
1625 iso9899:199409, iso9899:1999\n\
1626 -+ Allow parsing of C++ style features\n\
1627 -w Inhibit warning messages\n\
1628 -Wtrigraphs Warn if trigraphs are encountered\n\
1629 -Wno-trigraphs Do not warn about trigraphs\n\
1630 -Wcomment{s} Warn if one comment starts inside another\n\
1631 -Wno-comment{s} Do not warn about comments\n\
1632 -Wtraditional Warn if a macro argument is/would be turned into\n\
1633 a string if -traditional is specified\n\
1634 -Wno-traditional Do not warn about stringification\n\
1635 -Wundef Warn if an undefined macro is used by #if\n\
1636 -Wno-undef Do not warn about testing undefined macros\n\
1637 -Wimport Warn about the use of the #import directive\n\
1638 -Wno-import Do not warn about the use of #import\n\
1639 -Werror Treat all warnings as errors\n\
1640 -Wno-error Do not treat warnings as errors\n\
1641 -Wall Enable all preprocessor warnings\n\
1642 -M Generate make dependencies\n\
1643 -MM As -M, but ignore system header files\n\
1644 -MD As -M, but put output in a .d file\n\
1645 -MMD As -MD, but ignore system header files\n\
1646 -MG Treat missing header file as generated files\n\
1647 -g Include #define and #undef directives in the output\n\
1648 -D<macro> Define a <macro> with string '1' as its value\n\
1649 -D<macro>=<val> Define a <macro> with <val> as its value\n\
1650 -A<question> (<answer>) Assert the <answer> to <question>\n\
1651 -U<macro> Undefine <macro> \n\
1652 -v Display the version number\n\
1653 -H Print the name of header files as they are used\n\
1654 -C Do not discard comments\n\
1655 -dM Display a list of macro definitions active at end\n\
1656 -dD Preserve macro definitions in output\n\
1657 -dN As -dD except that only the names are preserved\n\
1658 -dI Include #include directives in the output\n\
1659 -P Do not generate #line directives\n\
1660 -$ Do not allow '$' in identifiers\n\
1661 -remap Remap file names when including files.\n\
1662 -h or --help Display this information\n\