gcno file doesn't include uncalled member functions?

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

 



It seems that the gcno file produced by gcc when the coverage flags are
given
doesn't include data for a member function defined in a header, but not
called.  It seems that it is optimizing away the uncalled member function
even though I am using -O0.  Is there another option that I should use?

Here is my test case:

========= Rect.h ===============
class Rect {
public:
    Rect(int x, int y) { m_x = x; m_y = y; }
    int x() const { return m_x; }
    int y() const { return m_y; }

private:
    int m_x;
    int m_y;
};
================================

======== Main.cpp ==============
include <stdio.h>
#include "Rect.h"

int main()
{
    Rect* rect = new Rect(3, 5);

    printf("x: %d\n", rect->x());
    //printf("y: %d\n", rect->y());
    return 0;
}
================================

And I compile this using:
     g++ -fprofile-arcs -ftest-coverage -O0 -o rect Main.cpp

With the above call to "rect->y" commented out, the generated Main.gcno
file only lists 2 functions from Rect.h: the constructor and the "x"
function.

Can anyone enlighten me on this behavior?

Thanks,

  Michael


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

[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