home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / gcc / help / 2992 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.6 KB  |  44 lines

  1. Newsgroups: gnu.gcc.help
  2. Path: sparky!uunet!paladin.american.edu!gatech!destroyer!ncar!csn!news.den.mmc.com!traffic!kevin
  3. From: kevin@traffic.den.mmc.com (Kevin Rodgers)
  4. Subject: Re: SCCS strings embedded in code with -Wall
  5. Message-ID: <1993Jan21.195955.598@den.mmc.com>
  6. Sender: news@den.mmc.com (News)
  7. Nntp-Posting-Host: traffic.den.mmc.com
  8. Organization: Martin Marietta Western Internal Systems, Technical Operations
  9. References: <1993Jan15.201556.9105@picker.com> <bkFYsLbr@twinsun.com>
  10. Distribution: na
  11. Date: Thu, 21 Jan 1993 19:59:55 GMT
  12. Lines: 30
  13.  
  14. In article <bkFYsLbr@twinsun.com> eggert@twinsun.com (Paul Eggert) writes:
  15. >parma@sophie.ct.picker.com (Michael J. Parma) writes:
  16. >
  17. >>'-Wall' causes the a warning about an unused variable.
  18. >>We don't want _any_ warning messages if we can help it....
  19. >>Something that works on any standard compiler would be welcomed
  20. >
  21. >The easiest way to prevent the warning is to use the variable.  E.g.
  22. >
  23. >    static char rcsid[] = "$Id: ... $";
  24. >    print_version() { printf("version: %s\n", rcsid); }
  25.  
  26. print_version() should probably be declared static.
  27.  
  28. >Some compilers remove `rcsid' from the object file if it's not referenced;
  29. >you really must use rcsid if you want it to remain in the object file.
  30.  
  31. Yuck.  What about rcs_id, sccsid, sccs_id, etc.?
  32.  
  33. >So GCC's warning is useful.
  34.  
  35. I would suggest that an unused variable warning is inappropriate if the
  36. variable has been initialized, at least if it is declared to be static.
  37.  
  38. (Should this be moved to gnu.gcc.bug?)
  39. -- 
  40. Kevin Rodgers                kevin@traffic.den.mmc.com
  41. Martin Marietta MS A16401        (303) 790-3971
  42. 116 Inverness Dr. East
  43. Englewood CO 80112 USA            GO BUFFS!
  44.