* rtl.h (rtunion_def): Constify member `rtstr'.
[official-gcc.git] / gcc / cppinit.c
blob4286ecbe31506dbff416b85e53e383b04311f100
1 /* CPP Library.
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
11 later version.
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. */
22 #include "config.h"
23 #include "system.h"
25 #include "cpplib.h"
26 #include "cpphash.h"
27 #include "output.h"
28 #include "prefix.h"
29 #include "intl.h"
30 #include "version.h"
31 #include "mkdeps.h"
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)
37 #endif
39 #ifndef STANDARD_INCLUDE_DIR
40 #define STANDARD_INCLUDE_DIR "/usr/include"
41 #endif
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__. */
51 #ifndef SIZE_TYPE
52 #define SIZE_TYPE "long unsigned int"
53 #endif
55 /* The string value for __PTRDIFF_TYPE__. */
57 #ifndef PTRDIFF_TYPE
58 #define PTRDIFF_TYPE "long int"
59 #endif
61 /* The string value for __WCHAR_TYPE__. */
63 #ifndef WCHAR_TYPE
64 #define WCHAR_TYPE "int"
65 #endif
67 /* The string value for __USER_LABEL_PREFIX__ */
69 #ifndef USER_LABEL_PREFIX
70 #define USER_LABEL_PREFIX ""
71 #endif
73 /* The string value for __REGISTER_PREFIX__ */
75 #ifndef REGISTER_PREFIX
76 #define REGISTER_PREFIX ""
77 #endif
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,
83 then this list.
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
97 C++. */
100 static const struct default_include include_defaults_array[]
101 #ifdef INCLUDE_DEFAULTS
102 = INCLUDE_DEFAULTS;
103 #else
105 /* Pick up GNU C++ specific include files. */
106 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },
107 #ifdef CROSS_COMPILE
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 },
117 #endif
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 },
123 #endif
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 },
128 #endif
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 },
135 #endif
136 #ifndef STANDARD_INCLUDE_COMPONENT
137 #define STANDARD_INCLUDE_COMPONENT 0
138 #endif
139 { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 },
140 #endif /* not CROSS_COMPILE */
141 { 0, 0, 0, 0 }
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;
155 char *arg;
156 int undef;
159 #ifdef __STDC__
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); \
164 } while (0)
165 #else
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); \
170 } while (0)
171 #endif
173 static void print_help PARAMS ((void));
174 static void path_include PARAMS ((cpp_reader *,
175 struct cpp_pending *,
176 char *, int));
177 static void initialize_builtins PARAMS ((cpp_reader *));
178 static void append_include_chain PARAMS ((cpp_reader *,
179 struct cpp_pending *,
180 char *, int, int));
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 *,
185 const char *));
187 /* Fourth argument to append_include_chain: chain to use */
188 enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
190 /* If we have designated initializers (GCC >2.7, or C99) this table
191 can be initialized, constant data. Otherwise, it has to be filled
192 in at runtime. */
194 #if (GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)
195 #define init_IStable() /* nothing */
196 #define ISTABLE const unsigned char _cpp_IStable[256] = {
197 #define END };
198 #define s(p, v) [p] = v,
199 #else
200 #define ISTABLE unsigned char _cpp_IStable[256] = { 0 }; \
201 static void init_IStable PARAMS ((void)) { \
202 unsigned char *x = _cpp_IStable;
203 #define END }
204 #define s(p, v) x[p] = v;
205 #endif
207 #define A(x) s(x, ISidnum|ISidstart)
208 #define N(x) s(x, ISidnum|ISnumstart)
209 #define H(x) s(x, IShspace|ISspace)
210 #define S(x) s(x, ISspace)
212 ISTABLE
213 A('_')
215 A('a') A('b') A('c') A('d') A('e') A('f') A('g') A('h') A('i')
216 A('j') A('k') A('l') A('m') A('n') A('o') A('p') A('q') A('r')
217 A('s') A('t') A('u') A('v') A('w') A('x') A('y') A('z')
219 A('A') A('B') A('C') A('D') A('E') A('F') A('G') A('H') A('I')
220 A('J') A('K') A('L') A('M') A('N') A('O') A('P') A('Q') A('R')
221 A('S') A('T') A('U') A('V') A('W') A('X') A('Y') A('Z')
223 N('1') N('2') N('3') N('4') N('5') N('6') N('7') N('8') N('9') N('0')
225 H(' ') H('\t') H('\v') H('\f')
227 S('\n')
230 #undef A
231 #undef N
232 #undef H
233 #undef S
234 #undef s
235 #undef ISTABLE
236 #undef END
238 /* Given a colon-separated list of file names PATH,
239 add all the names to the search path for include files. */
241 static void
242 path_include (pfile, pend, list, path)
243 cpp_reader *pfile;
244 struct cpp_pending *pend;
245 char *list;
246 int path;
248 char *p, *q, *name;
250 p = list;
254 /* Find the end of this name. */
255 q = p;
256 while (*q != 0 && *q != PATH_SEPARATOR) q++;
257 if (q == p)
259 /* An empty name in the path stands for the current directory. */
260 name = (char *) xmalloc (2);
261 name[0] = '.';
262 name[1] = 0;
264 else
266 /* Otherwise use the directory that is named. */
267 name = (char *) xmalloc (q - p + 1);
268 memcpy (name, p, q - p);
269 name[q - p] = 0;
272 append_include_chain (pfile, pend, name, path, 0);
274 /* Advance past this name. */
275 if (*q == 0)
276 break;
277 p = q + 1;
279 while (1);
282 /* Append DIR to include path PATH. DIR must be permanently allocated
283 and writable. */
284 static void
285 append_include_chain (pfile, pend, dir, path, cxx_aware)
286 cpp_reader *pfile;
287 struct cpp_pending *pend;
288 char *dir;
289 int path;
290 int cxx_aware;
292 struct file_name_list *new;
293 struct stat st;
294 unsigned int len;
296 simplify_pathname (dir);
297 if (stat (dir, &st))
299 /* Dirs that don't exist are silently ignored. */
300 if (errno != ENOENT)
301 cpp_notice_from_errno (pfile, dir);
302 else if (CPP_OPTIONS (pfile)->verbose)
303 fprintf (stderr, _("ignoring nonexistent directory `%s'\n"), dir);
304 return;
307 if (!S_ISDIR (st.st_mode))
309 cpp_notice (pfile, "%s: Not a directory", dir);
310 return;
313 len = strlen (dir);
314 if (len > pfile->max_include_len)
315 pfile->max_include_len = len;
317 new = (struct file_name_list *)xmalloc (sizeof (struct file_name_list));
318 new->name = dir;
319 new->nlen = len;
320 new->ino = st.st_ino;
321 new->dev = st.st_dev;
322 if (path == SYSTEM)
323 new->sysp = cxx_aware ? 1 : 2;
324 else
325 new->sysp = 0;
326 new->name_map = NULL;
327 new->next = NULL;
328 new->alloc = NULL;
330 switch (path)
332 case QUOTE: APPEND (pend, quote, new); break;
333 case BRACKET: APPEND (pend, brack, new); break;
334 case SYSTEM: APPEND (pend, systm, new); break;
335 case AFTER: APPEND (pend, after, new); break;
340 /* Write out a #define command for the special named MACRO_NAME
341 to PFILE's token_buffer. */
343 static void
344 dump_special_to_buffer (pfile, macro_name)
345 cpp_reader *pfile;
346 const char *macro_name;
348 static const char define_directive[] = "#define ";
349 int macro_name_length = strlen (macro_name);
350 output_line_command (pfile, same_file);
351 CPP_RESERVE (pfile, sizeof(define_directive) + macro_name_length);
352 CPP_PUTS_Q (pfile, define_directive, sizeof(define_directive)-1);
353 CPP_PUTS_Q (pfile, macro_name, macro_name_length);
354 CPP_PUTC_Q (pfile, ' ');
355 cpp_expand_to_buffer (pfile, macro_name, macro_name_length);
356 CPP_PUTC (pfile, '\n');
359 /* Initialize a cpp_options structure. */
360 void
361 cpp_options_init (opts)
362 cpp_options *opts;
364 bzero ((char *) opts, sizeof (struct cpp_options));
366 opts->dollars_in_ident = 1;
367 opts->cplusplus_comments = 1;
368 opts->warn_import = 1;
369 opts->discard_comments = 1;
371 opts->pending =
372 (struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending));
375 /* Initialize a cpp_reader structure. */
376 void
377 cpp_reader_init (pfile)
378 cpp_reader *pfile;
380 bzero ((char *) pfile, sizeof (cpp_reader));
382 pfile->token_buffer_size = 200;
383 pfile->token_buffer = (U_CHAR *) xmalloc (pfile->token_buffer_size);
384 CPP_SET_WRITTEN (pfile, 0);
386 pfile->hashtab = (HASHNODE **) xcalloc (HASHSIZE, sizeof (HASHNODE *));
389 /* Free resources used by PFILE.
390 This is the cpp_reader 'finalizer' or 'destructor' (in C++ terminology). */
391 void
392 cpp_cleanup (pfile)
393 cpp_reader *pfile;
395 int i;
396 while (CPP_BUFFER (pfile) != CPP_NULL_BUFFER (pfile))
397 cpp_pop_buffer (pfile);
399 if (pfile->token_buffer)
401 free (pfile->token_buffer);
402 pfile->token_buffer = NULL;
405 if (pfile->input_buffer)
407 free (pfile->input_buffer);
408 free (pfile->input_speccase);
409 pfile->input_buffer = pfile->input_speccase = NULL;
410 pfile->input_buffer_len = 0;
413 if (pfile->deps)
414 deps_free (pfile->deps);
416 while (pfile->if_stack)
418 IF_STACK_FRAME *temp = pfile->if_stack;
419 pfile->if_stack = temp->next;
420 free (temp);
423 for (i = ALL_INCLUDE_HASHSIZE; --i >= 0; )
425 struct include_hash *imp = pfile->all_include_files[i];
426 while (imp)
428 struct include_hash *next = imp->next;
430 free ((PTR) imp->name);
431 free (imp);
432 imp = next;
434 pfile->all_include_files[i] = 0;
437 for (i = HASHSIZE; --i >= 0;)
439 while (pfile->hashtab[i])
440 delete_macro (pfile->hashtab[i]);
442 free (pfile->hashtab);
446 /* This structure defines one built-in macro. A node of type TYPE will
447 be entered in the macro hash table under the name NAME, with value
448 VALUE (if any). FLAGS tweaks the behavior a little:
449 DUMP write debug info for this macro
450 STDC define only if not -traditional
451 ULP value is the global user_label_prefix (which can't be
452 put directly into the table).
455 struct builtin
457 const char *name;
458 const char *value;
459 unsigned short type;
460 unsigned short flags;
462 #define DUMP 0x01
463 #define STDC 0x02
464 #define ULP 0x10
466 static const struct builtin builtin_array[] =
468 { "__TIME__", 0, T_TIME, DUMP },
469 { "__DATE__", 0, T_DATE, DUMP },
470 { "__FILE__", 0, T_FILE, 0 },
471 { "__BASE_FILE__", 0, T_BASE_FILE, 0 },
472 { "__LINE__", 0, T_SPECLINE, 0 },
473 { "__INCLUDE_LEVEL__", 0, T_INCLUDE_LEVEL, 0 },
474 { "__VERSION__", 0, T_VERSION, DUMP },
475 { "__STDC__", 0, T_STDC, DUMP|STDC },
477 { "__USER_LABEL_PREFIX__", 0, T_CONST, ULP },
478 { "__REGISTER_PREFIX__", REGISTER_PREFIX, T_CONST, 0 },
479 { "__HAVE_BUILTIN_SETJMP__", "1", T_CONST, 0 },
480 #ifndef NO_BUILTIN_SIZE_TYPE
481 { "__SIZE_TYPE__", SIZE_TYPE, T_CONST, DUMP },
482 #endif
483 #ifndef NO_BUILTIN_PTRDIFF_TYPE
484 { "__PTRDIFF_TYPE__", PTRDIFF_TYPE, T_CONST, DUMP },
485 #endif
486 #ifndef NO_BUILTIN_WCHAR_TYPE
487 { "__WCHAR_TYPE__", WCHAR_TYPE, T_CONST, DUMP },
488 #endif
489 { 0, 0, 0, 0 }
492 /* Subroutine of cpp_start_read; reads the builtins table above and
493 enters the macros into the hash table. */
495 static void
496 initialize_builtins (pfile)
497 cpp_reader *pfile;
499 int len;
500 const struct builtin *b;
501 const char *val;
502 for(b = builtin_array; b->name; b++)
504 if ((b->flags & STDC) && CPP_TRADITIONAL (pfile))
505 continue;
507 val = (b->flags & ULP) ? user_label_prefix : b->value;
508 len = strlen (b->name);
510 cpp_install (pfile, b->name, len, b->type, val);
511 if ((b->flags & DUMP) && CPP_OPTIONS (pfile)->debug_output)
512 dump_special_to_buffer (pfile, b->name);
516 #undef DUMP
517 #undef STDC
518 #undef ULP
520 /* Another subroutine of cpp_start_read. This one sets up to do
521 dependency-file output. */
522 static void
523 initialize_dependency_output (pfile)
524 cpp_reader *pfile;
526 cpp_options *opts = CPP_OPTIONS (pfile);
527 char *spec, *s, *output_file;
529 /* Either of two environment variables can specify output of deps.
530 Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET",
531 where OUTPUT_FILE is the file to write deps info to
532 and DEPS_TARGET is the target to mention in the deps. */
534 if (opts->print_deps == 0)
536 spec = getenv ("DEPENDENCIES_OUTPUT");
537 if (spec)
538 opts->print_deps = 1;
539 else
541 spec = getenv ("SUNPRO_DEPENDENCIES");
542 if (spec)
543 opts->print_deps = 2;
544 else
545 return;
548 /* Find the space before the DEPS_TARGET, if there is one. */
549 s = strchr (spec, ' ');
550 if (s)
552 opts->deps_target = s + 1;
553 output_file = (char *) xmalloc (s - spec + 1);
554 memcpy (output_file, spec, s - spec);
555 output_file[s - spec] = 0;
557 else
559 opts->deps_target = 0;
560 output_file = spec;
563 opts->deps_file = output_file;
564 opts->print_deps_append = 1;
567 pfile->deps = deps_init ();
569 /* Print the expected object file name as the target of this Make-rule. */
570 if (opts->deps_target)
571 deps_add_target (pfile->deps, opts->deps_target);
572 else if (*opts->in_fname == 0)
573 deps_add_target (pfile->deps, "-");
574 else
575 deps_calc_target (pfile->deps, opts->in_fname);
577 if (opts->in_fname)
578 deps_add_dep (pfile->deps, opts->in_fname);
581 /* And another subroutine. This one sets up the standard include path. */
582 static void
583 initialize_standard_includes (pfile)
584 cpp_reader *pfile;
586 cpp_options *opts = CPP_OPTIONS (pfile);
587 char *path;
588 const struct default_include *p;
589 char *specd_prefix = opts->include_prefix;
591 /* Several environment variables may add to the include search path.
592 CPATH specifies an additional list of directories to be searched
593 as if specified with -I, while C_INCLUDE_PATH, CPLUS_INCLUDE_PATH,
594 etc. specify an additional list of directories to be searched as
595 if specified with -isystem, for the language indicated. */
597 GET_ENV_PATH_LIST (path, "CPATH");
598 if (path != 0 && *path != 0)
599 path_include (pfile, opts->pending, path, BRACKET);
601 switch ((opts->objc << 1) + opts->cplusplus)
603 case 0:
604 GET_ENV_PATH_LIST (path, "C_INCLUDE_PATH");
605 break;
606 case 1:
607 GET_ENV_PATH_LIST (path, "CPLUS_INCLUDE_PATH");
608 break;
609 case 2:
610 GET_ENV_PATH_LIST (path, "OBJC_INCLUDE_PATH");
611 break;
612 case 3:
613 GET_ENV_PATH_LIST (path, "OBJCPLUS_INCLUDE_PATH");
614 break;
616 if (path != 0 && *path != 0)
617 path_include (pfile, opts->pending, path, SYSTEM);
619 /* Search "translated" versions of GNU directories.
620 These have /usr/local/lib/gcc... replaced by specd_prefix. */
621 if (specd_prefix != 0)
623 char *default_prefix = alloca (sizeof GCC_INCLUDE_DIR - 7);
624 /* Remove the `include' from /usr/local/lib/gcc.../include.
625 GCC_INCLUDE_DIR will always end in /include. */
626 int default_len = sizeof GCC_INCLUDE_DIR - 8;
627 int specd_len = strlen (specd_prefix);
629 memcpy (default_prefix, GCC_INCLUDE_DIR, default_len);
630 default_prefix[default_len] = '\0';
632 for (p = include_defaults_array; p->fname; p++)
634 /* Some standard dirs are only for C++. */
635 if (!p->cplusplus
636 || (opts->cplusplus
637 && !opts->no_standard_cplusplus_includes))
639 /* Does this dir start with the prefix? */
640 if (!strncmp (p->fname, default_prefix, default_len))
642 /* Yes; change prefix and add to search list. */
643 int flen = strlen (p->fname);
644 int this_len = specd_len + flen - default_len;
645 char *str = (char *) xmalloc (this_len + 1);
646 memcpy (str, specd_prefix, specd_len);
647 memcpy (str + specd_len,
648 p->fname + default_len,
649 flen - default_len + 1);
651 append_include_chain (pfile, opts->pending,
652 str, SYSTEM, p->cxx_aware);
658 /* Search ordinary names for GNU include directories. */
659 for (p = include_defaults_array; p->fname; p++)
661 /* Some standard dirs are only for C++. */
662 if (!p->cplusplus
663 || (opts->cplusplus
664 && !opts->no_standard_cplusplus_includes))
666 /* XXX Potential memory leak! */
667 char *str = xstrdup (update_path (p->fname, p->component));
668 append_include_chain (pfile, opts->pending, str, SYSTEM,
669 p->cxx_aware);
674 /* This is called after options have been processed.
675 * Check options for consistency, and setup for processing input
676 * from the file named FNAME. (Use standard input if FNAME==NULL.)
677 * Return 1 on success, 0 on failure.
681 cpp_start_read (pfile, fname)
682 cpp_reader *pfile;
683 char *fname;
685 struct cpp_options *opts = CPP_OPTIONS (pfile);
686 struct pending_option *p, *q;
688 /* -MG doesn't select the form of output and must be specified with one of
689 -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't
690 inhibit compilation. */
691 if (opts->print_deps_missing_files
692 && (opts->print_deps == 0 || !opts->no_output))
694 cpp_fatal (pfile, "-MG must be specified with one of -M or -MM");
695 return 0;
698 /* Chill should not be used with -trigraphs. */
699 if (opts->chill && opts->trigraphs)
701 cpp_warning (pfile, "-lang-chill and -trigraphs are mutually exclusive");
702 opts->trigraphs = 0;
705 /* Set this if it hasn't been set already. */
706 if (user_label_prefix == NULL)
707 user_label_prefix = USER_LABEL_PREFIX;
709 /* Don't bother trying to do macro expansion if we've already done
710 preprocessing. */
711 if (opts->preprocessed)
712 pfile->no_macro_expand++;
714 /* Set up the IStable. This doesn't do anything if we were compiled
715 with a compiler that supports C99 designated initializers. */
716 init_IStable ();
718 /* Set up the include search path now. */
719 if (! opts->no_standard_includes)
720 initialize_standard_includes (pfile);
722 merge_include_chains (opts);
724 /* With -v, print the list of dirs to search. */
725 if (opts->verbose)
727 struct file_name_list *l;
728 fprintf (stderr, _("#include \"...\" search starts here:\n"));
729 for (l = opts->quote_include; l; l = l->next)
731 if (l == opts->bracket_include)
732 fprintf (stderr, _("#include <...> search starts here:\n"));
733 fprintf (stderr, " %s\n", l->name);
735 fprintf (stderr, _("End of search list.\n"));
738 initialize_dependency_output (pfile);
740 /* Open the main input file. This must be done before -D processing
741 so we have a buffer to stand on. */
742 if (opts->in_fname == NULL || *opts->in_fname == 0)
744 opts->in_fname = fname;
745 if (opts->in_fname == NULL)
746 opts->in_fname = "";
749 if (!cpp_read_file (pfile, fname))
750 return 0;
752 /* -D and friends may produce output, which should be identified
753 as line 0. */
755 CPP_BUFFER (pfile)->lineno = 0;
757 /* Install __LINE__, etc. */
758 initialize_builtins (pfile);
760 /* Do -U's, -D's and -A's in the order they were seen. */
761 p = opts->pending->define_head;
762 while (p)
764 if (p->undef)
765 cpp_undef (pfile, p->arg);
766 else
767 cpp_define (pfile, p->arg);
769 q = p->next;
770 free (p);
771 p = q;
774 p = opts->pending->assert_head;
775 while (p)
777 if (p->undef)
778 cpp_unassert (pfile, p->arg);
779 else
780 cpp_assert (pfile, p->arg);
782 q = p->next;
783 free (p);
784 p = q;
787 opts->done_initializing = 1;
788 CPP_BUFFER (pfile)->lineno = 1;
790 if (opts->preprocessed)
791 /* If we've already processed this code, we want to trust the #line
792 directives in the input. But we still need to update our line
793 counter accordingly. */
794 pfile->lineno = CPP_BUFFER (pfile)->lineno;
795 else
796 output_line_command (pfile, same_file);
797 pfile->only_seen_white = 2;
799 /* The -imacros files can be scanned now, but the -include files
800 have to be pushed onto the include stack and processed later,
801 in the main loop calling cpp_get_token. */
803 opts->no_output++;
804 p = opts->pending->imacros_head;
805 while (p)
807 if (cpp_read_file (pfile, p->arg))
808 cpp_scan_buffer (pfile);
810 q = p->next;
811 free (p);
812 p = q;
814 opts->no_output--;
816 p = opts->pending->include_head;
817 while (p)
819 if (cpp_read_file (pfile, p->arg))
820 output_line_command (pfile, enter_file);
822 q = p->next;
823 free (p);
824 p = q;
827 free (opts->pending);
828 opts->pending = NULL;
830 return 1;
833 /* This is called at the end of preprocessing. It pops the
834 last buffer and writes dependency output. It should also
835 clear macro definitions, such that you could call cpp_start_read
836 with a new filename to restart processing. */
837 void
838 cpp_finish (pfile)
839 cpp_reader *pfile;
841 struct cpp_options *opts = CPP_OPTIONS (pfile);
843 if (CPP_PREV_BUFFER (CPP_BUFFER (pfile)) != CPP_NULL_BUFFER (pfile))
844 cpp_ice (pfile, "buffers still stacked in cpp_finish");
845 cpp_pop_buffer (pfile);
847 /* Don't write the deps file if preprocessing has failed. */
848 if (opts->print_deps && pfile->errors == 0)
850 /* Stream on which to print the dependency information. */
851 FILE *deps_stream = 0;
853 const char *deps_mode = opts->print_deps_append ? "a" : "w";
854 if (opts->deps_file == 0)
855 deps_stream = stdout;
856 else if ((deps_stream = fopen (opts->deps_file, deps_mode)) == 0)
857 cpp_notice_from_errno (pfile, opts->deps_file);
859 if (deps_stream)
861 deps_write (pfile->deps, deps_stream, 72);
862 if (opts->deps_file)
864 if (ferror (deps_stream) || fclose (deps_stream) != 0)
865 cpp_fatal (pfile, "I/O error on output");
870 if (opts->dump_macros == dump_only)
872 int i;
873 HASHNODE *h;
874 for (i = HASHSIZE; --i >= 0;)
876 for (h = pfile->hashtab[i]; h; h = h->next)
877 if (h->type == T_MACRO)
879 dump_definition (pfile, h->name, h->length, h->value.defn);
880 CPP_PUTC (pfile, '\n');
886 static void
887 new_pending_define (opts, text)
888 struct cpp_options *opts;
889 const char *text;
891 struct pending_option *o = (struct pending_option *)
892 xmalloc (sizeof (struct pending_option));
894 o->arg = (char *) text;
895 o->next = NULL;
896 o->undef = 0;
897 APPEND (opts->pending, define, o);
900 /* Handle one command-line option in (argc, argv).
901 Can be called multiple times, to handle multiple sets of options.
902 Returns number of strings consumed. */
905 cpp_handle_option (pfile, argc, argv)
906 cpp_reader *pfile;
907 int argc;
908 char **argv;
910 struct cpp_options *opts = CPP_OPTIONS (pfile);
911 int i = 0;
913 if (argv[i][0] != '-')
915 if (opts->out_fname != NULL)
917 print_help ();
918 cpp_fatal (pfile, "Too many arguments");
920 else if (opts->in_fname != NULL)
921 opts->out_fname = argv[i];
922 else
923 opts->in_fname = argv[i];
925 else
926 switch (argv[i][1])
928 case 'f':
929 if (!strcmp (argv[i], "-fleading-underscore"))
930 user_label_prefix = "_";
931 else if (!strcmp (argv[i], "-fno-leading-underscore"))
932 user_label_prefix = "";
933 else if (!strcmp (argv[i], "-fpreprocessed"))
934 opts->preprocessed = 1;
935 else if (!strcmp (argv[i], "-fno-preprocessed"))
936 opts->preprocessed = 0;
937 else
939 return i;
941 break;
943 case 'I': /* Add directory to path for includes. */
944 if (!strcmp (argv[i] + 2, "-"))
946 /* -I- means:
947 Use the preceding -I directories for #include "..."
948 but not #include <...>.
949 Don't search the directory of the present file
950 for #include "...". (Note that -I. -I- is not the same as
951 the default setup; -I. uses the compiler's working dir.) */
952 if (! opts->ignore_srcdir)
954 opts->ignore_srcdir = 1;
955 opts->pending->quote_head = opts->pending->brack_head;
956 opts->pending->quote_tail = opts->pending->brack_tail;
957 opts->pending->brack_head = 0;
958 opts->pending->brack_tail = 0;
960 else
962 cpp_fatal (pfile, "-I- specified twice");
963 return argc;
966 else
968 char *fname;
969 if (argv[i][2] != 0)
970 fname = argv[i] + 2;
971 else if (i + 1 == argc)
972 goto missing_dirname;
973 else
974 fname = argv[++i];
975 append_include_chain (pfile, opts->pending,
976 xstrdup (fname), BRACKET, 0);
978 break;
980 case 'i':
981 /* Add directory to beginning of system include path, as a system
982 include directory. */
983 if (!strcmp (argv[i], "-isystem"))
985 if (i + 1 == argc)
986 goto missing_filename;
987 append_include_chain (pfile, opts->pending,
988 xstrdup (argv[++i]), SYSTEM, 0);
990 else if (!strcmp (argv[i], "-include"))
992 if (i + 1 == argc)
993 goto missing_filename;
994 else
996 struct pending_option *o = (struct pending_option *)
997 xmalloc (sizeof (struct pending_option));
998 o->arg = argv[++i];
1000 /* This list has to be built in reverse order so that
1001 when cpp_start_read pushes all the -include files onto
1002 the buffer stack, they will be scanned in forward order. */
1003 o->next = opts->pending->include_head;
1004 opts->pending->include_head = o;
1007 else if (!strcmp (argv[i], "-imacros"))
1009 if (i + 1 == argc)
1010 goto missing_filename;
1011 else
1013 struct pending_option *o = (struct pending_option *)
1014 xmalloc (sizeof (struct pending_option));
1015 o->arg = argv[++i];
1016 o->next = NULL;
1018 APPEND (opts->pending, imacros, o);
1021 /* Add directory to end of path for includes,
1022 with the default prefix at the front of its name. */
1023 else if (!strcmp (argv[i], "-iwithprefix"))
1025 char *fname;
1026 int len;
1027 if (i + 1 == argc)
1028 goto missing_dirname;
1029 ++i;
1030 len = strlen (argv[i]);
1032 if (opts->include_prefix != 0)
1034 fname = xmalloc (opts->include_prefix_len + len + 1);
1035 memcpy (fname, opts->include_prefix, opts->include_prefix_len);
1036 memcpy (fname + opts->include_prefix_len, argv[i], len + 1);
1038 else
1040 fname = xmalloc (sizeof GCC_INCLUDE_DIR - 8 + len);
1041 memcpy (fname, GCC_INCLUDE_DIR, sizeof GCC_INCLUDE_DIR - 9);
1042 memcpy (fname + sizeof GCC_INCLUDE_DIR - 9, argv[i], len + 1);
1045 append_include_chain (pfile, opts->pending, fname, SYSTEM, 0);
1047 /* Add directory to main path for includes,
1048 with the default prefix at the front of its name. */
1049 else if (!strcmp (argv[i], "-iwithprefixbefore"))
1051 char *fname;
1052 int len;
1053 if (i + 1 == argc)
1054 goto missing_dirname;
1055 ++i;
1056 len = strlen (argv[i]);
1058 if (opts->include_prefix != 0)
1060 fname = xmalloc (opts->include_prefix_len + len + 1);
1061 memcpy (fname, opts->include_prefix, opts->include_prefix_len);
1062 memcpy (fname + opts->include_prefix_len, argv[i], len + 1);
1064 else
1066 fname = xmalloc (sizeof GCC_INCLUDE_DIR - 8 + len);
1067 memcpy (fname, GCC_INCLUDE_DIR, sizeof GCC_INCLUDE_DIR - 9);
1068 memcpy (fname + sizeof GCC_INCLUDE_DIR - 9, argv[i], len + 1);
1071 append_include_chain (pfile, opts->pending, fname, BRACKET, 0);
1073 /* Add directory to end of path for includes. */
1074 else if (!strcmp (argv[i], "-idirafter"))
1076 if (i + 1 == argc)
1077 goto missing_dirname;
1078 append_include_chain (pfile, opts->pending,
1079 xstrdup (argv[++i]), AFTER, 0);
1081 else if (!strcmp (argv[i], "-iprefix"))
1083 if (i + 1 == argc)
1084 goto missing_filename;
1085 else
1087 opts->include_prefix = argv[++i];
1088 opts->include_prefix_len = strlen (argv[i]);
1091 break;
1093 case 'o':
1094 if (opts->out_fname != NULL)
1096 cpp_fatal (pfile, "Output filename specified twice");
1097 return argc;
1099 if (i + 1 == argc)
1100 goto missing_filename;
1101 opts->out_fname = argv[++i];
1102 if (!strcmp (opts->out_fname, "-"))
1103 opts->out_fname = "";
1104 break;
1106 case 'p':
1107 if (!strcmp (argv[i], "-pedantic"))
1108 opts->pedantic = 1;
1109 else if (!strcmp (argv[i], "-pedantic-errors"))
1111 opts->pedantic = 1;
1112 opts->pedantic_errors = 1;
1114 break;
1116 case 't':
1117 if (!strcmp (argv[i], "-traditional"))
1119 opts->traditional = 1;
1120 opts->cplusplus_comments = 0;
1121 opts->trigraphs = 0;
1122 opts->warn_trigraphs = 0;
1124 else if (!strcmp (argv[i], "-trigraphs"))
1125 opts->trigraphs = 1;
1126 break;
1128 case 'l':
1129 if (! strcmp (argv[i], "-lang-c"))
1130 opts->cplusplus = 0, opts->cplusplus_comments = 1, opts->c89 = 0,
1131 opts->c99 = 1, opts->objc = 0;
1132 if (! strcmp (argv[i], "-lang-c89"))
1134 opts->cplusplus = 0, opts->cplusplus_comments = 0;
1135 opts->c89 = 1, opts->c99 = 0, opts->objc = 0;
1136 opts->trigraphs = 1;
1137 new_pending_define (opts, "__STRICT_ANSI__");
1139 if (! strcmp (argv[i], "-lang-c++"))
1140 opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0,
1141 opts->c99 = 0, opts->objc = 0;
1142 if (! strcmp (argv[i], "-lang-objc"))
1143 opts->cplusplus = 0, opts->cplusplus_comments = 1, opts->c89 = 0,
1144 opts->c99 = 0, opts->objc = 1;
1145 if (! strcmp (argv[i], "-lang-objc++"))
1146 opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0,
1147 opts->c99 = 0, opts->objc = 1;
1148 if (! strcmp (argv[i], "-lang-asm"))
1149 opts->lang_asm = 1;
1150 if (! strcmp (argv[i], "-lang-fortran"))
1151 opts->lang_fortran = 1, opts->cplusplus_comments = 0;
1152 if (! strcmp (argv[i], "-lang-chill"))
1153 opts->objc = 0, opts->cplusplus = 0, opts->chill = 1,
1154 opts->traditional = 1;
1155 break;
1157 case '+':
1158 opts->cplusplus = 1, opts->cplusplus_comments = 1;
1159 break;
1161 case 's':
1162 if (!strcmp (argv[i], "-std=gnu89"))
1164 opts->cplusplus = 0, opts->cplusplus_comments = 1;
1165 opts->c89 = 1, opts->c99 = 0, opts->objc = 0;
1167 else if (!strcmp (argv[i], "-std=gnu9x")
1168 || !strcmp (argv[i], "-std=gnu99"))
1170 opts->cplusplus = 0, opts->cplusplus_comments = 1;
1171 opts->c89 = 0, opts->c99 = 1, opts->objc = 0;
1172 new_pending_define (opts, "__STDC_VERSION__=199901L");
1174 else if (!strcmp (argv[i], "-std=iso9899:1990")
1175 || !strcmp (argv[i], "-std=c89"))
1177 opts->cplusplus = 0, opts->cplusplus_comments = 0;
1178 opts->c89 = 1, opts->c99 = 0, opts->objc = 0;
1179 opts->trigraphs = 1;
1180 new_pending_define (opts, "__STRICT_ANSI__");
1182 else if (!strcmp (argv[i], "-std=iso9899:199409"))
1184 opts->cplusplus = 0, opts->cplusplus_comments = 0;
1185 opts->c89 = 1, opts->c99 = 0, opts->objc = 0;
1186 opts->trigraphs = 1;
1187 new_pending_define (opts, "__STRICT_ANSI__");
1188 new_pending_define (opts, "__STDC_VERSION__=199409L");
1190 else if (!strcmp (argv[i], "-std=iso9899:199x")
1191 || !strcmp (argv[i], "-std=iso9899:1999")
1192 || !strcmp (argv[i], "-std=c9x")
1193 || !strcmp (argv[i], "-std=c99"))
1195 opts->cplusplus = 0, opts->cplusplus_comments = 1;
1196 opts->c89 = 0, opts->c99 = 1, opts->objc = 0;
1197 opts->trigraphs = 1;
1198 new_pending_define (opts, "__STRICT_ANSI__");
1199 new_pending_define (opts, "__STDC_VERSION__=199901L");
1201 break;
1203 case 'w':
1204 opts->inhibit_warnings = 1;
1205 break;
1207 case 'W':
1208 if (!strcmp (argv[i], "-Wtrigraphs"))
1209 opts->warn_trigraphs = 1;
1210 else if (!strcmp (argv[i], "-Wno-trigraphs"))
1211 opts->warn_trigraphs = 0;
1212 else if (!strcmp (argv[i], "-Wcomment"))
1213 opts->warn_comments = 1;
1214 else if (!strcmp (argv[i], "-Wno-comment"))
1215 opts->warn_comments = 0;
1216 else if (!strcmp (argv[i], "-Wcomments"))
1217 opts->warn_comments = 1;
1218 else if (!strcmp (argv[i], "-Wno-comments"))
1219 opts->warn_comments = 0;
1220 else if (!strcmp (argv[i], "-Wtraditional"))
1221 opts->warn_stringify = 1;
1222 else if (!strcmp (argv[i], "-Wno-traditional"))
1223 opts->warn_stringify = 0;
1224 else if (!strcmp (argv[i], "-Wundef"))
1225 opts->warn_undef = 1;
1226 else if (!strcmp (argv[i], "-Wno-undef"))
1227 opts->warn_undef = 0;
1228 else if (!strcmp (argv[i], "-Wimport"))
1229 opts->warn_import = 1;
1230 else if (!strcmp (argv[i], "-Wno-import"))
1231 opts->warn_import = 0;
1232 else if (!strcmp (argv[i], "-Werror"))
1233 opts->warnings_are_errors = 1;
1234 else if (!strcmp (argv[i], "-Wno-error"))
1235 opts->warnings_are_errors = 0;
1236 else if (!strcmp (argv[i], "-Wall"))
1238 opts->warn_trigraphs = 1;
1239 opts->warn_comments = 1;
1241 break;
1243 case 'M':
1244 /* The style of the choices here is a bit mixed.
1245 The chosen scheme is a hybrid of keeping all options in one string
1246 and specifying each option in a separate argument:
1247 -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
1248 -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
1249 -M[M][G][D file]. This is awkward to handle in specs, and is not
1250 as extensible. */
1251 /* ??? -MG must be specified in addition to one of -M or -MM.
1252 This can be relaxed in the future without breaking anything.
1253 The converse isn't true. */
1255 /* -MG isn't valid with -MD or -MMD. This is checked for later. */
1256 if (!strcmp (argv[i], "-MG"))
1258 opts->print_deps_missing_files = 1;
1259 break;
1261 if (!strcmp (argv[i], "-M"))
1262 opts->print_deps = 2;
1263 else if (!strcmp (argv[i], "-MM"))
1264 opts->print_deps = 1;
1265 else if (!strcmp (argv[i], "-MD"))
1266 opts->print_deps = 2;
1267 else if (!strcmp (argv[i], "-MMD"))
1268 opts->print_deps = 1;
1269 /* For -MD and -MMD options, write deps on file named by next arg. */
1270 if (!strcmp (argv[i], "-MD") || !strcmp (argv[i], "-MMD"))
1272 if (i+1 == argc)
1273 goto missing_filename;
1274 opts->deps_file = argv[++i];
1276 else
1278 /* For -M and -MM, write deps on standard output
1279 and suppress the usual output. */
1280 opts->no_output = 1;
1282 break;
1284 case 'd':
1286 char *p = argv[i] + 2;
1287 char c;
1288 while ((c = *p++) != 0)
1290 /* Arg to -d specifies what parts of macros to dump */
1291 switch (c)
1293 case 'M':
1294 opts->dump_macros = dump_only;
1295 opts->no_output = 1;
1296 break;
1297 case 'N':
1298 opts->dump_macros = dump_names;
1299 break;
1300 case 'D':
1301 opts->dump_macros = dump_definitions;
1302 break;
1303 case 'I':
1304 opts->dump_includes = 1;
1305 break;
1309 break;
1311 case 'g':
1312 if (argv[i][2] == '3')
1313 opts->debug_output = 1;
1314 break;
1316 case '-':
1317 if (!strcmp (argv[i], "--help"))
1318 print_help ();
1319 else if (!strcmp (argv[i], "--version"))
1320 fprintf (stderr, _("GNU CPP version %s (cpplib)\n"), version_string);
1321 exit (0); /* XXX */
1322 break;
1324 case 'v':
1325 fprintf (stderr, _("GNU CPP version %s (cpplib)\n"), version_string);
1326 #ifdef TARGET_VERSION
1327 TARGET_VERSION;
1328 #endif
1329 fputc ('\n', stderr);
1330 opts->verbose = 1;
1331 break;
1333 case 'H':
1334 opts->print_include_names = 1;
1335 break;
1337 case 'D':
1339 const char *text;
1340 if (argv[i][2] != 0)
1341 text = argv[i] + 2;
1342 else if (i + 1 == argc)
1344 cpp_fatal (pfile, "Macro name missing after -D option");
1345 return argc;
1347 else
1348 text = argv[++i];
1349 new_pending_define (opts, text);
1351 break;
1353 case 'A':
1355 char *p;
1357 if (argv[i][2] != 0)
1358 p = argv[i] + 2;
1359 else if (i + 1 == argc)
1361 cpp_fatal (pfile, "Assertion missing after -A option");
1362 return argc;
1364 else
1365 p = argv[++i];
1367 if (strcmp (p, "-"))
1369 struct pending_option *o = (struct pending_option *)
1370 xmalloc (sizeof (struct pending_option));
1372 o->arg = p;
1373 o->next = NULL;
1374 o->undef = 0;
1375 APPEND (opts->pending, assert, o);
1377 else
1379 /* -A- eliminates all predefined macros and assertions.
1380 Let's include also any that were specified earlier
1381 on the command line. That way we can get rid of any
1382 that were passed automatically in from GCC. */
1383 struct pending_option *o1, *o2;
1385 o1 = opts->pending->define_head;
1386 while (o1)
1388 o2 = o1->next;
1389 free (o1);
1390 o1 = o2;
1392 o1 = opts->pending->assert_head;
1393 while (o1)
1395 o2 = o1->next;
1396 free (o1);
1397 o1 = o2;
1399 opts->pending->assert_head = NULL;
1400 opts->pending->assert_tail = NULL;
1401 opts->pending->define_head = NULL;
1402 opts->pending->define_tail = NULL;
1405 break;
1407 case 'U':
1409 struct pending_option *o = (struct pending_option *)
1410 xmalloc (sizeof (struct pending_option));
1412 if (argv[i][2] != 0)
1413 o->arg = argv[i] + 2;
1414 else if (i + 1 == argc)
1416 cpp_fatal (pfile, "Macro name missing after -U option");
1417 return argc;
1419 else
1420 o->arg = argv[++i];
1422 o->next = NULL;
1423 o->undef = 1;
1424 APPEND (opts->pending, define, o);
1426 break;
1428 case 'C':
1429 opts->discard_comments = 0;
1430 break;
1432 case 'E': /* -E comes from cc -E; ignore it. */
1433 break;
1435 case 'P':
1436 opts->no_line_commands = 1;
1437 break;
1439 case '$': /* Don't include $ in identifiers. */
1440 opts->dollars_in_ident = 0;
1441 break;
1443 case 'n':
1444 if (!strcmp (argv[i], "-nostdinc"))
1445 /* -nostdinc causes no default include directories.
1446 You must specify all include-file directories with -I. */
1447 opts->no_standard_includes = 1;
1448 else if (!strcmp (argv[i], "-nostdinc++"))
1449 /* -nostdinc++ causes no default C++-specific include directories. */
1450 opts->no_standard_cplusplus_includes = 1;
1451 break;
1453 case 'r':
1454 if (!strcmp (argv[i], "-remap"))
1455 opts->remap = 1;
1456 break;
1458 case '\0': /* JF handle '-' as file name meaning stdin or stdout */
1459 if (opts->in_fname == NULL)
1460 opts->in_fname = "";
1461 else if (opts->out_fname == NULL)
1462 opts->out_fname = "";
1463 else
1464 return i; /* error */
1465 break;
1467 default:
1468 return i;
1471 return i + 1;
1473 missing_filename:
1474 cpp_fatal (pfile, "Filename missing after `%s' option", argv[i]);
1475 return argc;
1476 missing_dirname:
1477 cpp_fatal (pfile, "Directory name missing after `%s' option", argv[i]);
1478 return argc;
1481 /* Handle command-line options in (argc, argv).
1482 Can be called multiple times, to handle multiple sets of options.
1483 Returns if an unrecognized option is seen.
1484 Returns number of strings consumed. */
1487 cpp_handle_options (pfile, argc, argv)
1488 cpp_reader *pfile;
1489 int argc;
1490 char **argv;
1492 int i;
1493 int strings_processed;
1494 for (i = 0; i < argc; i += strings_processed)
1496 strings_processed = cpp_handle_option (pfile, argc - i, argv + i);
1497 if (strings_processed == 0)
1498 break;
1500 return i;
1503 static void
1504 print_help ()
1506 fprintf (stderr, _("Usage: %s [switches] input output\n"), progname);
1507 fputs (_("\
1508 Switches:\n\
1509 -include <file> Include the contents of <file> before other files\n\
1510 -imacros <file> Accept definition of macros in <file>\n\
1511 -iprefix <path> Specify <path> as a prefix for next two options\n\
1512 -iwithprefix <dir> Add <dir> to the end of the system include path\n\
1513 -iwithprefixbefore <dir> Add <dir> to the end of the main include path\n\
1514 -isystem <dir> Add <dir> to the start of the system include path\n\
1515 -idirafter <dir> Add <dir> to the end of the system include path\n\
1516 -I <dir> Add <dir> to the end of the main include path\n\
1517 -nostdinc Do not search system include directories\n\
1518 (dirs specified with -isystem will still be used)\n\
1519 -nostdinc++ Do not search system include directories for C++\n\
1520 -o <file> Put output into <file>\n\
1521 -pedantic Issue all warnings demanded by strict ANSI C\n\
1522 -traditional Follow K&R pre-processor behaviour\n\
1523 -trigraphs Support ANSI C trigraphs\n\
1524 -lang-c Assume that the input sources are in C\n\
1525 -lang-c89 Assume that the input sources are in C89\n\
1526 -lang-c++ Assume that the input sources are in C++\n\
1527 -lang-objc Assume that the input sources are in ObjectiveC\n\
1528 -lang-objc++ Assume that the input sources are in ObjectiveC++\n\
1529 -lang-asm Assume that the input sources are in assembler\n\
1530 -lang-fortran Assume that the input sources are in Fortran\n\
1531 -lang-chill Assume that the input sources are in Chill\n\
1532 -std=<std name> Specify the conformance standard; one of:\n\
1533 gnu89, gnu99, c89, c99, iso9899:1990,\n\
1534 iso9899:199409, iso9899:1999\n\
1535 -+ Allow parsing of C++ style features\n\
1536 -w Inhibit warning messages\n\
1537 -Wtrigraphs Warn if trigraphs are encountered\n\
1538 -Wno-trigraphs Do not warn about trigraphs\n\
1539 -Wcomment{s} Warn if one comment starts inside another\n\
1540 -Wno-comment{s} Do not warn about comments\n\
1541 -Wtraditional Warn if a macro argument is/would be turned into\n\
1542 a string if -traditional is specified\n\
1543 -Wno-traditional Do not warn about stringification\n\
1544 -Wundef Warn if an undefined macro is used by #if\n\
1545 -Wno-undef Do not warn about testing undefined macros\n\
1546 -Wimport Warn about the use of the #import directive\n\
1547 -Wno-import Do not warn about the use of #import\n\
1548 -Werror Treat all warnings as errors\n\
1549 -Wno-error Do not treat warnings as errors\n\
1550 -Wall Enable all preprocessor warnings\n\
1551 -M Generate make dependencies\n\
1552 -MM As -M, but ignore system header files\n\
1553 -MD As -M, but put output in a .d file\n\
1554 -MMD As -MD, but ignore system header files\n\
1555 -MG Treat missing header file as generated files\n\
1556 -g Include #define and #undef directives in the output\n\
1557 -D<macro> Define a <macro> with string '1' as its value\n\
1558 -D<macro>=<val> Define a <macro> with <val> as its value\n\
1559 -A<question> (<answer>) Assert the <answer> to <question>\n\
1560 -U<macro> Undefine <macro> \n\
1561 -v Display the version number\n\
1562 -H Print the name of header files as they are used\n\
1563 -C Do not discard comments\n\
1564 -dM Display a list of macro definitions active at end\n\
1565 -dD Preserve macro definitions in output\n\
1566 -dN As -dD except that only the names are preserved\n\
1567 -dI Include #include directives in the output\n\
1568 -P Do not generate #line directives\n\
1569 -$ Do not allow '$' in identifiers\n\
1570 -remap Remap file names when including files.\n\
1571 -h or --help Display this information\n\
1572 "), stdout);