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 /* This is the default list of directories to search for include files.
80 It may be overridden by the various -I and -ixxx options.
82 #include "file" looks in the same directory as the current file,
84 #include <file> just looks in this list.
86 All these directories are treated as `system' include directories
87 (they are not subject to pedantic warnings in some cases). */
89 struct default_include
91 const char *fname; /* The name of the directory. */
92 const char *component; /* The component containing the directory
93 (see update_path in prefix.c) */
94 int cplusplus; /* Only look here if we're compiling C++. */
95 int cxx_aware; /* Includes in this directory don't need to
96 be wrapped in extern "C" when compiling
100 static const struct default_include include_defaults_array[]
101 #ifdef INCLUDE_DEFAULTS
105 /* Pick up GNU C++ specific include files. */
106 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },
108 /* This is the dir for fixincludes. Put it just before
109 the files that we fix. */
110 { GCC_INCLUDE_DIR, "GCC", 0, 0 },
111 /* For cross-compilation, this dir name is generated
112 automatically in Makefile.in. */
113 { CROSS_INCLUDE_DIR, "GCC", 0, 0 },
114 #ifdef TOOL_INCLUDE_DIR
115 /* This is another place that the target system's headers might be. */
116 { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 },
118 #else /* not CROSS_COMPILE */
119 #ifdef LOCAL_INCLUDE_DIR
120 /* This should be /usr/local/include and should come before
121 the fixincludes-fixed header files. */
122 { LOCAL_INCLUDE_DIR, 0, 0, 1 },
124 #ifdef TOOL_INCLUDE_DIR
125 /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
126 Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */
127 { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 },
129 /* This is the dir for fixincludes. Put it just before
130 the files that we fix. */
131 { GCC_INCLUDE_DIR, "GCC", 0, 0 },
132 /* Some systems have an extra dir of include files. */
133 #ifdef SYSTEM_INCLUDE_DIR
134 { SYSTEM_INCLUDE_DIR, 0, 0, 0 },
136 #ifndef STANDARD_INCLUDE_COMPONENT
137 #define STANDARD_INCLUDE_COMPONENT 0
139 { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 },
140 #endif /* not CROSS_COMPILE */
143 #endif /* no INCLUDE_DEFAULTS */
145 /* Internal structures and prototypes. */
147 /* A `struct pending_option' remembers one -D, -A, -U, -include, or -imacros
148 switch. There are four lists: one for -D and -U, one for -A, one
149 for -include, one for -imacros. `undef' is set for -U, clear for
150 -D, ignored for the others.
151 (Future: add an equivalent of -U for -A) */
152 struct pending_option
154 struct pending_option *next;
160 #define APPEND(pend, list, elt) \
161 do { if (!(pend)->list##_head) (pend)->list##_head = (elt); \
162 else (pend)->list##_tail->next = (elt); \
163 (pend)->list##_tail = (elt); \
166 #define APPEND(pend, list, elt) \
167 do { if (!(pend)->list/**/_head) (pend)->list/**/_head = (elt); \
168 else (pend)->list/**/_tail->next = (elt); \
169 (pend)->list/**/_tail = (elt); \
173 static void print_help PARAMS ((void));
174 static void path_include PARAMS ((cpp_reader *,
175 struct cpp_pending *,
177 static void initialize_builtins PARAMS ((cpp_reader *));
178 static void append_include_chain PARAMS ((cpp_reader *,
179 struct cpp_pending *,
181 static void dump_special_to_buffer PARAMS ((cpp_reader *, const char *));
182 static void initialize_dependency_output PARAMS ((cpp_reader *));
183 static void initialize_standard_includes PARAMS ((cpp_reader *));
184 static void new_pending_define PARAMS ((struct cpp_options *,
187 static int opt_comp PARAMS ((const void *, const void *));
189 static int parse_option PARAMS ((const char *));
190 static int handle_option PARAMS ((cpp_reader *, int, char **));
192 /* Fourth argument to append_include_chain: chain to use */
193 enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
195 /* If we have designated initializers (GCC >2.7, or C99) this table
196 can be initialized, constant data. Otherwise, it has to be filled
199 #if (GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)
200 #define init_IStable() /* nothing */
201 #define ISTABLE const unsigned char _cpp_IStable[256] = {
203 #define s(p, v) [p] = v,
205 #define ISTABLE unsigned char _cpp_IStable[256] = { 0 }; \
206 static void init_IStable PARAMS ((void)) { \
207 unsigned char *x = _cpp_IStable;
209 #define s(p, v) x[p] = v;
212 #define A(x) s(x, ISidnum|ISidstart)
213 #define N(x) s(x, ISidnum|ISnumstart)
214 #define H(x) s(x, IShspace|ISspace)
215 #define S(x) s(x, ISspace)
220 A('a') A('b') A('c') A('d') A('e') A('f') A('g') A('h') A('i')
221 A('j') A('k') A('l') A('m') A('n') A('o') A('p') A('q') A('r')
222 A('s') A('t') A('u') A('v') A('w') A('x') A('y') A('z')
224 A('A') A('B') A('C') A('D') A('E') A('F') A('G') A('H') A('I')
225 A('J') A('K') A('L') A('M') A('N') A('O') A('P') A('Q') A('R')
226 A('S') A('T') A('U') A('V') A('W') A('X') A('Y') A('Z')
228 N('1') N('2') N('3') N('4') N('5') N('6') N('7') N('8') N('9') N('0')
230 H(' ') H('\t') H('\v') H('\f')
243 /* Given a colon-separated list of file names PATH,
244 add all the names to the search path for include files. */
247 path_include (pfile, pend, list, path)
249 struct cpp_pending *pend;
259 /* Find the end of this name. */
261 while (*q != 0 && *q != PATH_SEPARATOR) q++;
264 /* An empty name in the path stands for the current directory. */
265 name = (char *) xmalloc (2);
271 /* Otherwise use the directory that is named. */
272 name = (char *) xmalloc (q - p + 1);
273 memcpy (name, p, q - p);
277 append_include_chain (pfile, pend, name, path, 0);
279 /* Advance past this name. */
287 /* Append DIR to include path PATH. DIR must be permanently allocated
290 append_include_chain (pfile, pend, dir, path, cxx_aware)
292 struct cpp_pending *pend;
297 struct file_name_list *new;
301 _cpp_simplify_pathname (dir);
304 /* Dirs that don't exist are silently ignored. */
306 cpp_notice_from_errno (pfile, dir);
307 else if (CPP_OPTIONS (pfile)->verbose)
308 fprintf (stderr, _("ignoring nonexistent directory `%s'\n"), dir);
312 if (!S_ISDIR (st.st_mode))
314 cpp_notice (pfile, "%s: Not a directory", dir);
319 if (len > pfile->max_include_len)
320 pfile->max_include_len = len;
322 new = (struct file_name_list *)xmalloc (sizeof (struct file_name_list));
325 new->ino = st.st_ino;
326 new->dev = st.st_dev;
328 new->sysp = cxx_aware ? 1 : 2;
331 new->name_map = NULL;
337 case QUOTE: APPEND (pend, quote, new); break;
338 case BRACKET: APPEND (pend, brack, new); break;
339 case SYSTEM: APPEND (pend, systm, new); break;
340 case AFTER: APPEND (pend, after, new); break;
345 /* Write out a #define command for the special named MACRO_NAME
346 to PFILE's token_buffer. */
349 dump_special_to_buffer (pfile, macro_name)
351 const char *macro_name;
353 static const char define_directive[] = "#define ";
354 int macro_name_length = strlen (macro_name);
355 output_line_command (pfile, same_file);
356 CPP_RESERVE (pfile, sizeof(define_directive) + macro_name_length);
357 CPP_PUTS_Q (pfile, define_directive, sizeof(define_directive)-1);
358 CPP_PUTS_Q (pfile, macro_name, macro_name_length);
359 CPP_PUTC_Q (pfile, ' ');
360 cpp_expand_to_buffer (pfile, macro_name, macro_name_length);
361 CPP_PUTC (pfile, '\n');
364 /* Initialize a cpp_options structure. */
366 cpp_options_init (opts)
369 bzero ((char *) opts, sizeof (struct cpp_options));
371 opts->dollars_in_ident = 1;
372 opts->cplusplus_comments = 1;
373 opts->warn_import = 1;
374 opts->discard_comments = 1;
377 (struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending));
380 /* Initialize a cpp_reader structure. */
382 cpp_reader_init (pfile)
385 bzero ((char *) pfile, sizeof (cpp_reader));
387 pfile->token_buffer_size = 200;
388 pfile->token_buffer = (U_CHAR *) xmalloc (pfile->token_buffer_size);
389 CPP_SET_WRITTEN (pfile, 0);
391 pfile->hashtab = (HASHNODE **) xcalloc (HASHSIZE, sizeof (HASHNODE *));
394 /* Free resources used by PFILE.
395 This is the cpp_reader 'finalizer' or 'destructor' (in C++ terminology). */
401 while (CPP_BUFFER (pfile) != NULL)
402 cpp_pop_buffer (pfile);
404 if (pfile->token_buffer)
406 free (pfile->token_buffer);
407 pfile->token_buffer = NULL;
410 if (pfile->input_buffer)
412 free (pfile->input_buffer);
413 free (pfile->input_speccase);
414 pfile->input_buffer = pfile->input_speccase = NULL;
415 pfile->input_buffer_len = 0;
419 deps_free (pfile->deps);
421 while (pfile->if_stack)
423 IF_STACK *temp = pfile->if_stack;
424 pfile->if_stack = temp->next;
428 for (i = ALL_INCLUDE_HASHSIZE; --i >= 0; )
431 for (imp = pfile->all_include_files[i]; imp; imp = next)
434 free ((PTR) imp->name);
435 free ((PTR) imp->nshort);
438 pfile->all_include_files[i] = 0;
441 for (i = HASHSIZE; --i >= 0;)
443 while (pfile->hashtab[i])
444 _cpp_delete_macro (pfile->hashtab[i]);
446 free (pfile->hashtab);
450 /* This structure defines one built-in macro. A node of type TYPE will
451 be entered in the macro hash table under the name NAME, with value
452 VALUE (if any). FLAGS tweaks the behavior a little:
453 DUMP write debug info for this macro
454 STDC define only if not -traditional
455 ULP value is the global user_label_prefix (which can't be
456 put directly into the table).
464 unsigned short flags;
470 static const struct builtin builtin_array[] =
472 { "__TIME__", 0, T_TIME, DUMP },
473 { "__DATE__", 0, T_DATE, DUMP },
474 { "__FILE__", 0, T_FILE, 0 },
475 { "__BASE_FILE__", 0, T_BASE_FILE, 0 },
476 { "__LINE__", 0, T_SPECLINE, 0 },
477 { "__INCLUDE_LEVEL__", 0, T_INCLUDE_LEVEL, 0 },
478 { "__VERSION__", 0, T_VERSION, DUMP },
479 { "__STDC__", 0, T_STDC, DUMP|STDC },
481 { "__USER_LABEL_PREFIX__", 0, T_CONST, ULP },
482 { "__REGISTER_PREFIX__", REGISTER_PREFIX, T_CONST, 0 },
483 { "__HAVE_BUILTIN_SETJMP__", "1", T_CONST, 0 },
484 #ifndef NO_BUILTIN_SIZE_TYPE
485 { "__SIZE_TYPE__", SIZE_TYPE, T_CONST, DUMP },
487 #ifndef NO_BUILTIN_PTRDIFF_TYPE
488 { "__PTRDIFF_TYPE__", PTRDIFF_TYPE, T_CONST, DUMP },
490 #ifndef NO_BUILTIN_WCHAR_TYPE
491 { "__WCHAR_TYPE__", WCHAR_TYPE, T_CONST, DUMP },
496 /* Subroutine of cpp_start_read; reads the builtins table above and
497 enters the macros into the hash table. */
500 initialize_builtins (pfile)
504 const struct builtin *b;
506 for(b = builtin_array; b->name; b++)
508 if ((b->flags & STDC) && CPP_TRADITIONAL (pfile))
511 val = (b->flags & ULP) ? user_label_prefix : b->value;
512 len = strlen (b->name);
514 _cpp_install (pfile, b->name, len, b->type, val);
515 if ((b->flags & DUMP) && CPP_OPTIONS (pfile)->debug_output)
516 dump_special_to_buffer (pfile, b->name);
524 /* Another subroutine of cpp_start_read. This one sets up to do
525 dependency-file output. */
527 initialize_dependency_output (pfile)
530 cpp_options *opts = CPP_OPTIONS (pfile);
531 char *spec, *s, *output_file;
533 /* Either of two environment variables can specify output of deps.
534 Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET",
535 where OUTPUT_FILE is the file to write deps info to
536 and DEPS_TARGET is the target to mention in the deps. */
538 if (opts->print_deps == 0)
540 spec = getenv ("DEPENDENCIES_OUTPUT");
542 opts->print_deps = 1;
545 spec = getenv ("SUNPRO_DEPENDENCIES");
547 opts->print_deps = 2;
552 /* Find the space before the DEPS_TARGET, if there is one. */
553 s = strchr (spec, ' ');
556 opts->deps_target = s + 1;
557 output_file = (char *) xmalloc (s - spec + 1);
558 memcpy (output_file, spec, s - spec);
559 output_file[s - spec] = 0;
563 opts->deps_target = 0;
567 opts->deps_file = output_file;
568 opts->print_deps_append = 1;
571 pfile->deps = deps_init ();
573 /* Print the expected object file name as the target of this Make-rule. */
574 if (opts->deps_target)
575 deps_add_target (pfile->deps, opts->deps_target);
576 else if (*opts->in_fname == 0)
577 deps_add_target (pfile->deps, "-");
579 deps_calc_target (pfile->deps, opts->in_fname);
582 deps_add_dep (pfile->deps, opts->in_fname);
585 /* And another subroutine. This one sets up the standard include path. */
587 initialize_standard_includes (pfile)
590 cpp_options *opts = CPP_OPTIONS (pfile);
592 const struct default_include *p;
593 char *specd_prefix = opts->include_prefix;
595 /* Several environment variables may add to the include search path.
596 CPATH specifies an additional list of directories to be searched
597 as if specified with -I, while C_INCLUDE_PATH, CPLUS_INCLUDE_PATH,
598 etc. specify an additional list of directories to be searched as
599 if specified with -isystem, for the language indicated. */
601 GET_ENV_PATH_LIST (path, "CPATH");
602 if (path != 0 && *path != 0)
603 path_include (pfile, opts->pending, path, BRACKET);
605 switch ((opts->objc << 1) + opts->cplusplus)
608 GET_ENV_PATH_LIST (path, "C_INCLUDE_PATH");
611 GET_ENV_PATH_LIST (path, "CPLUS_INCLUDE_PATH");
614 GET_ENV_PATH_LIST (path, "OBJC_INCLUDE_PATH");
617 GET_ENV_PATH_LIST (path, "OBJCPLUS_INCLUDE_PATH");
620 if (path != 0 && *path != 0)
621 path_include (pfile, opts->pending, path, SYSTEM);
623 /* Search "translated" versions of GNU directories.
624 These have /usr/local/lib/gcc... replaced by specd_prefix. */
625 if (specd_prefix != 0)
627 char *default_prefix = alloca (sizeof GCC_INCLUDE_DIR - 7);
628 /* Remove the `include' from /usr/local/lib/gcc.../include.
629 GCC_INCLUDE_DIR will always end in /include. */
630 int default_len = sizeof GCC_INCLUDE_DIR - 8;
631 int specd_len = strlen (specd_prefix);
633 memcpy (default_prefix, GCC_INCLUDE_DIR, default_len);
634 default_prefix[default_len] = '\0';
636 for (p = include_defaults_array; p->fname; p++)
638 /* Some standard dirs are only for C++. */
641 && !opts->no_standard_cplusplus_includes))
643 /* Does this dir start with the prefix? */
644 if (!strncmp (p->fname, default_prefix, default_len))
646 /* Yes; change prefix and add to search list. */
647 int flen = strlen (p->fname);
648 int this_len = specd_len + flen - default_len;
649 char *str = (char *) xmalloc (this_len + 1);
650 memcpy (str, specd_prefix, specd_len);
651 memcpy (str + specd_len,
652 p->fname + default_len,
653 flen - default_len + 1);
655 append_include_chain (pfile, opts->pending,
656 str, SYSTEM, p->cxx_aware);
662 /* Search ordinary names for GNU include directories. */
663 for (p = include_defaults_array; p->fname; p++)
665 /* Some standard dirs are only for C++. */
668 && !opts->no_standard_cplusplus_includes))
670 /* XXX Potential memory leak! */
671 char *str = xstrdup (update_path (p->fname, p->component));
672 append_include_chain (pfile, opts->pending, str, SYSTEM,
678 /* This is called after options have been processed.
679 * Check options for consistency, and setup for processing input
680 * from the file named FNAME. (Use standard input if FNAME==NULL.)
681 * Return 1 on success, 0 on failure.
685 cpp_start_read (pfile, fname)
689 struct cpp_options *opts = CPP_OPTIONS (pfile);
690 struct pending_option *p, *q;
692 /* -MG doesn't select the form of output and must be specified with one of
693 -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't
694 inhibit compilation. */
695 if (opts->print_deps_missing_files
696 && (opts->print_deps == 0 || !opts->no_output))
698 cpp_fatal (pfile, "-MG must be specified with one of -M or -MM");
702 /* Chill should not be used with -trigraphs. */
703 if (opts->chill && opts->trigraphs)
705 cpp_warning (pfile, "-lang-chill and -trigraphs are mutually exclusive");
709 /* Set this if it hasn't been set already. */
710 if (user_label_prefix == NULL)
711 user_label_prefix = USER_LABEL_PREFIX;
713 /* Don't bother trying to do macro expansion if we've already done
715 if (opts->preprocessed)
716 pfile->no_macro_expand++;
718 /* Set up the IStable. This doesn't do anything if we were compiled
719 with a compiler that supports C99 designated initializers. */
722 /* Set up the include search path now. */
723 if (! opts->no_standard_includes)
724 initialize_standard_includes (pfile);
726 _cpp_merge_include_chains (opts);
728 /* With -v, print the list of dirs to search. */
731 struct file_name_list *l;
732 fprintf (stderr, _("#include \"...\" search starts here:\n"));
733 for (l = opts->quote_include; l; l = l->next)
735 if (l == opts->bracket_include)
736 fprintf (stderr, _("#include <...> search starts here:\n"));
737 fprintf (stderr, " %s\n", l->name);
739 fprintf (stderr, _("End of search list.\n"));
742 initialize_dependency_output (pfile);
744 /* Open the main input file. This must be done before -D processing
745 so we have a buffer to stand on. */
746 if (opts->in_fname == NULL || *opts->in_fname == 0)
748 opts->in_fname = fname;
749 if (opts->in_fname == NULL)
753 if (!cpp_read_file (pfile, fname))
756 /* -D and friends may produce output, which should be identified
759 CPP_BUFFER (pfile)->lineno = 0;
761 /* Install __LINE__, etc. */
762 initialize_builtins (pfile);
764 /* Do -U's, -D's and -A's in the order they were seen. */
765 p = opts->pending->define_head;
769 cpp_undef (pfile, p->arg);
771 cpp_define (pfile, p->arg);
778 p = opts->pending->assert_head;
782 cpp_unassert (pfile, p->arg);
784 cpp_assert (pfile, p->arg);
791 opts->done_initializing = 1;
792 CPP_BUFFER (pfile)->lineno = 1;
794 if (opts->preprocessed)
795 /* If we've already processed this code, we want to trust the #line
796 directives in the input. But we still need to update our line
797 counter accordingly. */
798 pfile->lineno = CPP_BUFFER (pfile)->lineno;
800 output_line_command (pfile, same_file);
801 pfile->only_seen_white = 2;
803 /* The -imacros files can be scanned now, but the -include files
804 have to be pushed onto the include stack and processed later,
805 in the main loop calling cpp_get_token. */
808 p = opts->pending->imacros_head;
811 if (cpp_read_file (pfile, p->arg))
812 cpp_scan_buffer (pfile);
820 p = opts->pending->include_head;
823 if (cpp_read_file (pfile, p->arg))
824 output_line_command (pfile, enter_file);
831 free (opts->pending);
832 opts->pending = NULL;
837 /* This is called at the end of preprocessing. It pops the
838 last buffer and writes dependency output. It should also
839 clear macro definitions, such that you could call cpp_start_read
840 with a new filename to restart processing. */
845 struct cpp_options *opts = CPP_OPTIONS (pfile);
847 if (CPP_PREV_BUFFER (CPP_BUFFER (pfile)) != NULL)
848 cpp_ice (pfile, "buffers still stacked in cpp_finish");
849 cpp_pop_buffer (pfile);
851 /* Don't write the deps file if preprocessing has failed. */
852 if (opts->print_deps && pfile->errors == 0)
854 /* Stream on which to print the dependency information. */
855 FILE *deps_stream = 0;
857 const char *deps_mode = opts->print_deps_append ? "a" : "w";
858 if (opts->deps_file == 0)
859 deps_stream = stdout;
860 else if ((deps_stream = fopen (opts->deps_file, deps_mode)) == 0)
861 cpp_notice_from_errno (pfile, opts->deps_file);
865 deps_write (pfile->deps, deps_stream, 72);
868 if (ferror (deps_stream) || fclose (deps_stream) != 0)
869 cpp_fatal (pfile, "I/O error on output");
874 if (opts->dump_macros == dump_only)
878 for (i = HASHSIZE; --i >= 0;)
880 for (h = pfile->hashtab[i]; h; h = h->next)
881 if (h->type == T_MACRO)
883 _cpp_dump_definition (pfile, h->name, h->length,
885 CPP_PUTC (pfile, '\n');
892 new_pending_define (opts, text)
893 struct cpp_options *opts;
896 struct pending_option *o = (struct pending_option *)
897 xmalloc (sizeof (struct pending_option));
899 o->arg = (char *) text;
902 APPEND (opts->pending, define, o);
907 OPT_stdin_stdout = 0, OPT_dollar, OPT_plus,
908 OPT__help, OPT__version,
909 OPT_A, OPT_C, OPT_D, OPT_H, OPT_I, OPT_M,
910 OPT_MD, OPT_MG, OPT_MM, OPT_MMD,
913 OPT_fleading_underscore, OPT_fno_leading_underscore,
914 OPT_fpreprocessed, OPT_fno_preprocessed,
916 OPT_idirafter, OPT_imacros, OPT_include,
917 OPT_iprefix, OPT_isystem, OPT_iwithprefix, OPT_iwithprefixbefore,
918 OPT_lang_asm, OPT_lang_c, OPT_lang_cplusplus, OPT_lang_c89,
919 OPT_lang_chill, OPT_lang_fortran, OPT_lang_objc, OPT_lang_objcplusplus,
920 OPT_nostdinc, OPT_nostdincplusplus,
922 OPT_pedantic, OPT_pedantic_errors, OPT_remap,
923 OPT_std_c89, OPT_std_c99, OPT_std_c9x, OPT_std_gnu89, OPT_std_gnu99,
924 OPT_std_gnu9x, OPT_std_iso9899_1990, OPT_std_iso9899_199409,
925 OPT_std_iso9899_1999, OPT_std_iso9899_199x,
926 OPT_traditional, OPT_trigraphs,
933 const char *opt_text;
936 enum opt_code opt_code;
939 static const char no_arg[] = N_("Argument missing after `%s' option");
940 static const char no_ass[] = N_("Assertion missing after `%s' option");
941 static const char no_dir[] = N_("Directory name missing after `%s' option");
942 static const char no_fil[] = N_("File name missing after `%s' option");
943 static const char no_mac[] = N_("Macro name missing after `%s' option");
944 static const char no_pth[] = N_("Path name missing after `%s' option");
946 /* This list must be ASCII sorted. Make enum order above match this. */
947 #define DEF_OPT(text, msg, code) {text, msg, sizeof(text) - 1, code}
950 static struct cl_option cl_options[] =
952 static const struct cl_option cl_options[] =
955 DEF_OPT("", 0, OPT_stdin_stdout),
956 DEF_OPT("$", 0, OPT_dollar),
957 DEF_OPT("+", 0, OPT_plus),
958 DEF_OPT("-help", 0, OPT__help),
959 DEF_OPT("-version", 0, OPT__version),
960 DEF_OPT("A", no_ass, OPT_A),
961 DEF_OPT("C", 0, OPT_C),
962 DEF_OPT("D", no_mac, OPT_D),
963 DEF_OPT("H", 0, OPT_H),
964 DEF_OPT("I", no_dir, OPT_I),
965 DEF_OPT("M", 0, OPT_M),
966 DEF_OPT("MD", no_fil, OPT_MD),
967 DEF_OPT("MG", 0, OPT_MG),
968 DEF_OPT("MM", 0, OPT_MM),
969 DEF_OPT("MMD", no_fil, OPT_MMD),
970 DEF_OPT("P", 0, OPT_P),
971 DEF_OPT("U", no_mac, OPT_U),
972 /* NB: Immed arg only, and not reqd */
973 DEF_OPT("W", no_arg, OPT_W),
974 DEF_OPT("d", no_arg, OPT_d),
975 DEF_OPT("fleading-underscore", 0, OPT_fleading_underscore),
976 DEF_OPT("fno-leading-underscore", 0, OPT_fno_leading_underscore),
977 DEF_OPT("fpreprocessed", 0, OPT_fpreprocessed),
978 DEF_OPT("fno-preprocessed", 0, OPT_fno_preprocessed),
979 /* NB: Immed arg only, and not reqd */
980 DEF_OPT("g", no_arg, OPT_g),
981 DEF_OPT("h", 0, OPT_h),
982 DEF_OPT("idirafter", no_dir, OPT_idirafter),
983 DEF_OPT("imacros", no_fil, OPT_imacros),
984 DEF_OPT("include", no_fil, OPT_include),
985 DEF_OPT("iprefix", no_pth, OPT_iprefix),
986 DEF_OPT("isystem", no_dir, OPT_isystem),
987 DEF_OPT("iwithprefix", no_dir, OPT_iwithprefix),
988 DEF_OPT("iwithprefixbefore", no_dir, OPT_iwithprefixbefore),
989 DEF_OPT("lang-asm", 0, OPT_lang_asm),
990 DEF_OPT("lang-c", 0, OPT_lang_c),
991 DEF_OPT("lang-c++", 0, OPT_lang_cplusplus),
992 DEF_OPT("lang-c89", 0, OPT_lang_c89),
993 DEF_OPT("lang-chill", 0, OPT_lang_chill),
994 DEF_OPT("lang-fortran", 0, OPT_lang_fortran),
995 DEF_OPT("lang-objc", 0, OPT_lang_objc),
996 DEF_OPT("lang-objc++", 0, OPT_lang_objcplusplus),
997 DEF_OPT("nostdinc", 0, OPT_nostdinc),
998 DEF_OPT("nostdinc++", 0, OPT_nostdincplusplus),
999 DEF_OPT("o", no_fil, OPT_o),
1000 DEF_OPT("pedantic", 0, OPT_pedantic),
1001 DEF_OPT("pedantic-errors", 0, OPT_pedantic_errors),
1002 DEF_OPT("remap", 0, OPT_remap),
1003 DEF_OPT("std=c89", 0, OPT_std_c89),
1004 DEF_OPT("std=c99", 0, OPT_std_c99),
1005 DEF_OPT("std=c9x", 0, OPT_std_c9x),
1006 DEF_OPT("std=gnu89", 0, OPT_std_gnu89),
1007 DEF_OPT("std=gnu99", 0, OPT_std_gnu99),
1008 DEF_OPT("std=gnu9x", 0, OPT_std_gnu9x),
1009 DEF_OPT("std=iso9899:1990", 0, OPT_std_iso9899_1990),
1010 DEF_OPT("std=iso9899:199409", 0, OPT_std_iso9899_199409),
1011 DEF_OPT("std=iso9899:1999", 0, OPT_std_iso9899_1999),
1012 DEF_OPT("std=iso9899:199x", 0, OPT_std_iso9899_199x),
1013 DEF_OPT("traditional", 0, OPT_traditional),
1014 DEF_OPT("trigraphs", 0, OPT_trigraphs),
1015 DEF_OPT("v", 0, OPT_v),
1016 DEF_OPT("w", 0, OPT_w)
1020 /* Perform a binary search to find which, if any, option the given
1021 command-line matches. Returns its index in the option array,
1022 negative on failure. Complications arise since some options can be
1023 suffixed with an argument, and multiple complete matches can occur,
1024 e.g. -iwithprefix and -iwithprefixbefore. Moreover, we want to
1025 accept options beginning with -g and -W that we do not recognise,
1026 but not to swallow any subsequent command line argument; these are
1027 handled as special cases in cpp_handle_option */
1029 parse_option (input)
1032 unsigned int md, mn, mx;
1043 opt_len = cl_options[md].opt_len;
1044 comp = strncmp (input, cl_options[md].opt_text, opt_len);
1052 if (input[opt_len] == '\0')
1054 /* We were passed more text. If the option takes an argument,
1055 we may match a later option or we may have been passed the
1056 argument. The longest possible option match succeeds.
1057 If the option takes no arguments we have not matched and
1058 continue the search (e.g. input="stdc++" match was "stdc") */
1060 if (cl_options[md].msg)
1062 /* Scan forwards. If we get an exact match, return it.
1063 Otherwise, return the longest option-accepting match.
1064 This loops no more than twice with current options */
1066 for (; mn < N_OPTS; mn++)
1068 opt_len = cl_options[mn].opt_len;
1069 if (strncmp (input, cl_options[mn].opt_text, opt_len))
1071 if (input[opt_len] == '\0')
1073 if (cl_options[mn].msg)
1084 /* Handle one command-line option in (argc, argv).
1085 Can be called multiple times, to handle multiple sets of options.
1086 Returns number of strings consumed. */
1089 handle_option (pfile, argc, argv)
1094 struct cpp_options *opts = CPP_OPTIONS (pfile);
1097 if (argv[i][0] != '-')
1099 if (opts->out_fname != NULL)
1102 cpp_fatal (pfile, "Too many arguments");
1104 else if (opts->in_fname != NULL)
1105 opts->out_fname = argv[i];
1107 opts->in_fname = argv[i];
1111 enum opt_code opt_code;
1116 opt_index = parse_option (&argv[i][1]);
1120 opt_code = cl_options[opt_index].opt_code;
1121 if (cl_options[opt_index].msg)
1123 arg = &argv[i][cl_options[opt_index].opt_len + 1];
1125 /* Yuk. Special case for -g and -W as they must not swallow
1126 up any following argument. If this becomes common, add
1127 another field to the cl_options table */
1128 if (arg[0] == '\0' && !(opt_code == OPT_g || opt_code == OPT_W))
1133 cpp_fatal (pfile, _(cl_options[opt_index].msg), argv[i - 1]);
1141 case N_OPTS: /* shut GCC up */
1143 case OPT_fleading_underscore:
1144 user_label_prefix = "_";
1146 case OPT_fno_leading_underscore:
1147 user_label_prefix = "";
1149 case OPT_fpreprocessed:
1150 opts->preprocessed = 1;
1152 case OPT_fno_preprocessed:
1153 opts->preprocessed = 0;
1156 opts->inhibit_warnings = 1;
1158 case OPT_g: /* Silently ignore anything but -g3 */
1159 if (!strcmp(&argv[i][2], "3"))
1160 opts->debug_output = 1;
1168 fprintf (stderr, _("GNU CPP version %s (cpplib)\n"), version_string);
1172 opts->discard_comments = 0;
1175 opts->no_line_commands = 1;
1177 case OPT_dollar: /* Don't include $ in identifiers. */
1178 opts->dollars_in_ident = 0;
1181 opts->print_include_names = 1;
1184 new_pending_define (opts, arg);
1186 case OPT_pedantic_errors:
1187 opts->pedantic_errors = 1;
1192 case OPT_traditional:
1193 opts->traditional = 1;
1194 opts->cplusplus_comments = 0;
1195 opts->trigraphs = 0;
1196 opts->warn_trigraphs = 0;
1199 opts->trigraphs = 1;
1202 opts->cplusplus = 1;
1203 opts->cplusplus_comments = 1;
1209 opts->include_prefix = arg;
1210 opts->include_prefix_len = strlen (arg);
1213 opts->cplusplus = 0, opts->cplusplus_comments = 1;
1214 opts->c89 = 0, opts->c99 = 1, opts->objc = 0;
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 case OPT_lang_cplusplus:
1223 opts->cplusplus = 1, opts->cplusplus_comments = 1;
1224 opts->c89 = 0, opts->c99 = 0, opts->objc = 0;
1227 case OPT_lang_objcplusplus:
1228 opts->cplusplus = opt_code == OPT_lang_objcplusplus;
1229 opts->cplusplus_comments = 1;
1230 opts->c89 = 0, opts->c99 = 0, opts->objc = 1;
1235 case OPT_lang_fortran:
1236 opts->lang_fortran = 1, opts->cplusplus_comments = 0;
1238 case OPT_lang_chill:
1239 opts->objc = 0, opts->cplusplus = 0;
1240 opts->chill = 1, opts->traditional = 1;
1243 /* -nostdinc causes no default include directories.
1244 You must specify all include-file directories with -I. */
1245 opts->no_standard_includes = 1;
1247 case OPT_nostdincplusplus:
1248 /* -nostdinc++ causes no default C++-specific include directories. */
1249 opts->no_standard_cplusplus_includes = 1;
1252 opts->cplusplus = 0, opts->cplusplus_comments = 1;
1253 opts->c89 = 1, opts->c99 = 0, opts->objc = 0;
1257 opts->cplusplus = 0, opts->cplusplus_comments = 1;
1258 opts->c89 = 0, opts->c99 = 1, opts->objc = 0;
1259 new_pending_define (opts, "__STDC_VERSION__=199901L");
1261 case OPT_std_iso9899_199409:
1262 new_pending_define (opts, "__STDC_VERSION__=199409L");
1264 case OPT_std_iso9899_1990:
1266 opts->cplusplus = 0, opts->cplusplus_comments = 0;
1267 opts->c89 = 1, opts->c99 = 0, opts->objc = 0;
1268 opts->trigraphs = 1;
1269 new_pending_define (opts, "__STRICT_ANSI__");
1271 case OPT_std_iso9899_199x:
1272 case OPT_std_iso9899_1999:
1275 opts->cplusplus = 0, opts->cplusplus_comments = 1;
1276 opts->c89 = 0, opts->c99 = 1, opts->objc = 0;
1277 opts->trigraphs = 1;
1278 new_pending_define (opts, "__STRICT_ANSI__");
1279 new_pending_define (opts, "__STDC_VERSION__=199901L");
1282 if (opts->out_fname != NULL)
1284 cpp_fatal (pfile, "Output filename specified twice");
1287 opts->out_fname = arg;
1288 if (!strcmp (opts->out_fname, "-"))
1289 opts->out_fname = "";
1292 fprintf (stderr, _("GNU CPP version %s (cpplib)\n"), version_string);
1293 #ifdef TARGET_VERSION
1296 fputc ('\n', stderr);
1299 case OPT_stdin_stdout:
1300 /* JF handle '-' as file name meaning stdin or stdout */
1301 if (opts->in_fname == NULL)
1302 opts->in_fname = "";
1303 else if (opts->out_fname == NULL)
1304 opts->out_fname = "";
1307 /* Args to -d specify what parts of macros to dump.
1308 Silently ignore unrecognised options; they may
1309 be aimed at the compiler proper. */
1313 while ((c = *arg++) != '\0')
1317 opts->dump_macros = dump_only;
1318 opts->no_output = 1;
1321 opts->dump_macros = dump_names;
1324 opts->dump_macros = dump_definitions;
1327 opts->dump_includes = 1;
1332 /* The style of the choices here is a bit mixed.
1333 The chosen scheme is a hybrid of keeping all options in one string
1334 and specifying each option in a separate argument:
1335 -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
1336 -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
1337 -M[M][G][D file]. This is awkward to handle in specs, and is not
1339 /* ??? -MG must be specified in addition to one of -M or -MM.
1340 This can be relaxed in the future without breaking anything.
1341 The converse isn't true. */
1343 /* -MG isn't valid with -MD or -MMD. This is checked for later. */
1345 opts->print_deps_missing_files = 1;
1351 if (opt_code == OPT_M || opt_code == OPT_MD)
1352 opts->print_deps = 2;
1354 opts->print_deps = 1;
1356 /* For -MD and -MMD options, write deps on file named by next arg */
1357 /* For -M and -MM, write deps on standard output
1358 and suppress the usual output. */
1359 if (opt_code == OPT_MD || opt_code == OPT_MMD)
1360 opts->deps_file = arg;
1362 opts->no_output = 1;
1365 if (strcmp (arg, "-"))
1367 struct pending_option *o = (struct pending_option *)
1368 xmalloc (sizeof (struct pending_option));
1373 APPEND (opts->pending, assert, o);
1377 /* -A- eliminates all predefined macros and assertions.
1378 Let's include also any that were specified earlier
1379 on the command line. That way we can get rid of any
1380 that were passed automatically in from GCC. */
1381 struct pending_option *o1, *o2;
1383 o1 = opts->pending->define_head;
1390 o1 = opts->pending->assert_head;
1397 opts->pending->assert_head = NULL;
1398 opts->pending->assert_tail = NULL;
1399 opts->pending->define_head = NULL;
1400 opts->pending->define_tail = NULL;
1405 struct pending_option *o = (struct pending_option *)
1406 xmalloc (sizeof (struct pending_option));
1411 APPEND (opts->pending, define, o);
1414 case OPT_I: /* Add directory to path for includes. */
1415 if (!strcmp (arg, "-"))
1418 Use the preceding -I directories for #include "..."
1419 but not #include <...>.
1420 Don't search the directory of the present file
1421 for #include "...". (Note that -I. -I- is not the same as
1422 the default setup; -I. uses the compiler's working dir.) */
1423 if (! opts->ignore_srcdir)
1425 opts->ignore_srcdir = 1;
1426 opts->pending->quote_head = opts->pending->brack_head;
1427 opts->pending->quote_tail = opts->pending->brack_tail;
1428 opts->pending->brack_head = 0;
1429 opts->pending->brack_tail = 0;
1433 cpp_fatal (pfile, "-I- specified twice");
1438 append_include_chain (pfile, opts->pending,
1439 xstrdup (arg), BRACKET, 0);
1442 /* Add directory to beginning of system include path, as a system
1443 include directory. */
1444 append_include_chain (pfile, opts->pending,
1445 xstrdup (arg), SYSTEM, 0);
1449 struct pending_option *o = (struct pending_option *)
1450 xmalloc (sizeof (struct pending_option));
1453 /* This list has to be built in reverse order so that
1454 when cpp_start_read pushes all the -include files onto
1455 the buffer stack, they will be scanned in forward order. */
1456 o->next = opts->pending->include_head;
1457 opts->pending->include_head = o;
1462 struct pending_option *o = (struct pending_option *)
1463 xmalloc (sizeof (struct pending_option));
1467 APPEND (opts->pending, imacros, o);
1470 case OPT_iwithprefix:
1471 /* Add directory to end of path for includes,
1472 with the default prefix at the front of its name. */
1474 case OPT_iwithprefixbefore:
1475 /* Add directory to main path for includes,
1476 with the default prefix at the front of its name. */
1483 if (opts->include_prefix != 0)
1485 fname = xmalloc (opts->include_prefix_len + len + 1);
1486 memcpy (fname, opts->include_prefix, opts->include_prefix_len);
1487 memcpy (fname + opts->include_prefix_len, arg, len + 1);
1491 fname = xmalloc (sizeof GCC_INCLUDE_DIR - 8 + len);
1492 memcpy (fname, GCC_INCLUDE_DIR, sizeof GCC_INCLUDE_DIR - 9);
1493 memcpy (fname + sizeof GCC_INCLUDE_DIR - 9, arg, len + 1);
1496 append_include_chain (pfile, opts->pending, fname,
1497 opt_code == OPT_iwithprefix ? SYSTEM: BRACKET, 0);
1501 /* Add directory to end of path for includes. */
1502 append_include_chain (pfile, opts->pending,
1503 xstrdup (arg), AFTER, 0);
1506 /* Silently ignore unrecognised options */
1507 if (!strcmp (argv[i], "-Wall"))
1509 opts->warn_trigraphs = 1;
1510 opts->warn_comments = 1;
1512 else if (!strcmp (argv[i], "-Wtraditional"))
1513 opts->warn_stringify = 1;
1514 else if (!strcmp (argv[i], "-Wtrigraphs"))
1515 opts->warn_trigraphs = 1;
1516 else if (!strcmp (argv[i], "-Wcomment"))
1517 opts->warn_comments = 1;
1518 else if (!strcmp (argv[i], "-Wcomments"))
1519 opts->warn_comments = 1;
1520 else if (!strcmp (argv[i], "-Wundef"))
1521 opts->warn_undef = 1;
1522 else if (!strcmp (argv[i], "-Wimport"))
1523 opts->warn_import = 1;
1524 else if (!strcmp (argv[i], "-Werror"))
1525 opts->warnings_are_errors = 1;
1526 else if (!strcmp (argv[i], "-Wno-traditional"))
1527 opts->warn_stringify = 0;
1528 else if (!strcmp (argv[i], "-Wno-trigraphs"))
1529 opts->warn_trigraphs = 0;
1530 else if (!strcmp (argv[i], "-Wno-comment"))
1531 opts->warn_comments = 0;
1532 else if (!strcmp (argv[i], "-Wno-comments"))
1533 opts->warn_comments = 0;
1534 else if (!strcmp (argv[i], "-Wno-undef"))
1535 opts->warn_undef = 0;
1536 else if (!strcmp (argv[i], "-Wno-import"))
1537 opts->warn_import = 0;
1538 else if (!strcmp (argv[i], "-Wno-error"))
1539 opts->warnings_are_errors = 0;
1548 opt_comp (const void *p1, const void *p2)
1550 return strcmp (((struct cl_option *)p1)->opt_text,
1551 ((struct cl_option *)p2)->opt_text);
1555 /* Handle command-line options in (argc, argv).
1556 Can be called multiple times, to handle multiple sets of options.
1557 Returns if an unrecognized option is seen.
1558 Returns number of strings consumed. */
1560 cpp_handle_options (pfile, argc, argv)
1566 int strings_processed;
1569 static int opts_sorted = 0;
1574 /* For non-ASCII hosts, the array needs to be sorted at runtime */
1575 qsort (cl_options, N_OPTS, sizeof (struct cl_option), opt_comp);
1579 for (i = 0; i < argc; i += strings_processed)
1581 strings_processed = handle_option (pfile, argc - i, argv + i);
1582 if (strings_processed == 0)
1591 fprintf (stderr, _("Usage: %s [switches] input output\n"), progname);
1594 -include <file> Include the contents of <file> before other files\n\
1595 -imacros <file> Accept definition of macros in <file>\n\
1596 -iprefix <path> Specify <path> as a prefix for next two options\n\
1597 -iwithprefix <dir> Add <dir> to the end of the system include path\n\
1598 -iwithprefixbefore <dir> Add <dir> to the end of the main include path\n\
1599 -isystem <dir> Add <dir> to the start of the system include path\n\
1600 -idirafter <dir> Add <dir> to the end of the system include path\n\
1601 -I <dir> Add <dir> to the end of the main include path\n\
1602 -I- Fine-grained include path control; see info docs\n\
1603 -nostdinc Do not search system include directories\n\
1604 (dirs specified with -isystem will still be used)\n\
1605 -nostdinc++ Do not search system include directories for C++\n\
1606 -o <file> Put output into <file>\n\
1607 -pedantic Issue all warnings demanded by strict ANSI C\n\
1608 -pedantic-errors Issue -pedantic warnings as errors instead\n\
1609 -traditional Follow K&R pre-processor behaviour\n\
1610 -trigraphs Support ANSI C trigraphs\n\
1611 -lang-c Assume that the input sources are in C\n\
1612 -lang-c89 Assume that the input sources are in C89\n\
1613 -lang-c++ Assume that the input sources are in C++\n\
1614 -lang-objc Assume that the input sources are in ObjectiveC\n\
1615 -lang-objc++ Assume that the input sources are in ObjectiveC++\n\
1616 -lang-asm Assume that the input sources are in assembler\n\
1617 -lang-fortran Assume that the input sources are in Fortran\n\
1618 -lang-chill Assume that the input sources are in Chill\n\
1619 -std=<std name> Specify the conformance standard; one of:\n\
1620 gnu89, gnu99, c89, c99, iso9899:1990,\n\
1621 iso9899:199409, iso9899:1999\n\
1622 -+ Allow parsing of C++ style features\n\
1623 -w Inhibit warning messages\n\
1624 -Wtrigraphs Warn if trigraphs are encountered\n\
1625 -Wno-trigraphs Do not warn about trigraphs\n\
1626 -Wcomment{s} Warn if one comment starts inside another\n\
1627 -Wno-comment{s} Do not warn about comments\n\
1628 -Wtraditional Warn if a macro argument is/would be turned into\n\
1629 a string if -traditional is specified\n\
1630 -Wno-traditional Do not warn about stringification\n\
1631 -Wundef Warn if an undefined macro is used by #if\n\
1632 -Wno-undef Do not warn about testing undefined macros\n\
1633 -Wimport Warn about the use of the #import directive\n\
1634 -Wno-import Do not warn about the use of #import\n\
1635 -Werror Treat all warnings as errors\n\
1636 -Wno-error Do not treat warnings as errors\n\
1637 -Wall Enable all preprocessor warnings\n\
1638 -M Generate make dependencies\n\
1639 -MM As -M, but ignore system header files\n\
1640 -MD As -M, but put output in a .d file\n\
1641 -MMD As -MD, but ignore system header files\n\
1642 -MG Treat missing header file as generated files\n\
1643 -g3 Include #define and #undef directives in the output\n\
1644 -D<macro> Define a <macro> with string '1' as its value\n\
1645 -D<macro>=<val> Define a <macro> with <val> as its value\n\
1646 -A<question> (<answer>) Assert the <answer> to <question>\n\
1647 -U<macro> Undefine <macro> \n\
1648 -v Display the version number\n\
1649 -H Print the name of header files as they are used\n\
1650 -C Do not discard comments\n\
1651 -dM Display a list of macro definitions active at end\n\
1652 -dD Preserve macro definitions in output\n\
1653 -dN As -dD except that only the names are preserved\n\
1654 -dI Include #include directives in the output\n\
1655 -P Do not generate #line directives\n\
1656 -$ Do not allow '$' in identifiers\n\
1657 -remap Remap file names when including files.\n\
1658 --version Display version information\n\
1659 -h or --help Display this information\n\