From owner-freebsd-current Wed Dec 6 11:05:00 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id LAA10794 for current-outgoing; Wed, 6 Dec 1995 11:05:00 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id LAA10783 for ; Wed, 6 Dec 1995 11:04:56 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id FAA31752; Thu, 7 Dec 1995 05:58:15 +1100 Date: Thu, 7 Dec 1995 05:58:15 +1100 From: Bruce Evans Message-Id: <199512061858.FAA31752@godzilla.zeta.org.au> To: bde@zeta.org.au, phk@critter.tfs.com Subject: Re: changes in -current..TEST please Cc: current@freebsd.org, imb@scgt.oz.au, julian@ref.tfs.com, terry@lambert.org Sender: owner-current@freebsd.org Precedence: bulk >> >If you used up to date source, you would know that the above macro now >> >looks like this: >> >> > #define MAKE_SET(set, sym, type) \ >> > static void *const __set_##set##_sym_##sym = \ >> > (&__set_##set##_sym_##sym, &sym, 0); \ >> > asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym) >> >> >and that it (according to the gcc manual) ensures that the compiler will >> >not remove your static and "secretly" referenced Symbols. >> >> The macro only tells the compiler about `sym'. `type' is only referenced >> in the stab. >type isn't an endangered species I think... Oops. The manual only seems to say that the above stops the warning. gcc-2.7 has a better method: static void dummy_cleanup(void) __attribute__((__unused__)); This stops the warning but doesn't stop dummy_cleanup() going away with -O3 any better than MAKE_SET() (it goes away because it becomes static inline. static inlines _should_ go away). Why not initialize a pointer to the function? Then the function address _is_ used provided the pointer doesn't go away. Why does the comma expression end with an 0 anyway? The following seems to work right (except it wastes a pointer): static void (*const foo)(void) = dummy_cleanup; Bruce