mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-23 23:18:38 -06:00
CheckStructHasMember: fix null deref warning (#15413)
Clang Static Analyzer is so smart that it reports a defect when this intended null-deref is encountered. Use sizeof instead which has no runtime effects.
This commit is contained in:
@@ -69,7 +69,7 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
|
||||
${_INCLUDE_FILES}
|
||||
int main()
|
||||
{
|
||||
(void)((${_STRUCT} *)0)->${_MEMBER};
|
||||
(void)sizeof(((${_STRUCT} *)0)->${_MEMBER});
|
||||
return 0;
|
||||
}
|
||||
")
|
||||
|
||||
Reference in New Issue
Block a user