From owner-freebsd-hackers Sat Oct 21 23:29:46 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id XAA26749 for hackers-outgoing; Sat, 21 Oct 1995 23:29:46 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id XAA26744 for ; Sat, 21 Oct 1995 23:29:42 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id QAA22831; Sun, 22 Oct 1995 16:27:01 +1000 Date: Sun, 22 Oct 1995 16:27:01 +1000 From: Bruce Evans Message-Id: <199510220627.QAA22831@godzilla.zeta.org.au> To: pst@shockwave.com, swallace@ece.uci.edu Subject: Re: SYSCALL IDEAS [Was: cvs commit: src/sys/kern sysv_msg.c sysv_sem.c sysv_shm.c] Cc: CVS-commiters@freefall.freebsd.org, bde@freefall.freebsd.org, cvs-sys@freefall.freebsd.org, hackers@freebsd.org Sender: owner-hackers@freebsd.org Precedence: bulk >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