-
Notifications
You must be signed in to change notification settings - Fork 157
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
Remove virtual calls in constructor/destructor #1428
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Found using cppcheck: common/src/addrtranslate-win.C:49:17: style: Virtual function 'init' is called from constructor 'AddressTranslateWin(PID pid,PROC_HANDLE phandle)' at line 168. Dynamic binding is not used. [virtualCallInConstructor] virtual bool init();
Found using cppcheck: common/src/NodeIterator.h:293:18: style: Virtual function 'inc' is called from constructor 'NodeIteratorPredicateObj(Graph::NodePredicate::Ptr p,NodeIterator&b,NodeIterator&e)' at line 331. Dynamic binding is not used. [virtualCallInConstructor]
Found using cppcheck: common/src/NodeIterator.h:352:18: style: Virtual function 'inc' is called from constructor 'NodeIteratorPredicateFunc(Graph::NodePredicateFunc p,void*u,NodeIterator&b,NodeIterator&e)' at line 394. Dynamic binding is not used. [virtualCallInConstructor]
Found using cppcheck: instructionAPI/src/InstructionDecoder-x86.h:74:49: style: Virtual function 'setMode' is called from constructor 'InstructionDecoder_x86(Architecture a)' at line 144. Dynamic binding is not used. [virtualCallInConstructor] INSTRUCTION_EXPORT virtual void setMode(bool is64); ^ instructionAPI/src/InstructionDecoder-x86.C:144:28: note: Calling setMode if(a == Arch_x86_64) setMode(true); ^ instructionAPI/src/InstructionDecoder-x86.h:74:49: note: setMode is a virtual function INSTRUCTION_EXPORT virtual void setMode(bool is64);
Found using cppcheck: parseAPI/h/CFGFactory.h:117:18: style: Virtual function 'free_block' is called from destructor '~CFGFactory()' at line 92. Dynamic binding is not used. [virtualCallInConstructor] virtual void free_block(Block * b); ^ parseAPI/src/CFGFactory.C:92:5: note: Calling destroy_block destroy_block(b); ^ parseAPI/src/CFGFactory.C:182:5: note: Calling free_block free_block(b); ^ parseAPI/h/CFGFactory.h:117:18: note: free_block is a virtual function virtual void free_block(Block * b);
Found using cppcheck: parseAPI/h/CFGFactory.h:116:18: style: Virtual function 'free_func' is called from destructor '~CFGFactory()' at line 95. Dynamic binding is not used. [virtualCallInConstructor] virtual void free_func(Function * f); ^ parseAPI/src/CFGFactory.C:95:5: note: Calling destroy_func destroy_func(f); ^ parseAPI/src/CFGFactory.C:172:4: note: Calling free_func free_func(f); ^ parseAPI/h/CFGFactory.h:116:18: note: free_func is a virtual function virtual void free_func(Function * f);
Found using cppcheck: proccontrol/src/freebsd.C:1046:17: warning: Member variable 'freebsd_thread::is_exited' is not initialized in the constructor. [uninitMemberVar] freebsd_thread::freebsd_thread(int_process *p, Dyninst::THR_ID t, Dyninst::LWP l) ^ proccontrol/src/freebsd.h:122:17: style: Virtual function 'getEventQueue' is called from destructor '~freebsd_process()' at line 795. Dynamic binding is not used. [virtualCallInConstructor] virtual int getEventQueue(); ^ proccontrol/src/freebsd.C:795:22: note: Calling getEventQueue int eventQueue = getEventQueue(); ^ proccontrol/src/freebsd.h:122:17: note: getEventQueue is a virtual function virtual int getEventQueue();
hainest
added
the
code cleanup
Bring the code up to modern standards or remove deprecated features
label
May 9, 2023
kupsch
approved these changes
May 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not technically bugs, but it's better to be explicit to remove any ambiguity. Found using cppcheck's virtualCallInConstructor.