+2001-01-11 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cppinit.c (cpp_start_read): If -fpreprocessed, ignore
+ -D, -U and -A, and don't initialize the builtins.
+ * cppmain.c (cb_define, cb_undef): Unconditionally process
+ the callback.
+ * tradcpp.c (main): Fix typo.
+
+2000-01-11 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * cppfiles.c (cpp_included, find_include_file, _cpp_execute_include)
+ (read_name_map): Use IS_ABSOLUTE_PATH.
+ * tradcpp.c (get_filename): Likewise.
+
2001-01-11 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.md (*adcq, *subcq): Fix operand numbers.
char *name;
splay_tree_node nd;
- if (fname[0] == '/')
+ if (IS_ABSOLUTE_PATHNAME (fname))
{
/* Just look it up. */
nd = splay_tree_lookup (pfile->all_include_files, (splay_tree_key) fname);
char *name;
struct include_file *file;
- if (fname[0] == '/')
+ if (IS_ABSOLUTE_PATHNAME (fname))
return open_file (pfile, fname);
/* Search directory path for the file. */
if (CPP_OPTION (pfile, print_deps_missing_files)
&& PRINT_THIS_DEP (pfile, angle_brackets))
{
- if (!angle_brackets || *fname == '/')
+ if (!angle_brackets || IS_ABSOLUTE_PATHNAME (fname))
deps_add_dep (pfile->deps, fname);
else
{
ptr->map_from = from;
/* Make the real filename absolute. */
- if (*to == '/')
+ if (IS_ABSOLUTE_PATHNAME (to))
ptr->map_to = to;
else
{
{
struct pending_option *q;
- /* Later: maybe update this to use the #include "" search path
- if cpp_read_file fails. */
- if (_cpp_read_file (pfile, p->arg) && scan)
+ /* Don't handle if -fpreprocessed. Later: maybe update this to
+ use the #include "" search path if cpp_read_file fails. */
+ if (! CPP_OPTION (pfile, preprocessed))
+ cpp_error (pfile, "-include and -imacros cannot be used with -fpreprocessed");
+ else if (_cpp_read_file (pfile, p->arg) && scan)
cpp_scan_buffer_nooutput (pfile, 0);
q = p->next;
free (p);
}
}
-/* This is called after options have been processed. Check options
- for consistency, and setup for processing input from the file named
- FNAME. (Use standard input if FNAME == NULL.) Return 1 on success,
- 0 on failure. */
+/* This is called after options have been processed. Setup for
+ processing input from the file named FNAME. (Use standard input if
+ FNAME == NULL.) Return 1 on success, 0 on failure. */
int
cpp_start_read (pfile, fname)
if (!_cpp_read_file (pfile, fname))
return 0;
- /* Install __LINE__, etc. */
- init_builtins (pfile);
+ /* If already preprocessed, don't install __LINE__, etc., and ignore
+ command line definitions and assertions. Handle -U's, -D's and
+ -A's in the order they were seen. */
+ if (! CPP_OPTION (pfile, preprocessed))
+ init_builtins (pfile);
- /* Do -U's, -D's and -A's in the order they were seen. */
p = CPP_OPTION (pfile, pending)->directive_head;
while (p)
{
- (*p->handler) (pfile, p->arg);
+ if (! CPP_OPTION (pfile, preprocessed))
+ (*p->handler) (pfile, p->arg);
q = p->next;
free (p);
p = q;
}
+
pfile->done_initializing = 1;
/* The -imacros files can be scanned now, but the -include files
command-line matches. Returns its index in the option array,
negative on failure. Complications arise since some options can be
suffixed with an argument, and multiple complete matches can occur,
- e.g. -iwithprefix and -iwithprefixbefore. Moreover, we want to
- accept options beginning with -g and -W that we do not recognise,
- but not to swallow any subsequent command line argument; these are
- handled as special cases in cpp_handle_option. */
+ e.g. -iwithprefix and -iwithprefixbefore. Moreover, we need to
+ accept options beginning with -W that we do not recognise, but not
+ to swallow any subsequent command line argument; this is handled as
+ special cases in cpp_handle_option. */
static int
parse_option (input)
const char *input;
cpp_reader *pfile;
cpp_hashnode *node;
{
- if (pfile->done_initializing)
- {
- maybe_print_line (cpp_get_line (pfile)->output_line);
- fprintf (print.outf, "#define %s", node->name);
+ maybe_print_line (cpp_get_line (pfile)->output_line);
+ fprintf (print.outf, "#define %s", node->name);
- /* -dD command line option. */
- if (CPP_OPTION (pfile, dump_macros) == dump_definitions)
- fputs ((const char *) cpp_macro_definition (pfile, node), print.outf);
+ /* -dD command line option. */
+ if (CPP_OPTION (pfile, dump_macros) == dump_definitions)
+ fputs ((const char *) cpp_macro_definition (pfile, node), print.outf);
- putc ('\n', print.outf);
- print.lineno++;
- }
+ putc ('\n', print.outf);
+ print.lineno++;
}
static void
cpp_reader *pfile;
cpp_hashnode *node;
{
- if (pfile->done_initializing)
- {
- maybe_print_line (cpp_get_line (pfile)->output_line);
- fprintf (print.outf, "#undef %s\n", node->name);
- print.lineno++;
- }
+ maybe_print_line (cpp_get_line (pfile)->output_line);
+ fprintf (print.outf, "#undef %s\n", node->name);
+ print.lineno++;
}
static void
int quoted = argv[i][2] == 'Q';
if (*tgt == '\0' && i + 1 == argc)
- fatal ("Filename missing after %s option", argv[i]);
+ fatal ("Target missing after %s option", argv[i]);
else
{
if (*tgt == '\0')
/* If specified file name is absolute, just open it. */
- if (*fbeg == '/') {
+ if (IS_ABSOLUTE_PATHNAME (fbeg)) {
strncpy (fname, (const char *)fbeg, flen);
fname[flen] = 0;
f = open (fname, O_RDONLY, 0666);
else
stackp = include;
- if (!system_header_p || *fbeg == '/' || !stackp->fname)
+ if (!system_header_p || IS_ABSOLUTE_PATHNAME (fbeg) || !stackp->fname)
deps_add_dep (deps, fname);
else {
char *p;