retaining unused static functions at -O1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I would like to run coverage tests at '-O1' (using -coverage and lcov, gaining >2x time over -O0), but unfortunately unused functions (e.g. static functions not called) are removed from the coverage report at -O1, which otherwise looks good to me.

So, the question: is there a way to compile at -O1 but keep all functions ? (i tried -fno-tree-dce but that didn't help). Bonus points if this also works for Fortran.  (I'm aware of -Wunused-functions, but this doesn't fit the requirements).

testcase: 

> cat test.c
static void foo()
{
}
void bar()
{
}

> gcc -c -O0 test.c ; nm test.
0000000000000007 T bar
0000000000000000 t foo

> gcc -c -O1 test.c ; nm test.o
0000000000000000 T bar

Thanks,

Joost



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux