[parisc-linux] __FUNCTION__ revisited

Alan Modra alan@linuxcare.com.au
Sat, 28 Oct 2000 01:26:02 +1100 (EST)


On Thu, 26 Oct 2000, Grant Grundler wrote:

> 	DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, n_mappings);
> 
> The output I get looks like "() DONE 16 mappings".
> No complaints from compiler or linker.

Here's a weird datapoint.

cat > xxx.c <<EOF
#include <stdio.h>

#define DEBUG_SBA_RUN_SG

#ifdef DEBUG_SBA_RUN_SG
#define DBG_RUN_SG(x...)       printf(x)
#else
#define DBG_RUN_SG(x...)
#endif


int foo (int i)
{
  DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, i);
  return i;
}

int main (void)
{
  return foo (0);
}
EOF
hppa-linux-gcc -S -O2 -o xxx.s xxx.c

shows that __FUNCTION__ is being translated as an empty string.  The
really weird bit is that if you remove "#include <stdio.h>", everything is
OK!

Alan Modra
-- 
Linuxcare.  Support for the Revolution.