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. */
32 /* Predefined symbols, built-in macros, and the default include path. */
34 #ifndef GET_ENV_PATH_LIST
35 #define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0)
38 #ifndef STANDARD_INCLUDE_DIR
39 #define STANDARD_INCLUDE_DIR "/usr/include"
42 /* We let tm.h override the types used here, to handle trivial differences
43 such as the choice of unsigned int or long unsigned int for size_t.
44 When machines start needing nontrivial differences in the size type,
45 it would be best to do something here to figure out automatically
46 from other information what type to use. */
48 /* The string value for __SIZE_TYPE__. */
51 #define SIZE_TYPE "long unsigned int"
54 /* The string value for __PTRDIFF_TYPE__. */
57 #define PTRDIFF_TYPE "long int"
60 /* The string value for __WCHAR_TYPE__. */
63 #define WCHAR_TYPE "int"
66 /* The string value for __USER_LABEL_PREFIX__ */
68 #ifndef USER_LABEL_PREFIX
69 #define USER_LABEL_PREFIX ""
72 /* The string value for __REGISTER_PREFIX__ */
74 #ifndef REGISTER_PREFIX
75 #define REGISTER_PREFIX ""
78 /* Suffix for object files, and known input-file extensions. */
79 static const char * const known_suffixes
[] =
81 ".c", ".C", ".s", ".S", ".m",
82 ".cc", ".cxx", ".cpp", ".cp", ".c++",
88 # define OBJECT_SUFFIX ".obj"
90 # define OBJECT_SUFFIX ".o"
95 /* This is the default list of directories to search for include files.
96 It may be overridden by the various -I and -ixxx options.
98 #include "file" looks in the same directory as the current file,
100 #include <file> just looks in this list.
102 All these directories are treated as `system' include directories
103 (they are not subject to pedantic warnings in some cases). */
105 struct default_include
107 const char *fname
; /* The name of the directory. */
108 const char *component
; /* The component containing the directory
109 (see update_path in prefix.c) */
110 int cplusplus
; /* Only look here if we're compiling C++. */
111 int cxx_aware
; /* Includes in this directory don't need to
112 be wrapped in extern "C" when compiling
116 static const struct default_include 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 we have designated initializers (GCC >2.7, or C99) this table
208 can be initialized, constant data. Otherwise, it has to be filled
211 #if (GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)
212 #define init_IStable() /* nothing */
213 #define ISTABLE const unsigned char _cpp_IStable[256] = {
215 #define s(p, v) [p] = v,
217 #define ISTABLE unsigned char _cpp_IStable[256] = { 0 }; \
218 static void init_IStable PARAMS ((void)) { \
219 unsigned char *x = _cpp_IStable;
221 #define s(p, v) x[p] = v;
224 #define A(x) s(x, ISidnum|ISidstart)
225 #define N(x) s(x, ISidnum|ISnumstart)
226 #define H(x) s(x, IShspace|ISspace)
227 #define S(x) s(x, ISspace)
232 A('a') A('b') A('c') A('d') A('e') A('f') A('g') A('h') A('i')
233 A('j') A('k') A('l') A('m') A('n') A('o') A('p') A('q') A('r')
234 A('s') A('t') A('u') A('v') A('w') A('x') A('y') A('z')
236 A('A') A('B') A('C') A('D') A('E') A('F') A('G') A('H') A('I')
237 A('J') A('K') A('L') A('M') A('N') A('O') A('P') A('Q') A('R')
238 A('S') A('T') A('U') A('V') A('W') A('X') A('Y') A('Z')
240 N('1') N('2') N('3') N('4') N('5') N('6') N('7') N('8') N('9') N('0')
242 H(' ') H('\t') H('\v') H('\f')
255 /* Given a colon-separated list of file names PATH,
256 add all the names to the search path for include files. */
259 path_include (pfile
, pend
, list
, path
)
261 struct cpp_pending
*pend
;
271 /* Find the end of this name. */
273 while (*q
!= 0 && *q
!= PATH_SEPARATOR
) q
++;
276 /* An empty name in the path stands for the current directory. */
277 name
= (char *) xmalloc (2);
283 /* Otherwise use the directory that is named. */
284 name
= (char *) xmalloc (q
- p
+ 1);
285 memcpy (name
, p
, q
- p
);
289 append_include_chain (pfile
, pend
, name
, path
, 0);
291 /* Advance past this name. */
299 /* Find the base name of a (partial) pathname FNAME.
300 Returns a pointer into the string passed in.
301 Accepts Unix (/-separated) paths on all systems,
302 DOS and VMS paths on those systems. */
307 char *s
= (char *)fname
;
309 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
310 if (ISALPHA (s
[0]) && s
[1] == ':') s
+= 2;
311 if ((p
= rindex (s
, '\\'))) s
= p
+ 1;
313 if ((p
= rindex (s
, ':'))) s
= p
+ 1; /* Skip device. */
314 if ((p
= rindex (s
, ']'))) s
= p
+ 1; /* Skip directory. */
315 if ((p
= rindex (s
, '>'))) s
= p
+ 1; /* Skip alternate (int'n'l) dir. */
317 if ((p
= rindex (s
, '/'))) s
= p
+ 1;
322 /* Append DIR to include path PATH. DIR must be permanently allocated
325 append_include_chain (pfile
, pend
, dir
, path
, cxx_aware
)
327 struct cpp_pending
*pend
;
332 struct file_name_list
*new;
336 simplify_pathname (dir
);
339 /* Dirs that don't exist are silently ignored. */
341 cpp_notice_from_errno (pfile
, dir
);
342 else if (CPP_OPTIONS (pfile
)->verbose
)
343 fprintf (stderr
, _("ignoring nonexistent directory `%s'\n"), dir
);
347 if (!S_ISDIR (st
.st_mode
))
349 cpp_notice (pfile
, "%s: Not a directory", dir
);
354 if (len
> pfile
->max_include_len
)
355 pfile
->max_include_len
= len
;
357 new = (struct file_name_list
*)xmalloc (sizeof (struct file_name_list
));
360 new->ino
= st
.st_ino
;
361 new->dev
= st
.st_dev
;
363 new->sysp
= cxx_aware
? 1 : 2;
366 new->name_map
= NULL
;
372 case QUOTE
: APPEND (pend
, quote
, new); break;
373 case BRACKET
: APPEND (pend
, brack
, new); break;
374 case SYSTEM
: APPEND (pend
, systm
, new); break;
375 case AFTER
: APPEND (pend
, after
, new); break;
380 /* Write out a #define command for the special named MACRO_NAME
381 to PFILE's token_buffer. */
384 dump_special_to_buffer (pfile
, macro_name
)
386 const char *macro_name
;
388 static const char define_directive
[] = "#define ";
389 int macro_name_length
= strlen (macro_name
);
390 output_line_command (pfile
, same_file
);
391 CPP_RESERVE (pfile
, sizeof(define_directive
) + macro_name_length
);
392 CPP_PUTS_Q (pfile
, define_directive
, sizeof(define_directive
)-1);
393 CPP_PUTS_Q (pfile
, macro_name
, macro_name_length
);
394 CPP_PUTC_Q (pfile
, ' ');
395 cpp_expand_to_buffer (pfile
, macro_name
, macro_name_length
);
396 CPP_PUTC (pfile
, '\n');
399 /* Initialize a cpp_options structure. */
401 cpp_options_init (opts
)
404 bzero ((char *) opts
, sizeof (struct cpp_options
));
406 opts
->dollars_in_ident
= 1;
407 opts
->cplusplus_comments
= 1;
408 opts
->warn_import
= 1;
409 opts
->discard_comments
= 1;
412 (struct cpp_pending
*) xcalloc (1, sizeof (struct cpp_pending
));
415 /* Initialize a cpp_reader structure. */
417 cpp_reader_init (pfile
)
420 bzero ((char *) pfile
, sizeof (cpp_reader
));
422 pfile
->token_buffer_size
= 200;
423 pfile
->token_buffer
= (U_CHAR
*) xmalloc (pfile
->token_buffer_size
);
424 CPP_SET_WRITTEN (pfile
, 0);
426 pfile
->hashtab
= (HASHNODE
**) xcalloc (HASHSIZE
, sizeof (HASHNODE
*));
429 /* Free resources used by PFILE.
430 This is the cpp_reader 'finalizer' or 'destructor' (in C++ terminology). */
436 while (CPP_BUFFER (pfile
) != CPP_NULL_BUFFER (pfile
))
437 cpp_pop_buffer (pfile
);
439 if (pfile
->token_buffer
)
441 free (pfile
->token_buffer
);
442 pfile
->token_buffer
= NULL
;
445 if (pfile
->deps_buffer
)
447 free (pfile
->deps_buffer
);
448 pfile
->deps_buffer
= NULL
;
449 pfile
->deps_allocated_size
= 0;
452 if (pfile
->input_buffer
)
454 free (pfile
->input_buffer
);
455 free (pfile
->input_speccase
);
456 pfile
->input_buffer
= pfile
->input_speccase
= NULL
;
457 pfile
->input_buffer_len
= 0;
460 while (pfile
->if_stack
)
462 IF_STACK_FRAME
*temp
= pfile
->if_stack
;
463 pfile
->if_stack
= temp
->next
;
467 for (i
= ALL_INCLUDE_HASHSIZE
; --i
>= 0; )
469 struct include_hash
*imp
= pfile
->all_include_files
[i
];
472 struct include_hash
*next
= imp
->next
;
474 /* This gets freed elsewhere - I think. */
480 pfile
->all_include_files
[i
] = 0;
483 for (i
= HASHSIZE
; --i
>= 0;)
485 while (pfile
->hashtab
[i
])
486 delete_macro (pfile
->hashtab
[i
]);
488 free (pfile
->hashtab
);
492 /* This structure defines one built-in macro. A node of type TYPE will
493 be entered in the macro hash table under the name NAME, with value
494 VALUE (if any). FLAGS tweaks the behavior a little:
495 DUMP write debug info for this macro
496 STDC define only if not -traditional
497 ULP value is the global user_label_prefix (which can't be
498 put directly into the table).
506 unsigned short flags
;
512 static const struct builtin builtin_array
[] =
514 { "__TIME__", 0, T_TIME
, DUMP
},
515 { "__DATE__", 0, T_DATE
, DUMP
},
516 { "__FILE__", 0, T_FILE
, 0 },
517 { "__BASE_FILE__", 0, T_BASE_FILE
, 0 },
518 { "__LINE__", 0, T_SPECLINE
, 0 },
519 { "__INCLUDE_LEVEL__", 0, T_INCLUDE_LEVEL
, 0 },
520 { "__VERSION__", 0, T_VERSION
, DUMP
},
521 { "__STDC__", 0, T_STDC
, DUMP
|STDC
},
523 { "__USER_LABEL_PREFIX__", 0, T_CONST
, ULP
},
524 { "__REGISTER_PREFIX__", REGISTER_PREFIX
, T_CONST
, 0 },
525 { "__HAVE_BUILTIN_SETJMP__", "1", T_CONST
, 0 },
526 #ifndef NO_BUILTIN_SIZE_TYPE
527 { "__SIZE_TYPE__", SIZE_TYPE
, T_CONST
, DUMP
},
529 #ifndef NO_BUILTIN_PTRDIFF_TYPE
530 { "__PTRDIFF_TYPE__", PTRDIFF_TYPE
, T_CONST
, DUMP
},
532 #ifndef NO_BUILTIN_WCHAR_TYPE
533 { "__WCHAR_TYPE__", WCHAR_TYPE
, T_CONST
, DUMP
},
538 /* Subroutine of cpp_start_read; reads the builtins table above and
539 enters the macros into the hash table. */
542 initialize_builtins (pfile
)
546 const struct builtin
*b
;
548 for(b
= builtin_array
; b
->name
; b
++)
550 if ((b
->flags
& STDC
) && CPP_TRADITIONAL (pfile
))
553 val
= (b
->flags
& ULP
) ? user_label_prefix
: b
->value
;
554 len
= strlen (b
->name
);
556 cpp_install (pfile
, b
->name
, len
, b
->type
, val
);
557 if ((b
->flags
& DUMP
) && CPP_OPTIONS (pfile
)->debug_output
)
558 dump_special_to_buffer (pfile
, b
->name
);
566 /* Another subroutine of cpp_start_read. This one sets up to do
567 dependency-file output. */
569 initialize_dependency_output (pfile
)
572 cpp_options
*opts
= CPP_OPTIONS (pfile
);
573 char *spec
, *s
, *output_file
;
575 /* Either of two environment variables can specify output of deps.
576 Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET",
577 where OUTPUT_FILE is the file to write deps info to
578 and DEPS_TARGET is the target to mention in the deps. */
580 if (opts
->print_deps
== 0)
582 spec
= getenv ("DEPENDENCIES_OUTPUT");
584 opts
->print_deps
= 1;
587 spec
= getenv ("SUNPRO_DEPENDENCIES");
589 opts
->print_deps
= 2;
594 /* Find the space before the DEPS_TARGET, if there is one. */
595 s
= strchr (spec
, ' ');
598 opts
->deps_target
= s
+ 1;
599 output_file
= (char *) xmalloc (s
- spec
+ 1);
600 memcpy (output_file
, spec
, s
- spec
);
601 output_file
[s
- spec
] = 0;
605 opts
->deps_target
= 0;
609 opts
->deps_file
= output_file
;
610 opts
->print_deps_append
= 1;
613 /* Print the expected object file name as the target of this Make-rule. */
614 pfile
->deps_allocated_size
= 200;
615 pfile
->deps_buffer
= (char *) xmalloc (pfile
->deps_allocated_size
);
616 pfile
->deps_buffer
[0] = 0;
617 pfile
->deps_size
= 0;
618 pfile
->deps_column
= 0;
620 if (opts
->deps_target
)
621 deps_output (pfile
, opts
->deps_target
, ':');
622 else if (*opts
->in_fname
== 0)
623 deps_output (pfile
, "-", ':');
629 /* Discard all directory prefixes from filename. */
630 q
= base_name (opts
->in_fname
);
632 /* Copy remainder to mungable area. */
634 p
= (char *) alloca (len
+ 8);
637 /* Output P, but remove known suffixes. */
639 /* Point to the filename suffix. */
640 r
= strrchr (p
, '.');
642 /* Compare against the known suffixes. */
643 for (x
= 0; known_suffixes
[x
]; x
++)
644 if (strncmp (known_suffixes
[x
], r
, q
- r
) == 0)
646 /* Make q point to the bit we're going to overwrite
647 with an object suffix. */
652 /* Supply our own suffix. */
653 strcpy (q
, OBJECT_SUFFIX
);
655 deps_output (pfile
, p
, ':');
656 deps_output (pfile
, opts
->in_fname
, ' ');
660 /* And another subroutine. This one sets up the standard include path. */
662 initialize_standard_includes (pfile
)
665 cpp_options
*opts
= CPP_OPTIONS (pfile
);
667 const struct default_include
*p
;
668 char *specd_prefix
= opts
->include_prefix
;
670 /* Several environment variables may add to the include search path.
671 CPATH specifies an additional list of directories to be searched
672 as if specified with -I, while C_INCLUDE_PATH, CPLUS_INCLUDE_PATH,
673 etc. specify an additional list of directories to be searched as
674 if specified with -isystem, for the language indicated. */
676 GET_ENV_PATH_LIST (path
, "CPATH");
677 if (path
!= 0 && *path
!= 0)
678 path_include (pfile
, opts
->pending
, path
, BRACKET
);
680 switch ((opts
->objc
<< 1) + opts
->cplusplus
)
683 GET_ENV_PATH_LIST (path
, "C_INCLUDE_PATH");
686 GET_ENV_PATH_LIST (path
, "CPLUS_INCLUDE_PATH");
689 GET_ENV_PATH_LIST (path
, "OBJC_INCLUDE_PATH");
692 GET_ENV_PATH_LIST (path
, "OBJCPLUS_INCLUDE_PATH");
695 if (path
!= 0 && *path
!= 0)
696 path_include (pfile
, opts
->pending
, path
, SYSTEM
);
698 /* Search "translated" versions of GNU directories.
699 These have /usr/local/lib/gcc... replaced by specd_prefix. */
700 if (specd_prefix
!= 0)
702 char *default_prefix
= alloca (sizeof GCC_INCLUDE_DIR
- 7);
703 /* Remove the `include' from /usr/local/lib/gcc.../include.
704 GCC_INCLUDE_DIR will always end in /include. */
705 int default_len
= sizeof GCC_INCLUDE_DIR
- 8;
706 int specd_len
= strlen (specd_prefix
);
708 memcpy (default_prefix
, GCC_INCLUDE_DIR
, default_len
);
709 default_prefix
[default_len
] = '\0';
711 for (p
= include_defaults_array
; p
->fname
; p
++)
713 /* Some standard dirs are only for C++. */
716 && !opts
->no_standard_cplusplus_includes
))
718 /* Does this dir start with the prefix? */
719 if (!strncmp (p
->fname
, default_prefix
, default_len
))
721 /* Yes; change prefix and add to search list. */
722 int flen
= strlen (p
->fname
);
723 int this_len
= specd_len
+ flen
- default_len
;
724 char *str
= (char *) xmalloc (this_len
+ 1);
725 memcpy (str
, specd_prefix
, specd_len
);
726 memcpy (str
+ specd_len
,
727 p
->fname
+ default_len
,
728 flen
- default_len
+ 1);
730 append_include_chain (pfile
, opts
->pending
,
731 str
, SYSTEM
, p
->cxx_aware
);
737 /* Search ordinary names for GNU include directories. */
738 for (p
= include_defaults_array
; p
->fname
; p
++)
740 /* Some standard dirs are only for C++. */
743 && !opts
->no_standard_cplusplus_includes
))
745 /* XXX Potential memory leak! */
746 char *str
= xstrdup (update_path (p
->fname
, p
->component
));
747 append_include_chain (pfile
, opts
->pending
, str
, SYSTEM
,
753 /* This is called after options have been processed.
754 * Check options for consistency, and setup for processing input
755 * from the file named FNAME. (Use standard input if FNAME==NULL.)
756 * Return 1 on success, 0 on failure.
760 cpp_start_read (pfile
, fname
)
764 struct cpp_options
*opts
= CPP_OPTIONS (pfile
);
765 struct pending_option
*p
, *q
;
767 /* -MG doesn't select the form of output and must be specified with one of
768 -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't
769 inhibit compilation. */
770 if (opts
->print_deps_missing_files
771 && (opts
->print_deps
== 0 || !opts
->no_output
))
773 cpp_fatal (pfile
, "-MG must be specified with one of -M or -MM");
777 /* Chill should not be used with -trigraphs. */
778 if (opts
->chill
&& opts
->trigraphs
)
780 cpp_warning (pfile
, "-lang-chill and -trigraphs are mutually exclusive");
784 /* Set this if it hasn't been set already. */
785 if (user_label_prefix
== NULL
)
786 user_label_prefix
= USER_LABEL_PREFIX
;
788 /* Don't bother trying to do macro expansion if we've already done
790 if (opts
->preprocessed
)
791 pfile
->no_macro_expand
++;
793 /* Set up the IStable. This doesn't do anything if we were compiled
794 with a compiler that supports C99 designated initializers. */
797 /* Set up the include search path now. */
798 if (! opts
->no_standard_includes
)
799 initialize_standard_includes (pfile
);
801 merge_include_chains (opts
);
803 /* With -v, print the list of dirs to search. */
806 struct file_name_list
*l
;
807 fprintf (stderr
, _("#include \"...\" search starts here:\n"));
808 for (l
= opts
->quote_include
; l
; l
= l
->next
)
810 if (l
== opts
->bracket_include
)
811 fprintf (stderr
, _("#include <...> search starts here:\n"));
812 fprintf (stderr
, " %s\n", l
->name
);
814 fprintf (stderr
, _("End of search list.\n"));
817 initialize_dependency_output (pfile
);
819 /* Open the main input file. This must be done before -D processing
820 so we have a buffer to stand on. */
821 if (opts
->in_fname
== NULL
|| *opts
->in_fname
== 0)
823 opts
->in_fname
= fname
;
824 if (opts
->in_fname
== NULL
)
828 if (!cpp_read_file (pfile
, fname
))
831 /* -D and friends may produce output, which should be identified
834 CPP_BUFFER (pfile
)->lineno
= 0;
836 /* Install __LINE__, etc. */
837 initialize_builtins (pfile
);
839 /* Do -U's, -D's and -A's in the order they were seen. */
840 p
= opts
->pending
->define_head
;
844 cpp_undef (pfile
, p
->arg
);
846 cpp_define (pfile
, p
->arg
);
853 p
= opts
->pending
->assert_head
;
857 cpp_unassert (pfile
, p
->arg
);
859 cpp_assert (pfile
, p
->arg
);
866 opts
->done_initializing
= 1;
867 CPP_BUFFER (pfile
)->lineno
= 1;
869 if (opts
->preprocessed
)
870 /* If we've already processed this code, we want to trust the #line
871 directives in the input. But we still need to update our line
872 counter accordingly. */
873 pfile
->lineno
= CPP_BUFFER (pfile
)->lineno
;
875 output_line_command (pfile
, same_file
);
876 pfile
->only_seen_white
= 2;
878 /* The -imacros files can be scanned now, but the -include files
879 have to be pushed onto the include stack and processed later,
880 in the main loop calling cpp_get_token. */
883 p
= opts
->pending
->imacros_head
;
886 if (cpp_read_file (pfile
, p
->arg
))
887 cpp_scan_buffer (pfile
);
895 p
= opts
->pending
->include_head
;
898 if (cpp_read_file (pfile
, p
->arg
))
899 output_line_command (pfile
, enter_file
);
906 free (opts
->pending
);
907 opts
->pending
= NULL
;
912 /* This is called at the end of preprocessing. It pops the
913 last buffer and writes dependency output. It should also
914 clear macro definitions, such that you could call cpp_start_read
915 with a new filename to restart processing. */
920 struct cpp_options
*opts
= CPP_OPTIONS (pfile
);
922 if (CPP_PREV_BUFFER (CPP_BUFFER (pfile
)) != CPP_NULL_BUFFER (pfile
))
923 cpp_ice (pfile
, "buffers still stacked in cpp_finish");
924 cpp_pop_buffer (pfile
);
926 if (opts
->print_deps
)
928 /* Stream on which to print the dependency information. */
929 FILE *deps_stream
= 0;
931 /* Don't actually write the deps file if compilation has failed. */
932 if (pfile
->errors
== 0)
934 const char *deps_mode
= opts
->print_deps_append
? "a" : "w";
935 if (opts
->deps_file
== 0)
936 deps_stream
= stdout
;
937 else if ((deps_stream
= fopen (opts
->deps_file
, deps_mode
)) == 0)
938 cpp_notice_from_errno (pfile
, opts
->deps_file
);
942 fputs (pfile
->deps_buffer
, deps_stream
);
943 putc ('\n', deps_stream
);
946 if (ferror (deps_stream
) || fclose (deps_stream
) != 0)
947 cpp_fatal (pfile
, "I/O error on output");
953 if (opts
->dump_macros
== dump_only
)
957 for (i
= HASHSIZE
; --i
>= 0;)
959 for (h
= pfile
->hashtab
[i
]; h
; h
= h
->next
)
960 if (h
->type
== T_MACRO
)
962 dump_definition (pfile
, h
->name
, h
->length
, h
->value
.defn
);
963 CPP_PUTC (pfile
, '\n');
970 new_pending_define (opts
, text
)
971 struct cpp_options
*opts
;
974 struct pending_option
*o
= (struct pending_option
*)
975 xmalloc (sizeof (struct pending_option
));
977 o
->arg
= (char *) text
;
980 APPEND (opts
->pending
, define
, o
);
983 /* Handle one command-line option in (argc, argv).
984 Can be called multiple times, to handle multiple sets of options.
985 Returns number of strings consumed. */
988 cpp_handle_option (pfile
, argc
, argv
)
993 struct cpp_options
*opts
= CPP_OPTIONS (pfile
);
996 if (argv
[i
][0] != '-')
998 if (opts
->out_fname
!= NULL
)
1001 cpp_fatal (pfile
, "Too many arguments");
1003 else if (opts
->in_fname
!= NULL
)
1004 opts
->out_fname
= argv
[i
];
1006 opts
->in_fname
= argv
[i
];
1012 if (!strcmp (argv
[i
], "-fleading-underscore"))
1013 user_label_prefix
= "_";
1014 else if (!strcmp (argv
[i
], "-fno-leading-underscore"))
1015 user_label_prefix
= "";
1016 else if (!strcmp (argv
[i
], "-fpreprocessed"))
1017 opts
->preprocessed
= 1;
1018 else if (!strcmp (argv
[i
], "-fno-preprocessed"))
1019 opts
->preprocessed
= 0;
1026 case 'I': /* Add directory to path for includes. */
1027 if (!strcmp (argv
[i
] + 2, "-"))
1030 Use the preceding -I directories for #include "..."
1031 but not #include <...>.
1032 Don't search the directory of the present file
1033 for #include "...". (Note that -I. -I- is not the same as
1034 the default setup; -I. uses the compiler's working dir.) */
1035 if (! opts
->ignore_srcdir
)
1037 opts
->ignore_srcdir
= 1;
1038 opts
->pending
->quote_head
= opts
->pending
->brack_head
;
1039 opts
->pending
->quote_tail
= opts
->pending
->brack_tail
;
1040 opts
->pending
->brack_head
= 0;
1041 opts
->pending
->brack_tail
= 0;
1045 cpp_fatal (pfile
, "-I- specified twice");
1052 if (argv
[i
][2] != 0)
1053 fname
= argv
[i
] + 2;
1054 else if (i
+ 1 == argc
)
1055 goto missing_dirname
;
1058 append_include_chain (pfile
, opts
->pending
,
1059 xstrdup (fname
), BRACKET
, 0);
1064 /* Add directory to beginning of system include path, as a system
1065 include directory. */
1066 if (!strcmp (argv
[i
], "-isystem"))
1069 goto missing_filename
;
1070 append_include_chain (pfile
, opts
->pending
,
1071 xstrdup (argv
[++i
]), SYSTEM
, 0);
1073 else if (!strcmp (argv
[i
], "-include"))
1076 goto missing_filename
;
1079 struct pending_option
*o
= (struct pending_option
*)
1080 xmalloc (sizeof (struct pending_option
));
1083 /* This list has to be built in reverse order so that
1084 when cpp_start_read pushes all the -include files onto
1085 the buffer stack, they will be scanned in forward order. */
1086 o
->next
= opts
->pending
->include_head
;
1087 opts
->pending
->include_head
= o
;
1090 else if (!strcmp (argv
[i
], "-imacros"))
1093 goto missing_filename
;
1096 struct pending_option
*o
= (struct pending_option
*)
1097 xmalloc (sizeof (struct pending_option
));
1101 APPEND (opts
->pending
, imacros
, o
);
1104 /* Add directory to end of path for includes,
1105 with the default prefix at the front of its name. */
1106 else if (!strcmp (argv
[i
], "-iwithprefix"))
1111 goto missing_dirname
;
1113 len
= strlen (argv
[i
]);
1115 if (opts
->include_prefix
!= 0)
1117 fname
= xmalloc (opts
->include_prefix_len
+ len
+ 1);
1118 memcpy (fname
, opts
->include_prefix
, opts
->include_prefix_len
);
1119 memcpy (fname
+ opts
->include_prefix_len
, argv
[i
], len
+ 1);
1123 fname
= xmalloc (sizeof GCC_INCLUDE_DIR
- 8 + len
);
1124 memcpy (fname
, GCC_INCLUDE_DIR
, sizeof GCC_INCLUDE_DIR
- 9);
1125 memcpy (fname
+ sizeof GCC_INCLUDE_DIR
- 9, argv
[i
], len
+ 1);
1128 append_include_chain (pfile
, opts
->pending
, fname
, SYSTEM
, 0);
1130 /* Add directory to main path for includes,
1131 with the default prefix at the front of its name. */
1132 else if (!strcmp (argv
[i
], "-iwithprefixbefore"))
1137 goto missing_dirname
;
1139 len
= strlen (argv
[i
]);
1141 if (opts
->include_prefix
!= 0)
1143 fname
= xmalloc (opts
->include_prefix_len
+ len
+ 1);
1144 memcpy (fname
, opts
->include_prefix
, opts
->include_prefix_len
);
1145 memcpy (fname
+ opts
->include_prefix_len
, argv
[i
], len
+ 1);
1149 fname
= xmalloc (sizeof GCC_INCLUDE_DIR
- 8 + len
);
1150 memcpy (fname
, GCC_INCLUDE_DIR
, sizeof GCC_INCLUDE_DIR
- 9);
1151 memcpy (fname
+ sizeof GCC_INCLUDE_DIR
- 9, argv
[i
], len
+ 1);
1154 append_include_chain (pfile
, opts
->pending
, fname
, BRACKET
, 0);
1156 /* Add directory to end of path for includes. */
1157 else if (!strcmp (argv
[i
], "-idirafter"))
1160 goto missing_dirname
;
1161 append_include_chain (pfile
, opts
->pending
,
1162 xstrdup (argv
[++i
]), AFTER
, 0);
1164 else if (!strcmp (argv
[i
], "-iprefix"))
1167 goto missing_filename
;
1170 opts
->include_prefix
= argv
[++i
];
1171 opts
->include_prefix_len
= strlen (argv
[i
]);
1177 if (opts
->out_fname
!= NULL
)
1179 cpp_fatal (pfile
, "Output filename specified twice");
1183 goto missing_filename
;
1184 opts
->out_fname
= argv
[++i
];
1185 if (!strcmp (opts
->out_fname
, "-"))
1186 opts
->out_fname
= "";
1190 if (!strcmp (argv
[i
], "-pedantic"))
1192 else if (!strcmp (argv
[i
], "-pedantic-errors"))
1195 opts
->pedantic_errors
= 1;
1200 if (!strcmp (argv
[i
], "-traditional"))
1202 opts
->traditional
= 1;
1203 opts
->cplusplus_comments
= 0;
1204 opts
->trigraphs
= 0;
1205 opts
->warn_trigraphs
= 0;
1207 else if (!strcmp (argv
[i
], "-trigraphs"))
1208 opts
->trigraphs
= 1;
1212 if (! strcmp (argv
[i
], "-lang-c"))
1213 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1, opts
->c89
= 0,
1214 opts
->c99
= 1, opts
->objc
= 0;
1215 if (! strcmp (argv
[i
], "-lang-c89"))
1217 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 0;
1218 opts
->c89
= 1, opts
->c99
= 0, opts
->objc
= 0;
1219 opts
->trigraphs
= 1;
1220 new_pending_define (opts
, "__STRICT_ANSI__");
1222 if (! strcmp (argv
[i
], "-lang-c++"))
1223 opts
->cplusplus
= 1, opts
->cplusplus_comments
= 1, opts
->c89
= 0,
1224 opts
->c99
= 0, opts
->objc
= 0;
1225 if (! strcmp (argv
[i
], "-lang-objc"))
1226 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1, opts
->c89
= 0,
1227 opts
->c99
= 0, opts
->objc
= 1;
1228 if (! strcmp (argv
[i
], "-lang-objc++"))
1229 opts
->cplusplus
= 1, opts
->cplusplus_comments
= 1, opts
->c89
= 0,
1230 opts
->c99
= 0, opts
->objc
= 1;
1231 if (! strcmp (argv
[i
], "-lang-asm"))
1233 if (! strcmp (argv
[i
], "-lang-fortran"))
1234 opts
->lang_fortran
= 1, opts
->cplusplus_comments
= 0;
1235 if (! strcmp (argv
[i
], "-lang-chill"))
1236 opts
->objc
= 0, opts
->cplusplus
= 0, opts
->chill
= 1,
1237 opts
->traditional
= 1;
1241 opts
->cplusplus
= 1, opts
->cplusplus_comments
= 1;
1245 if (!strcmp (argv
[i
], "-std=gnu89"))
1247 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1;
1248 opts
->c89
= 1, opts
->c99
= 0, opts
->objc
= 0;
1250 else if (!strcmp (argv
[i
], "-std=gnu9x")
1251 || !strcmp (argv
[i
], "-std=gnu99"))
1253 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1;
1254 opts
->c89
= 0, opts
->c99
= 1, opts
->objc
= 0;
1255 new_pending_define (opts
, "__STDC_VERSION__=199901L");
1257 else if (!strcmp (argv
[i
], "-std=iso9899:1990")
1258 || !strcmp (argv
[i
], "-std=c89"))
1260 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 0;
1261 opts
->c89
= 1, opts
->c99
= 0, opts
->objc
= 0;
1262 opts
->trigraphs
= 1;
1263 new_pending_define (opts
, "__STRICT_ANSI__");
1265 else if (!strcmp (argv
[i
], "-std=iso9899:199409"))
1267 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 0;
1268 opts
->c89
= 1, opts
->c99
= 0, opts
->objc
= 0;
1269 opts
->trigraphs
= 1;
1270 new_pending_define (opts
, "__STRICT_ANSI__");
1271 new_pending_define (opts
, "__STDC_VERSION__=199409L");
1273 else if (!strcmp (argv
[i
], "-std=iso9899:199x")
1274 || !strcmp (argv
[i
], "-std=iso9899:1999")
1275 || !strcmp (argv
[i
], "-std=c9x")
1276 || !strcmp (argv
[i
], "-std=c99"))
1278 opts
->cplusplus
= 0, opts
->cplusplus_comments
= 1;
1279 opts
->c89
= 0, opts
->c99
= 1, opts
->objc
= 0;
1280 opts
->trigraphs
= 1;
1281 new_pending_define (opts
, "__STRICT_ANSI__");
1282 new_pending_define (opts
, "__STDC_VERSION__=199901L");
1287 opts
->inhibit_warnings
= 1;
1291 if (!strcmp (argv
[i
], "-Wtrigraphs"))
1292 opts
->warn_trigraphs
= 1;
1293 else if (!strcmp (argv
[i
], "-Wno-trigraphs"))
1294 opts
->warn_trigraphs
= 0;
1295 else if (!strcmp (argv
[i
], "-Wcomment"))
1296 opts
->warn_comments
= 1;
1297 else if (!strcmp (argv
[i
], "-Wno-comment"))
1298 opts
->warn_comments
= 0;
1299 else if (!strcmp (argv
[i
], "-Wcomments"))
1300 opts
->warn_comments
= 1;
1301 else if (!strcmp (argv
[i
], "-Wno-comments"))
1302 opts
->warn_comments
= 0;
1303 else if (!strcmp (argv
[i
], "-Wtraditional"))
1304 opts
->warn_stringify
= 1;
1305 else if (!strcmp (argv
[i
], "-Wno-traditional"))
1306 opts
->warn_stringify
= 0;
1307 else if (!strcmp (argv
[i
], "-Wundef"))
1308 opts
->warn_undef
= 1;
1309 else if (!strcmp (argv
[i
], "-Wno-undef"))
1310 opts
->warn_undef
= 0;
1311 else if (!strcmp (argv
[i
], "-Wimport"))
1312 opts
->warn_import
= 1;
1313 else if (!strcmp (argv
[i
], "-Wno-import"))
1314 opts
->warn_import
= 0;
1315 else if (!strcmp (argv
[i
], "-Werror"))
1316 opts
->warnings_are_errors
= 1;
1317 else if (!strcmp (argv
[i
], "-Wno-error"))
1318 opts
->warnings_are_errors
= 0;
1319 else if (!strcmp (argv
[i
], "-Wall"))
1321 opts
->warn_trigraphs
= 1;
1322 opts
->warn_comments
= 1;
1327 /* The style of the choices here is a bit mixed.
1328 The chosen scheme is a hybrid of keeping all options in one string
1329 and specifying each option in a separate argument:
1330 -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
1331 -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
1332 -M[M][G][D file]. This is awkward to handle in specs, and is not
1334 /* ??? -MG must be specified in addition to one of -M or -MM.
1335 This can be relaxed in the future without breaking anything.
1336 The converse isn't true. */
1338 /* -MG isn't valid with -MD or -MMD. This is checked for later. */
1339 if (!strcmp (argv
[i
], "-MG"))
1341 opts
->print_deps_missing_files
= 1;
1344 if (!strcmp (argv
[i
], "-M"))
1345 opts
->print_deps
= 2;
1346 else if (!strcmp (argv
[i
], "-MM"))
1347 opts
->print_deps
= 1;
1348 else if (!strcmp (argv
[i
], "-MD"))
1349 opts
->print_deps
= 2;
1350 else if (!strcmp (argv
[i
], "-MMD"))
1351 opts
->print_deps
= 1;
1352 /* For -MD and -MMD options, write deps on file named by next arg. */
1353 if (!strcmp (argv
[i
], "-MD") || !strcmp (argv
[i
], "-MMD"))
1356 goto missing_filename
;
1357 opts
->deps_file
= argv
[++i
];
1361 /* For -M and -MM, write deps on standard output
1362 and suppress the usual output. */
1363 opts
->no_output
= 1;
1369 char *p
= argv
[i
] + 2;
1371 while ((c
= *p
++) != 0)
1373 /* Arg to -d specifies what parts of macros to dump */
1377 opts
->dump_macros
= dump_only
;
1378 opts
->no_output
= 1;
1381 opts
->dump_macros
= dump_names
;
1384 opts
->dump_macros
= dump_definitions
;
1387 opts
->dump_includes
= 1;
1395 if (argv
[i
][2] == '3')
1396 opts
->debug_output
= 1;
1400 if (!strcmp (argv
[i
], "--help"))
1402 else if (!strcmp (argv
[i
], "--version"))
1403 fprintf (stderr
, _("GNU CPP version %s (cpplib)\n"), version_string
);
1408 fprintf (stderr
, _("GNU CPP version %s (cpplib)\n"), version_string
);
1409 #ifdef TARGET_VERSION
1412 fputc ('\n', stderr
);
1417 opts
->print_include_names
= 1;
1423 if (argv
[i
][2] != 0)
1425 else if (i
+ 1 == argc
)
1427 cpp_fatal (pfile
, "Macro name missing after -D option");
1432 new_pending_define (opts
, text
);
1440 if (argv
[i
][2] != 0)
1442 else if (i
+ 1 == argc
)
1444 cpp_fatal (pfile
, "Assertion missing after -A option");
1450 if (strcmp (p
, "-"))
1452 struct pending_option
*o
= (struct pending_option
*)
1453 xmalloc (sizeof (struct pending_option
));
1458 APPEND (opts
->pending
, assert, o
);
1462 /* -A- eliminates all predefined macros and assertions.
1463 Let's include also any that were specified earlier
1464 on the command line. That way we can get rid of any
1465 that were passed automatically in from GCC. */
1466 struct pending_option
*o1
, *o2
;
1468 o1
= opts
->pending
->define_head
;
1475 o1
= opts
->pending
->assert_head
;
1482 opts
->pending
->assert_head
= NULL
;
1483 opts
->pending
->assert_tail
= NULL
;
1484 opts
->pending
->define_head
= NULL
;
1485 opts
->pending
->define_tail
= NULL
;
1492 struct pending_option
*o
= (struct pending_option
*)
1493 xmalloc (sizeof (struct pending_option
));
1495 if (argv
[i
][2] != 0)
1496 o
->arg
= argv
[i
] + 2;
1497 else if (i
+ 1 == argc
)
1499 cpp_fatal (pfile
, "Macro name missing after -U option");
1507 APPEND (opts
->pending
, define
, o
);
1512 opts
->discard_comments
= 0;
1515 case 'E': /* -E comes from cc -E; ignore it. */
1519 opts
->no_line_commands
= 1;
1522 case '$': /* Don't include $ in identifiers. */
1523 opts
->dollars_in_ident
= 0;
1527 if (!strcmp (argv
[i
], "-nostdinc"))
1528 /* -nostdinc causes no default include directories.
1529 You must specify all include-file directories with -I. */
1530 opts
->no_standard_includes
= 1;
1531 else if (!strcmp (argv
[i
], "-nostdinc++"))
1532 /* -nostdinc++ causes no default C++-specific include directories. */
1533 opts
->no_standard_cplusplus_includes
= 1;
1537 if (!strcmp (argv
[i
], "-remap"))
1541 case '\0': /* JF handle '-' as file name meaning stdin or stdout */
1542 if (opts
->in_fname
== NULL
)
1543 opts
->in_fname
= "";
1544 else if (opts
->out_fname
== NULL
)
1545 opts
->out_fname
= "";
1547 return i
; /* error */
1557 cpp_fatal (pfile
, "Filename missing after `%s' option", argv
[i
]);
1560 cpp_fatal (pfile
, "Directory name missing after `%s' option", argv
[i
]);
1564 /* Handle command-line options in (argc, argv).
1565 Can be called multiple times, to handle multiple sets of options.
1566 Returns if an unrecognized option is seen.
1567 Returns number of strings consumed. */
1570 cpp_handle_options (pfile
, argc
, argv
)
1576 int strings_processed
;
1577 for (i
= 0; i
< argc
; i
+= strings_processed
)
1579 strings_processed
= cpp_handle_option (pfile
, argc
- i
, argv
+ i
);
1580 if (strings_processed
== 0)
1589 fprintf (stderr
, _("Usage: %s [switches] input output\n"), progname
);
1592 -include <file> Include the contents of <file> before other files\n\
1593 -imacros <file> Accept definition of macros in <file>\n\
1594 -iprefix <path> Specify <path> as a prefix for next two options\n\
1595 -iwithprefix <dir> Add <dir> to the end of the system include path\n\
1596 -iwithprefixbefore <dir> Add <dir> to the end of the main include path\n\
1597 -isystem <dir> Add <dir> to the start of the system include path\n\
1598 -idirafter <dir> Add <dir> to the end of the system include path\n\
1599 -I <dir> Add <dir> to the end of the main include path\n\
1600 -nostdinc Do not search system include directories\n\
1601 (dirs specified with -isystem will still be used)\n\
1602 -nostdinc++ Do not search system include directories for C++\n\
1603 -o <file> Put output into <file>\n\
1604 -pedantic Issue all warnings demanded by strict ANSI C\n\
1605 -traditional Follow K&R pre-processor behaviour\n\
1606 -trigraphs Support ANSI C trigraphs\n\
1607 -lang-c Assume that the input sources are in C\n\
1608 -lang-c89 Assume that the input sources are in C89\n\
1609 -lang-c++ Assume that the input sources are in C++\n\
1610 -lang-objc Assume that the input sources are in ObjectiveC\n\
1611 -lang-objc++ Assume that the input sources are in ObjectiveC++\n\
1612 -lang-asm Assume that the input sources are in assembler\n\
1613 -lang-fortran Assume that the input sources are in Fortran\n\
1614 -lang-chill Assume that the input sources are in Chill\n\
1615 -std=<std name> Specify the conformance standard; one of:\n\
1616 gnu89, gnu99, c89, c99, iso9899:1990,\n\
1617 iso9899:199409, iso9899:1999\n\
1618 -+ Allow parsing of C++ style features\n\
1619 -w Inhibit warning messages\n\
1620 -Wtrigraphs Warn if trigraphs are encountered\n\
1621 -Wno-trigraphs Do not warn about trigraphs\n\
1622 -Wcomment{s} Warn if one comment starts inside another\n\
1623 -Wno-comment{s} Do not warn about comments\n\
1624 -Wtraditional Warn if a macro argument is/would be turned into\n\
1625 a string if -traditional is specified\n\
1626 -Wno-traditional Do not warn about stringification\n\
1627 -Wundef Warn if an undefined macro is used by #if\n\
1628 -Wno-undef Do not warn about testing undefined macros\n\
1629 -Wimport Warn about the use of the #import directive\n\
1630 -Wno-import Do not warn about the use of #import\n\
1631 -Werror Treat all warnings as errors\n\
1632 -Wno-error Do not treat warnings as errors\n\
1633 -Wall Enable all preprocessor warnings\n\
1634 -M Generate make dependencies\n\
1635 -MM As -M, but ignore system header files\n\
1636 -MD As -M, but put output in a .d file\n\
1637 -MMD As -MD, but ignore system header files\n\
1638 -MG Treat missing header file as generated files\n\
1639 -g Include #define and #undef directives in the output\n\
1640 -D<macro> Define a <macro> with string '1' as its value\n\
1641 -D<macro>=<val> Define a <macro> with <val> as its value\n\
1642 -A<question> (<answer>) Assert the <answer> to <question>\n\
1643 -U<macro> Undefine <macro> \n\
1644 -v Display the version number\n\
1645 -H Print the name of header files as they are used\n\
1646 -C Do not discard comments\n\
1647 -dM Display a list of macro definitions active at end\n\
1648 -dD Preserve macro definitions in output\n\
1649 -dN As -dD except that only the names are preserved\n\
1650 -dI Include #include directives in the output\n\
1651 -P Do not generate #line directives\n\
1652 -$ Do not allow '$' in identifiers\n\
1653 -remap Remap file names when including files.\n\
1654 -h or --help Display this information\n\