4 msgExtracting all functions from C++ source code
2 msgForce GCC to unroll a loop?
5 msgSyslog fixes a bug?
2 msggcc 4.2.x large file support
2 msgWindows DEP problem with nested functions
8 msgPorting GCC to 8051 Microcontroller
2 msgCleanup for thread local storage?
3 msgGCC 4.3.2 Install into Cygwin

gcno file doesn't include uncalled member funct...
\ Michael Morrell (6 May 2008)
. \ John Love-Jensen (6 May 2008)
. . \ Michael Morrell (7 May 2008)
. . . \ John Love-Jensen (7 May 2008)

3 msgGCC 4.3.0 configure failure: libgcc
2 msglex/yacc
1 msgBuilding trunk -- error msg instrucitons not qu...
2 msgMIPS atomic builtins
3 msgEnabling loop unrolling in small sections of code.
1 msg#pragma warning
2 msgProblems building gcc 4.3
8 msggcc 4.3.0 -- program search path issue
1 msgRe: WELCOME to gcc
2 msgInclude paths for cpp/g++ (gcc 4.3.0)
2 msgLinking a library and source file into another ...
Subject:gcno file doesn't include uncalled member functions?
Group:Gcc-help
From:Michael Morrell
Date:6 May 2008


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


© 2004-2008 readlist.com