This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC warnings for unused global variables


Kean Johnston wrote:

Or even better, __attribute__((used)).  If he fails to do this,
then at some point GCC will stop emitting that variable to the
object file entirely, precisely because it isn't used.

THAT would be blatantly wrong. It means the compiler assumes it knows more about how things may be used than the human who wrote them does. Just because the source module doesn't use a variable, *EVEN IF ITS MARKED static* does NOT mean it is unused by other things, for example, object file analysys tools like "what".
then is should be volatile
	static const volatile rcsid[] = "my file";

not that this helps dusty decks ...

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]