🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1400

Inlining varargs functions

#1400
From: Marty Leisner
Date: Mon, 21 Dec 1992 15:18
50 lines
1749 bytes
I want to write code like this:
#ifndef DEBUG_TRACE 
static void inline test_args()
{
}
#else
static void debug_trace( char *fmt, ...)
{
        va_list args;

        va_start(args, fmt);

        vfprintf(stderr, fmt, args);

        va_end(args);
}
#endif


where I have debug calls sprinkled in my code like:
        debug_trace("writing %x = %d\n", address, word);

I've never seen a clean way to do this (normally, it results in a series of macros, where
each macro has a certain number of arguments, etc...)

When I don't want debugging, a function appears, its null, and the compiler should be smart
enough to just leave it out...

In integrate.c, there's a function:
/* Zero if the current function (whose FUNCTION_DECL is FNDECL)
   is safe and reasonable to integrate into other functions.
   Nonzero means value is a warning message with a single %s
   for the function's name.  */

char *
function_cannot_inline_p (fndecl)
     register tree fndecl;


If the function is empty, it should always be safe to inline... 

Perhaps there should be a special case for this (how do I tell an empty function
from fndecl?  Is it safe to say:
	if(EMPTY(fndecl))
		return 0;

--
marty
leisner.henr801c@xerox.com  leisner@eso.mc.xerox.com
Member of the League for Programming Freedom
Technical Details
Message-ID: <1992Dec21.151845.2007@spectrum.xerox.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!wrc.xerox.COM!leisner

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!wrc.xerox.COM!leisner
From: leisner@wrc.xerox.COM ( Marty Leisner)
Subject: Inlining varargs functions
Message-ID: <1992Dec21.151845.2007@spectrum.xerox.com>
Sender: gnulists@ai.mit.edu
Reply-To: leisner@eso.mc.xerox.com
Organization: Xerox
Distribution: gnu
Date: Mon, 21 Dec 1992 15:18:45 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 51