[cmake] Added target static_check for static code analysis

- Added static code analysis using cppcheck
- Fixed couple of warnings reported by cppcheck

Change-Id: Ie3b9b06e95ada322e7dc2ce3d6b91831e870198d


[ROCm/clr commit: 379cbfedcf]
此提交包含在:
Maneesh Gupta
2017-12-14 12:16:44 +05:30
父節點 3317761c7a
當前提交 b75f3d6449
共有 3 個檔案被更改,包括 8 行新增4 行删除
+6 -1
查看文件
@@ -361,6 +361,12 @@ if(POLICY CMP0037)
cmake_policy(POP)
endif()
#############################
# Code analysis
#############################
# Target: static_check
add_custom_target(static_check COMMAND cppcheck --force --quiet --enable=warning,performance,portability,information,missingInclude src include -I /opt/rocm/include/hcc -I /opt/rocm/include --suppress=*:/opt/rocm/include/hcc/hc.hpp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
#############################
# Testing steps
#############################
@@ -388,5 +394,4 @@ else()
message(STATUS "Testing targets will not be available. To enable them please ensure that the HIP installation directory is writeable. Use -DCMAKE_INSTALL_PREFIX to specify a suitable location")
endif()
# vim: ts=4:sw=4:expandtab:smartindent
+1 -1
查看文件
@@ -448,7 +448,7 @@ __device__ __half2 __lowhigh2highlow(const __half2 a) {
__device__ __half2 __lows2half2(const __half2 a, const __half2 b) {
__half2 c;
c.y = a.x;
c.x = a.x;
c.y = b.x;
return c;
}
+1 -2
查看文件
@@ -89,9 +89,8 @@ namespace hip_impl
stream->lockclose_postKernelCommand(kernel_name, acc_v);
delete static_cast<L*>(locked_stream);
locked_stream = nullptr;
if(HIP_PROFILE_API) {
MARKER_END();
}
}
}
}