Advertisement
PVS-StudioWarnings

PVS-Studio warning V556 for UnrealEngine4

Nov 24th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1. namespace EOnlineSharingReadCategory
  2. {
  3.   enum Type
  4.   {
  5.     None          = 0x00,
  6.     Posts         = 0x01,
  7.     Friends       = 0x02,
  8.     Mailbox       = 0x04,
  9.     OnlineStatus  = 0x08,
  10.     ProfileInfo   = 0x10,
  11.     LocationInfo  = 0x20,
  12.     Default       = ProfileInfo|LocationInfo,
  13.   };
  14. }
  15.  
  16. namespace EOnlineSharingPublishingCategory
  17. {
  18.   enum Type {
  19.     None          = 0x00,
  20.     Posts         = 0x01,
  21.     Friends       = 0x02,
  22.     AccountAdmin  = 0x04,
  23.     Events        = 0x08,
  24.     Default       = None,
  25.   };
  26.  
  27.   inline const TCHAR* ToString(
  28.     EOnlineSharingReadCategory::Type CategoryType)
  29.   {
  30.     switch (CategoryType)
  31.     {
  32.     case None:
  33.     {
  34.       return TEXT("Category undefined");
  35.     }
  36.     case Posts:
  37.     {
  38.       return TEXT("Posts");
  39.     }
  40.     case Friends:
  41.     {
  42.       return TEXT("Friends");
  43.     }
  44.     case AccountAdmin:
  45.     {
  46.       return TEXT("Account Admin");
  47.     }
  48.     ....
  49.   }
  50. }
  51.  
  52. This suspicious code was found in UnrealEngine4 project by PVS-Studio static code analyzer.
  53. Warning message is:
  54. V556 The values of different enum types are compared: switch(ENUM_TYPE_A) { case ENUM_TYPE_B: ... }. onlinesubsystemtypes.h 1154
  55.  
  56. 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
Advertisement