PVS-StudioWarnings

PVS-Studio warning V501 for VirtualBox

Nov 17th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. typedef struct SCMDIFFSTATE
  2. {
  3.   ....
  4.   bool  fIgnoreTrailingWhite;
  5.   bool  fIgnoreLeadingWhite;
  6.   ....
  7. } SCMDIFFSTATE;
  8. /* Pointer to a diff state. */
  9.  
  10. typedef SCMDIFFSTATE *PSCMDIFFSTATE;
  11.  
  12. /* Compare two lines */
  13. DECLINLINE(bool) scmDiffCompare(PSCMDIFFSTATE pState, ....)
  14. {
  15.   ....
  16.   if (pState->fIgnoreTrailingWhite    //<==
  17.    || pState->fIgnoreTrailingWhite)   //<==
  18.     return scmDiffCompareSlow(....);
  19.   ....
  20. }
  21.  
  22. This suspicious code was found in VirtualBox project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V501 There are identical sub-expressions 'pState->fIgnoreTrailingWhite' to the left and to the right of the '||' operator. scmdiff.cpp 238
  25.  
  26. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment