-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix more build warnings (#1616) #1620
Fix more build warnings (#1616) #1620
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1620 +/- ##
==========================================
- Coverage 85.22% 85.12% -0.09%
==========================================
Files 156 159 +3
Lines 4978 4999 +21
==========================================
+ Hits 4242 4255 +13
- Misses 736 744 +8
|
could you please change ctor and dtors you added? ctor() {}
virtual ~dtor() {} to ctor() = default;
virtual ~dtor() = default; |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the fix :)
Do we know if this is some bug in gcc, as it makes us redefine all these methods in the derived class. |
For AddEvent():
Testing with gcc 10, gcc reports that:
This is surprising, because the prototype is different, so in theory there should be no virtual method hiding another. After looking at this for a long time, I still can not decide if:
In any case, even if this is a gcc bug, the code should be clear enough so that correct binary is produced by the compiler. At the end of the day, what is executed in production is the binary, not the source code, and we need to avoid surprises there. The fix implements AddEvent(2 param) in all sub classes, to follow the same pattern already used for every other AddEvent() methods, which will also help maintenance. From a performance point of view also, I think:
There is no point to call optimistically std::chrono::system_clock::now() in case it might be needed. |
Thanks, @marcalff for the detailed explanation, does making these hidden api methods non-virtual fix the issue? Though I agree with the performance issue you mentioned with multiple function calls and the unnecessary ts calculation, just trying way to avoid definitions of the same method at multiple places. |
Hi @lalitb Changing a virtual method to a non virtual is a binary incompatible change I think (the virtual table is different). The current fix looks like the best solution so far. |
Agree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for fixing these warnings.
Fixes #1616
Changes
Fixed the following warnings reported by gcc:
-Wall
-Werror
-Wextra-semi
-Werror=unused-parameter
-Werror=undef
-Werror=overloaded-virtual
-Werror=ignored-qualifiers
In particular, gcc gets confused by the trace::Span::AddEvent() methods,
and reports an error with -Werror=overloaded-virtual.
Likewise for logs::Logger::Log()
Fixed the following warnings reported by clang:
[-Werror,-Wimplicit-exception-spec-mismatch]
[-Werror,-Winconsistent-missing-override]
[-Werror,-Wpessimizing-move]
[-Werror,-Wimplicit-const-int-float-conversion]
[-Werror,-Wdelete-non-abstract-non-virtual-dtor]
CHANGELOG.md
updated for non-trivial changes