[PATCH] Bulletproofing -fsyntax-only, round 2 (extra armour plate)

Nix nix@esperi.demon.co.uk
Sat Aug 5 11:49:00 GMT 2000


Jeffrey A Law writes:
> In message <87puplee5m.fsf@loki.wkstn.nix>you write:
> > 2000-06-13  Nix  <nix@esperi.demon.co.uk>
> > 
> > 	* 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.
> > 
> > 	* toplev.c: (ax_delete_temporaries): New function.
> > 	(main): Register it with atexit().
> > 	(compile_file): Point the asm_out_file at HOST_BIT_BUCKET (if
> > 	accessible) or a temporary file when -fsyntax-only is on, not at
> > 	NULL.  Close it even if -fsyntax-only is on.
> > 	* protoize.c (munge_compile_params): Use HOST_BIT_BUCKET instead
> > 	of hardcoded value.
> > 
> > 	* gcc.c, config/i386/xm-dos.h, config/i386/xm-os2.h: Kill
> > 	MKTEMP_EACH_FILE.
> > 
> > 	* gcc.c, ch/lang-specs.h, cp/lang-specs.h, f/lang-specs.h,
> > 	java/lang-specs.h, objc/lang-specs.h: Do not process -o or
> > 	run the assembler if -fsyntax-only.
> You need to make a few more changes.
> 
> First, I'm not sure it's actually safe to use atexit -- and I don't see
> how using it significantly simplifies this code anyway.  Just call your
> cleanup routine just before toplev.c::main exits.

What do we do about the (many) other places in GCC that may exit, and
assertions, &c? We have to decorate all of them, too, or use
atexit(). So it makes this code simpler by dividing the size of this
patch by about ten :)

After the diagnostics changes are complete, there may be fewer such exit
points, but I can't see how even they will make assertions go away.

> You had other changes mixed into your patch -- specifically you removed
> all the MKTEMP_EACH_FILE code.  Was that intentional? 

I removed the code path where that was turned off, yes; it's in the
changelog entry :). As near as I can tell the MKTEMP_EACH_FILE-is-off
code path is dead, never tested these days, and likely rotted, ever
since your change of 1998:

Sat Jun 27 01:35:14 1998  Jeffrey A Law  (law@cygnus.com)

	* choose-temp.c (choose_temp_base): Remove MPW bits.  Use mkstemp
	instead of mktemp.
	* gcc.c (MKTEMP_EACH_FILE): Define.

: /* We want this on by default all the time now.  */

I think two-years-dead code deserves to be removed :)

(Finally, turning MKTEMP_EACH_FILE off on many platforms would cause
huge sucking security holes.)

> You need to update the documentation to include documentation for 
> HOST_BIT_BUCKET.

Agreed.

> I think you need to make those changes and resubmit.

I will strip out the specs changes, too, because Zack has done the same
thing already.

-- 
`I am of the belief that catnip arrived on the planet in the same spaceship
 that delivered cats. It is the only thing they have from their home
 planet. Tuna, chicken, sparrow-brains, etc., these are all things of our
 world that they like, but catnip is crack from home.' --- Bill Cole


More information about the Gcc-patches mailing list