Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Oct 1995 16:27:01 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        pst@shockwave.com, swallace@ece.uci.edu
Cc:        CVS-commiters@freefall.freebsd.org, bde@freefall.freebsd.org, cvs-sys@freefall.freebsd.org, hackers@freebsd.org
Subject:   Re: SYSCALL IDEAS [Was: cvs commit: src/sys/kern sysv_msg.c sysv_sem.c sysv_shm.c]
Message-ID:  <199510220627.QAA22831@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>While I realize this is a bit against the philosophy that some of the
>team members hold,  which is that we should not rely on gcc-type
>functionality, I'd actually prefer to see things like SCARG and
>prototype-glue done as static inlines where appropriate.

4.4lite already uses `static inline' extensively for vnode ops.  I'd
still like everything to work on non-gcc compilers.  When `static' is
defined to nothing, `static inline' should at most waste a lot of space
and a little time...

>The reason
>being is that with a static inline, as you can enforce type checking
>with:

>	static inline struct rntype *
>	rt2rn (struct rttype *rt)
>	{
>		return (rntype *) rt;
>	}

>as opposed to

>	#define RT2RN(x) ((rntype *) (x))

..or waste a lot of time if a lot of little functions like that aren't
inlined :-).

I would call that defeating type checking.  You'll only get a warning if
x has an incompatible type, not for the bogus cast.  For syscall args I
want something more like:

	static inline struct rntype *
	rt2rn (struct rttype *rt)
	{
		/*
		 * Machine generated code to do the conversion.
		 * Do not edit.
		 */
#ifdef rt2rn_type_pun_works
		return (rntype *) rt;
#else
		struct rntype rn = somealloc(sizeof *rn);
		rn->rn_foo = rt->rt_foo;
		rn->rn_bar = rt->rt_bar;
		return rn;
#endif
	}

>* every time you use the register tag, your're strongly encouraging
>  gcc to reserve a register for use by that variable.  gcc, unlike pcc,
>  already understands when it should and shouldn't use registers and
>  can do this far better than we can,  so it's a bad idea to hamstring

I don't think use of `register' makes any difference for gcc for variables
that can go in registers (i.e., auto variables whose address isn't taken).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510220627.QAA22831>