<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Sep 30, 2011, at 3:04 PM, Somorjai, Akos wrote:</div><blockquote type="cite">

<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">

<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); ">
<div>
<div>
<div style="font-family: Arial, sans-serif; font-size: 13px; ">Thanks! Yes, we are trying to avoid that situation as much as possible.</div>
<div style="font-family: Arial, sans-serif; font-size: 13px; "><br>
</div>
<div style="font-family: Arial, sans-serif; font-size: 13px; ">Is there any compiler/linker/static analyzer option that would point out those problems (in 13 million lines, large part of that being legacy code)?</div></div></div></div></blockquote><div><br></div><div>There's a -Wweak-vtables which will point out a lot of these cases.  I have to warn you that in previous releases, it's still pretty experimental;  Doug Gregor has done a lot of work on it on ToT.</div><div><br></div><div>Another option is to run 'nm' on the objects/executables you're interested in.  For example, this file:</div><div><br></div><div>daysthatwere clang$ cat red.cpp</div><div><div>  #include <typeinfo></div><div><br></div><div>  struct A {};</div><div>  struct B { virtual ~B(); };</div><div>  struct C { virtual ~C(); };</div><div>  C::~C() {}</div><div><br></div><div>  const std::type_info &test0() { return typeid(const char*); }</div><div>  const std::type_info &test1() { return typeid(const char**); }</div><div>  const std::type_info &test2() { return typeid(A); }</div><div>  const std::type_info &test3() { return typeid(B); }</div><div>  const std::type_info &test4() { return typeid(C); }</div><div><br></div><div>daysthatwere clang$ clang /tmp/red.cpp -c -o red.o</div><div>daysthatwere clang$ nm -m red.o | grep __ZTI | c++filt</div><div>0000000000000120 (__DATA,__datacoal_nt) weak external typeinfo for A</div></div><div><div><div><div>                 (undefined) external typeinfo for B</div><div>0000000000000150 (__DATA,__const) external typeinfo for C</div><div>                 (undefined) external typeinfo for char const*</div><div>0000000000000100 (__DATA,__datacoal_nt) weak external typeinfo for char const**</div></div></div><div><br></div><div>The "external" symbols are strong symbols provided by this object; these aren't a problem.</div><div>The "undefined external" symbols are expected to appear in a different object; these also aren't a problem.</div><div>The "weak external" symbols are the ones with vague linkage that you care about.</div><div><br></div><div>Otherwise, I don't have any magic bullets for you, sorry.</div><div><br></div><div>John.</div></div></div></body></html>