This patch adds warn-once option in LLD.
Details
Diff Detail
- Repository
- rLLD LLVM Linker
Event Timeline
I personally did not find this option very useful. Could you explain in what situation you find this useful?
I have something like this in many places:
extern void foo(int a);
int main() {
int i; for (i=0;i<20;i++) foo(i); return 0;
}
Without warn-once option on this example lld prints 20 error messages (-O2 optimization while making object file), with warn-once option it prints just one error message, so if we have similar code in many places this option might be useful.
Well yes, but it would be nicer not having to modify the scripts which we currently use in our build systems.
In theory, spamming user with the same errors is not very friendly/useful indeed. Especially when we have 20 errors limit by default. Rui, what do you think if we would always enable -warn-once functionality?
(i.e. we would continue ignoring the option, because does not seem we would want to have -no-warn-once, but change the behavior to report an error only once for the symbol).
I think I'm fine with this feature. I wouldn't personally use this that much, but I can imagine that some people would find this useful.
ELF/Config.h | ||
---|---|---|
185 | Remove = false | |
ELF/Driver.cpp | ||
869 | This is the right place to set to Config->WarnOnce | |
1114–1116 | instead of this place. | |
ELF/Options.td | ||
383 | per -> for each | |
ELF/Symbols.h | ||
213 | This comment should end with a full stop. Please also mention that this bit is used for --warn-once. IsWarned -> Warned | |
test/ELF/warn-once.s | ||
14 | Please make sure that this file ends with a newline character. |
test/ELF/warn-once.s | ||
---|---|---|
19 | nit: remove ; |
test/ELF/warn-once.s | ||
---|---|---|
12 | BTW, this probably can be just the following for simplicity: # CHECK: error: undefined symbol: foo # CHECK-NOT: error: undefined symbol: foo (no need to check reporting of the location, we have a lot of other tests for that) |
Rui, should we make -warn-once ON by default?
ELF/Driver.cpp | ||
---|---|---|
872 | I think this is not clang-formatted. |
Rui, should we make -warn-once ON by default?
No, I don't think so. Either on or off could work as a default, but ON is currently the default, and I don't think we have a reason to change the default.
ELF/Options.td | ||
---|---|---|
382 | You should follow the local convention of a file. Please add a blank line before each def line. |
Remove = false