GCC warnings for unused global variables
cgd@broadcom.com
cgd@broadcom.com
Thu May 1 17:44:00 GMT 2003
At Thu, 1 May 2003 17:24:20 +0000 (UTC), "Joe Buck" wrote:
> (I believe you are, in effect, asking the BSD folks to change
> *every single file* in their operating system, or else live with vast
> numbers of warnings), but it's better still not to require any change.
I agree that forcing people to change their code would be a real
bummer. (IMO, the put-zero-initialized-data-in-bss was a
similarly-losing change. 8-)
FYI, some of "the BSD folks" have already made substantial changes
w.r.t. these markings, e.g. in NetBSD we do:
#include <sys/cdefs.h>
...
__COPYRIGHT(
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n");
...
__RCSID("$NetBSD: cat.c,v 1.35 2002/09/13 18:07:52 thorpej Exp $");
...
That lets us neatly handle multiple object formats easily while still
using features like placing the strings in non-loaded sections when
using ELF. ("Why waste the RAM?" 8-) It also means that we can apply
(have applied!) __attribute__((__unused__)) nearly everywhere fairly
easily.
chris
More information about the Gcc
mailing list