This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

building a basic global function call


I'm trying to learn how to implement a basic c-language like frontend for gcc.  I've been reusing
major pieces of the c++ frontend for a new frontend and have succeeded in building regular global
function declarations, but I haven't yet been successful with function calls.

I've declared and built two functions 'main' and 'foo' where 'main' contains a call to 'foo'.  The
functions look like this:

int foo()
{
}

int main()
{
	foo();
}

Here is how I'm building the function call in main:

static tree handle_function_call(tree identifier)
{     
	tree fndecl, fncall;
 	fndecl = lookup_name (identifier,0);
	tree scope = DECL_CONTEXT (get_first_fn (fndecl));
 	fncall = finish_call_expr(fndecl, NULL_TREE, false, false);
	
	return fncall;
}

This builds just fine, but the resultant exec does not contain the function call?  What am I
missing?

Thanks,  Adam Treat

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]