diff options
author | Jeff Law <law@gcc.gnu.org> | 2000-08-21 12:01:51 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2000-08-21 12:01:51 -0600 |
commit | 49009afdf737a82926f3f3a245508ef6db51c33e (patch) | |
tree | cb0efe07a757f09a75c26e74d5e3d29b0e63d2fa /gcc/gcc.c | |
parent | dc13bad72b60849788b55675d3ded5674b7dbdc8 (diff) | |
download | gcc-49009afdf737a82926f3f3a245508ef6db51c33e.zip gcc-49009afdf737a82926f3f3a245508ef6db51c33e.tar.gz gcc-49009afdf737a82926f3f3a245508ef6db51c33e.tar.bz2 |
gcc.c (do_spec_1): Implement %j spec flag.
* gcc.c (do_spec_1): Implement %j spec flag.
Remove dead comment.
* gcc.texi (The Configuration File): Document HOST_BIT_BUCKET.
* system.h (HOST_BIT_BUCKET): Default to "/dev/null".
* config/i386/xm-dos.h (HOST_BIT_BUCKET): Define as "NUL".
* config/i386/xm-os2.h, config/winnt/winnt.h: Likewise.
* protoize.c (munge_compile_params): Use HOST_BIT_BUCKET (if
writable) instead of hardcoded value.
* toplev.c (compile_file): Output to a file even if -fsyntax-only.
* gcc.c, config/i386/xm-dos.h, config/i386/xm-os2.h: Kill
MKTEMP_EACH_FILE.
* gcc.c (cc1_options): Do not process -o or
run the assembler if -fsyntax-only.
From-SVN: r35849
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 84 |
1 files changed, 40 insertions, 44 deletions
@@ -292,6 +292,12 @@ or with constant text in a single argument. for each `%g.s' and another for each `%U.s'. Previously, %U was simply substituted with a file name chosen for the previous %u, without regard to any appended suffix. + %jSUFFIX + substitutes the name of the HOST_BIT_BUCKET, if any, and if it is + writable, and if save-temps is off; otherwise, substitute the name + of a temporary file, just like %u. This temporary file is not + meant for communication between processes, but rather as a junk + disposal mechanism. %d marks the argument containing or following the %d as a temporary file name, so that that file will be deleted if CC exits successfully. Unlike %g, this contributes no text to the argument. @@ -571,7 +577,8 @@ static const char *cc1_options = %{g*} %{O*} %{W*} %{w} %{pedantic*} %{std*} %{ansi}\ %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\ %{aux-info*} %{Qn:-fno-ident} %{--help:--help}\ - %{S:%W{o*}%{!o*:-o %b.s}}"; + %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\ + %{fsyntax-only:-o %j}"; static const char *asm_options = "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}"; @@ -690,13 +697,13 @@ static struct compiler default_compilers[] = #if USE_CPPLIB "%{E|M|MM:cpp0 -lang-c %{ansi:-std=c89} %(cpp_options)}\ %{!E:%{!M:%{!MM:cc1 -lang-c %{ansi:-std=c89} %(cpp_options)\ - %(cc1_options) %{!S:-o %{|!pipe:%g.s} |\n\ - as %(asm_options) %{!pipe:%g.s} %A }}}}" + %(cc1_options) %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\ + as %(asm_options) %{!pipe:%g.s} %A }}}}}" #else /* ! USE_CPPLIB */ "%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options) \ %{!M:%{!MM:%{!E:%{!pipe:%g.i} |\n\ - cc1 %{!pipe:%g.i} %(cc1_options) %{!S:-o %{|!pipe:%g.s} |\n\ - as %(asm_options) %{!pipe:%g.s} %A }}}}\n" + cc1 %{!pipe:%g.i} %(cc1_options) %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\ + as %(asm_options) %{!pipe:%g.s} %A }}}}}\n" #endif /* ! USE_CPPLIB */ }, {"-", @@ -709,8 +716,8 @@ static struct compiler default_compilers[] = {".i", "@cpp-output"}, {"@cpp-output", "%{!M:%{!MM:%{!E:\ - cc1 %i %(cc1_options) %{!S:-o %{|!pipe:%g.s} |\n\ - as %(asm_options) %{!pipe:%g.s} %A }}}}"}, + cc1 %i %(cc1_options) %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\ + as %(asm_options) %{!pipe:%g.s} %A }}}}}"}, {".s", "@assembler"}, {"@assembler", "%{!M:%{!MM:%{!E:%{!S:as %(asm_options) %i %A }}}}"}, @@ -1226,13 +1233,9 @@ static int argbuf_length; static int argbuf_index; -/* We want this on by default all the time now. */ -#define MKTEMP_EACH_FILE - -#ifdef MKTEMP_EACH_FILE - -/* This is the list of suffixes and codes (%g/%u/%U) and the associated - temp file. */ +/* This is the list of suffixes and codes (%g/%u/%U/%j) and the associated + temp file. If the HOST_BIT_BUCKET is used for %j, no entry is made for + it here. */ static struct temp_name { const char *suffix; /* suffix associated with the code. */ @@ -1242,8 +1245,6 @@ static struct temp_name { int filename_length; /* strlen (filename). */ struct temp_name *next; } *temp_names; -#endif - /* Number of commands executed so far. */ @@ -1681,7 +1682,7 @@ read_specs (filename, main_p) /* This is the common prefix we use to make temp file names. It is chosen once for each run of this program. - It is substituted into a spec by %g. + It is substituted into a spec by %g or %j. Thus, all temp file names contain this prefix. In practice, all temp file names start with this prefix. @@ -3973,6 +3974,26 @@ do_spec_1 (spec, inswitch, soft_matched_part) } break; + case 'j': + { + struct stat st; + + /* If save_temps_flag is off, and the HOST_BIT_BUCKET is defined, + and it is not a directory, and it is writable, use it. + Otherwise, fall through and treat this like any other + temporary file. */ + + if ((!save_temps_flag) + && (stat (HOST_BIT_BUCKET, &st) == 0) && (!S_ISDIR (st.st_mode)) + && (access (HOST_BIT_BUCKET, W_OK) == 0)) + { + obstack_grow (&obstack, HOST_BIT_BUCKET, + strlen (HOST_BIT_BUCKET)); + delete_this_arg = 0; + arg_going = 1; + break; + } + } case 'g': case 'u': case 'U': @@ -3983,11 +4004,6 @@ do_spec_1 (spec, inswitch, soft_matched_part) } else { -#ifdef MKTEMP_EACH_FILE - /* ??? This has a problem: the total number of - values mktemp can return is limited. - That matters for the names of object files. - In 2.4, do something about that. */ struct temp_name *t; int suffix_length; const char *suffix = p; @@ -4024,8 +4040,8 @@ do_spec_1 (spec, inswitch, soft_matched_part) && t->unique == (c != 'g')) break; - /* Make a new association if needed. %u requires one. */ - if (t == 0 || c == 'u') + /* Make a new association if needed. %u and %j require one. */ + if (t == 0 || c == 'u' || c == 'j') { if (t == 0) { @@ -4047,19 +4063,6 @@ do_spec_1 (spec, inswitch, soft_matched_part) obstack_grow (&obstack, t->filename, t->filename_length); delete_this_arg = 1; -#else - obstack_grow (&obstack, temp_filename, temp_filename_length); - if (c == 'u' || c == 'U') - { - static int unique; - char buff[9]; - if (c == 'u') - unique++; - sprintf (buff, "%d", unique); - obstack_grow (&obstack, buff, strlen (buff)); - } -#endif - delete_this_arg = 1; } arg_going = 1; break; @@ -5196,13 +5199,6 @@ main (argc, argv) putenv (INIT_ENVIRONMENT); #endif - /* Choose directory for temp files. */ - -#ifndef MKTEMP_EACH_FILE - temp_filename = choose_temp_base (); - temp_filename_length = strlen (temp_filename); -#endif - /* Make a table of what switches there are (switches, n_switches). Make a table of specified input files (infiles, n_infiles). Decode switches that are handled locally. */ |