Article View: gnu.gcc.help
Article #52200Re: SCCS strings embedded in code with -Wall
From: Mike Parma
Date: Mon, 18 Jan 1993 17:15
Date: Mon, 18 Jan 1993 17:15
33 lines
2080 bytes
2080 bytes
In article <bkFYsLbr@twinsun.com> eggert@twinsun.com (Paul Eggert) writes:
>parma@sophie.ct.picker.com (Michael J. Parma) writes:
>
>>'-Wall' causes the a warning about an unused variable.
>>We don't want _any_ warning messages if we can help it....
>>Something that works on any standard compiler would be welcomed
>
>The easiest way to prevent the warning is to use the variable. E.g.
>
> static char rcsid[] = "$Id: ... $";
> print_version() { printf("version: %s\n", rcsid); }
>
>This works with any standard-conforming compiler.
>Some compilers remove `rcsid' from the object file if it's not referenced;
>you really must use rcsid if you want it to remain in the object file.
>So GCC's warning is useful.
The problem with the above solution is that now 'print_version' is
a global function that might conflict with another '.c' file that
contained the same construct. This is not much different from removing
the 'static' declaration from 'rcsid'. And of course if you declare
'print_version' as 'static' then the function is not used :).
I realize that 'pragma' means non-standard, but :) is there a 'common'
one used for the above. On an SVR3 system I've seen '#ident' for what
I want. On an SVR4 system I saw '#pragma ident'. If there was a pragma
included in GCC to do such a thing then I could always '#ifdef __GNUC__'
and get the warning everywhere else. I might be able to live with
that.
Thanks,
Mike Parma
parma@ct.picker.com
Technical Details
Message-ID:
<1993Jan18.171516.19966@picker.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!malgudi.oar.net!picker!parmaReferences:
<1993Jan15.201556.9105@picker.com> <bkFYsLbr@twinsun.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,cb44527f7ddf772a X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-01-19 02:47:55 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!malgudi.oar.net!picker!parma From: parma@picker.com (Mike Parma) Subject: Re: SCCS strings embedded in code with -Wall Message-ID: <1993Jan18.171516.19966@picker.com> Organization: Picker International, Inc. References: <1993Jan15.201556.9105@picker.com> <bkFYsLbr@twinsun.com> Distribution: na Date: Mon, 18 Jan 1993 17:15:16 GMT Lines: 34