home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / gcc / bug / 3034 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.6 KB  |  65 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!wrc.xerox.COM!leisner
  3. From: leisner@wrc.xerox.COM ( Marty Leisner)
  4. Subject: Inlining varargs functions
  5. Message-ID: <1992Dec21.151845.2007@spectrum.xerox.com>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: leisner@eso.mc.xerox.com
  8. Organization: Xerox
  9. Distribution: gnu
  10. Date: Mon, 21 Dec 1992 15:18:45 GMT
  11. Approved: bug-gcc@prep.ai.mit.edu
  12. Lines: 51
  13.  
  14. I want to write code like this:
  15. #ifndef DEBUG_TRACE 
  16. static void inline test_args()
  17. {
  18. }
  19. #else
  20. static void debug_trace( char *fmt, ...)
  21. {
  22.         va_list args;
  23.  
  24.         va_start(args, fmt);
  25.  
  26.         vfprintf(stderr, fmt, args);
  27.  
  28.         va_end(args);
  29. }
  30. #endif
  31.  
  32.  
  33. where I have debug calls sprinkled in my code like:
  34.         debug_trace("writing %x = %d\n", address, word);
  35.  
  36. I've never seen a clean way to do this (normally, it results in a series of macros, where
  37. each macro has a certain number of arguments, etc...)
  38.  
  39. When I don't want debugging, a function appears, its null, and the compiler should be smart
  40. enough to just leave it out...
  41.  
  42. In integrate.c, there's a function:
  43. /* Zero if the current function (whose FUNCTION_DECL is FNDECL)
  44.    is safe and reasonable to integrate into other functions.
  45.    Nonzero means value is a warning message with a single %s
  46.    for the function's name.  */
  47.  
  48. char *
  49. function_cannot_inline_p (fndecl)
  50.      register tree fndecl;
  51.  
  52.  
  53. If the function is empty, it should always be safe to inline... 
  54.  
  55. Perhaps there should be a special case for this (how do I tell an empty function
  56. from fndecl?  Is it safe to say:
  57.     if(EMPTY(fndecl))
  58.         return 0;
  59.  
  60. --
  61. marty
  62. leisner.henr801c@xerox.com  leisner@eso.mc.xerox.com
  63. Member of the League for Programming Freedom
  64.  
  65.