[Bug ld/11793] Add suggestion to error "undefined reference to `vtable for XXX'"

2010-07-07 Thread manu at gcc dot gnu dot org


-- 
   What|Removed |Added

 CC||manu at gcc dot gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11793

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.

___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/11793] Add suggestion to error "undefined reference to `vtable for XXX'"

2010-07-07 Thread zilla at kayari dot org

--- Additional Comments From zilla at kayari dot org  2010-07-07 14:57 
---
I'll just repeat my claim that outputting anything like "did you forget to make
it pure?" is probably worse than the status quo.

Forgetting to define a virtual function (or not linking to the object that
defines it) is far more common in my experience, and searching the web for this
error confirms that.  I didn't find any instances of this error on the web where
someone meant to declare a function as pure virtual but omitted the 
pue-specifier.

The most common reason for this error is declaring a virtual function and not
defining it, which is also the problem in this bug report (the fact that the
non-pure declaration was accidental is largely irrelevant; it was declared and
not defined.)

If any suggestion is made to the user, it should be to ensure that all non-pure
virtual functions are defined.  Which is what the GCC FAQ already says:
http://gcc.gnu.org/faq.html#vtables

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11793

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.

___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/11793] Add suggestion to error "undefined reference to `vtable for XXX'"

2010-07-07 Thread phresnel at gmail dot com

--- Additional Comments From phresnel at gmail dot com  2010-07-07 15:24 
---
(In reply to comment #1)
> If any suggestion is made to the user, it should be to ensure that all 
> non-pure
> virtual functions are defined.  Which is what the GCC FAQ already says:
> http://gcc.gnu.org/faq.html#vtables

This is a perfect suggestion, of course. But the suggestion I am trying to make,
sorry if I was unprecise, is that g++ or ld *does* output *some* suggestion (or
better error message).

I see it as with good documentation: It is optional, but would increase
usability and decrease the chill-aways before the matter in question. 

I know this is not llvm, and I am not a user of llvm, but this is primarily
because clang++ is yet incomplete vs. the holy standard, and because gcc
optimization seems superiour to any other free compiler. But at three things
llvm *seems* to be largely superiour over gcc (incl. some proprietary ones),
which is 

a) error messages [0]
b) fast compiles [1]
c) low memory usage [1]

I'd also prefer gcc from the license viewpoint, but honestly, it is such
implementation "detail" that could make quite a few people move away from gcc,
at least for on-the-hack compilation (in contrast to complete release builds).

[0] http://clang.llvm.org/diagnostics.html
[1] http://clang.llvm.org/features.html#performance

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11793

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.

___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/11793] Add suggestion to error "undefined reference to `vtable for XXX'"

2010-07-07 Thread manu at gcc dot gnu dot org

--- Additional Comments From manu at gcc dot gnu dot org  2010-07-07 15:50 
---
I understand your frustration, but linker and compiler do not share a lot of
information and I think there is no way (right now) to give a good diagnostic
for this case. The linker does not know about vtables, pure functions and C++ in
general.

I don't think that LLVM/Clang gives a better diagnostic here, because they will
need a linker integrated tightly in the compiler, and (so far) they are using
the GNU linker. If you can show us otherwise, that would be great because I
really wish we could provide better diagnostics from the linker.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11793

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.

___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/11793] Add suggestion to error "undefined reference to `vtable for XXX'"

2010-07-07 Thread phresnel at gmail dot com

--- Additional Comments From drow at false dot org  2010-07-07 16:04 ---
Subject: Re:  Add suggestion to error "undefined reference to
 `vtable for XXX'"

On Wed, Jul 07, 2010 at 03:50:32PM -, manu at gcc dot gnu dot org wrote:
> I understand your frustration, but linker and compiler do not share a lot of
> information and I think there is no way (right now) to give a good diagnostic
> for this case. The linker does not know about vtables, pure functions and C++ 
> in
> general.

If there's an undefined reference to a vtable, what more does the
linker need?


--- Additional Comments From phresnel at gmail dot com  2010-07-07 21:37 
---
(In reply to comment #3)
> I understand your frustration, but linker and compiler do not share a lot of
> information and I think there is no way (right now) to give a good diagnostic
> for this case. The linker does not know about vtables, pure functions and C++ 
> in
> general.

I understand that there is not any C++ information available at that point of
linking, but given the error message, it's prolly possible to look-up a
suggestion somewhere, or even just extend the error message in question.


> 
> I don't think that LLVM/Clang gives a better diagnostic here, because they 
> will
> need a linker integrated tightly in the compiler, and (so far) they are using
> the GNU linker. If you can show us otherwise, that would be great because I
> really wish we could provide better diagnostics from the linker.

I did not know this, interesting.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11793

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.

___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils