🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Marty Leisner Mon, 21 Dec 1992 15:18
Inlining varargs functions
#1400
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads