microsoft / Detours

Detours is a software package for monitoring and instrumenting API calls on Windows. It is distributed in source code form.
MIT License
5.02k stars 981 forks source link

Wreorder : Problem #188

Closed rchildre3 closed 3 years ago

rchildre3 commented 3 years ago

Describe the bug

Warn when the order of member initializers given in the code does not match the order in which they must be executed.

man 1 gcc (Included in -Wall for C++)

ISO C++ requires field designators to be specified in declaration order; field B will be initialized after field A

https://clang.llvm.org/docs/DiagnosticsReference.html#wreorder

~/Detours/src/disasm.cpp: In constructor ‘CDetourDis::CDetourDis(BYTE**, LONG*)’:
~/Detours/src/disasm.cpp:301:25: warning: ‘CDetourDis::m_bF3’ will be initialized after [-Wreorder]
  301 |     BOOL                m_bF3; // x86 only
      |                         ^~~~~
~/Detours/src/disasm.cpp:298:25: warning:   ‘BOOL CDetourDis::m_bVex’ [-Wreorder]
  298 |     BOOL                m_bVex;
      |                         ^~~~~~
~/detours/disasm.cpp:326:1: warning:   when initialized here [-Wreorder]
  326 | CDetourDis::CDetourDis(_Out_opt_ PBYTE *ppbTarget, _Out_opt_ LONG *plExtra) :
      | ^~~~~~~~~~
In file included from ~/Detours/src/disolx86.cpp:2:
~/Detours/src/disasm.cpp: In constructor ‘CDetourDisX86::CDetourDisX86(BYTE**, LONG*)’:
~/Detours/src/disasm.cpp:301:25: warning: ‘CDetourDisX86::m_bF3’ will be initialized after [-Wreorder]
  301 |     BOOL                m_bF3; // x86 only
      |                         ^~~~~
~/Detours/src/disasm.cpp:298:25: warning:   ‘BOOL CDetourDisX86::m_bVex’ [-Wreorder]
  298 |     BOOL                m_bVex;
      |                         ^~~~~~
In file included from ~/Detours/src/disolx86.cpp:2:
~/Detours/src/disasm.cpp:45:33: warning:   when initialized here [-Wreorder]
   45 | #define CDetourDis              CDetourDisX86
      |                                 ^~~~~~~~~~~~~
~/Detours/src/disasm.cpp:45:33: note: in definition of macro ‘CDetourDis’
   45 | #define CDetourDis              CDetourDisX86
      |                                 ^~~~~~~~~~~~~
In file included from ~/Detours/src/disolx64.cpp:2:
~/Detours/src/disasm.cpp: In constructor ‘CDetourDisX64::CDetourDisX64(BYTE**, LONG*)’:
~/Detours/src/disasm.cpp:301:25: warning: ‘CDetourDisX64::m_bF3’ will be initialized after [-Wreorder]
  301 |     BOOL                m_bF3; // x86 only
      |                         ^~~~~
~/Detours/src/disasm.cpp:298:25: warning:   ‘BOOL CDetourDisX64::m_bVex’ [-Wreorder]
  298 |     BOOL                m_bVex;
      |                         ^~~~~~
In file included from ~/Detours/src/disolx64.cpp:2:
~/Detours/src/disasm.cpp:57:33: warning:   when initialized here [-Wreorder]
   57 | #define CDetourDis              CDetourDisX64
      |                                 ^~~~~~~~~~~~~
~/Detours/src/disasm.cpp:57:33: note: in definition of macro ‘CDetourDis’
   57 | #define CDetourDis              CDetourDisX64
      |

Expected behavior Compiles without warnings

Detours version https://github.com/microsoft/Detours/commit/827b89608ce66892963d1467d15a86f0b2832a78