[SERVER-64635] Coverity analysis defect 121898: Parse warning Created: 18/Mar/22  Updated: 29/Oct/23  Resolved: 11/Apr/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Bug Priority: Trivial - P5
Reporter: Coverity Collector User Assignee: Matthew Russotto
Resolution: Fixed Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2022-03-18 at 10.06.19 AM.png     PNG File Screen Shot 2022-03-18 at 10.06.32 AM.png    
Issue Links:
Related
related to SERVER-63417 Oplog fetcher should not retry when a... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2022-04-04, Repl 2022-04-18
Participants:

 Description   

Parse warning

A parse warning may reduce maintainability of the code, or it may indicate a serious error. A parse warning from the Coverity parser may indicate a bug, or poor coding practice
/src/mongo/db/repl/replication_coordinator_impl.cpp:5069: PW.USELESS_TYPE_QUALIFIER_ON_RETURN_TYPE 121898 type qualifier on return type is meaningless



 Comments   
Comment by Githook User [ 08/Apr/22 ]

Author:

{'name': 'Matthew Russotto', 'email': 'matthew.russotto@mongodb.com', 'username': 'mtrussotto'}

Message: SERVER-64635 Remove const in return type of _getSyncSourceReadPreference(WithLock).

Fixes "Coverity analysis defect 121898: Parse warning"
Branch: master
https://github.com/mongodb/mongo/commit/f0abe7381a7429f6a67f7659d40a2b235cd8c54a

Comment by Kyle Suarez [ 05/Apr/22 ]

Per a Slack conversation, readability-const-return is actually already enabled in our current clang-tidy and sadly it does not seem to catch much. There is hope that upgrading to clang-format v4 will catch more of this.

Comment by Matthew Russotto [ 01/Apr/22 ]

kyle.suarez

Would it be possible to turn on readability-const-return in clang-tidy to catch this earlier?

Comment by Kyle Suarez [ 18/Mar/22 ]

SERVER-63417 caused the static analyzer to flag this, though this has existed in the code prior to those commits.

Generated at Thu Feb 08 06:00:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.