Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UR] Check for unused parameters #861

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function(add_ur_target_compile_options name)
-Wall
-Wpedantic
-Wempty-body
-Wunused-parameter
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics>
)
Expand Down
12 changes: 5 additions & 7 deletions examples/collector/collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ static std::unordered_map<
* On begin, it prints the function declaration with the call arguments specified,
* and on end it prints the function name with the result of the call.
*/
XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
xpti::trace_event_data_t *parent,
xpti::trace_event_data_t *event,
uint64_t instance, const void *user_data) {
XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *,
xpti::trace_event_data_t *, uint64_t instance,
const void *user_data) {
auto *args = static_cast<const xpti::function_with_args_t *>(user_data);
std::ostringstream out;
if (trace_type == TRACE_FN_BEGIN) {
Expand Down Expand Up @@ -119,8 +118,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
* selected trace types.
*/
XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
unsigned int minor_version,
const char *version_str,
unsigned int minor_version, const char *,
const char *stream_name) {
if (stream_name == nullptr) {
std::cout << "Stream name not provided. Aborting." << std::endl;
Expand Down Expand Up @@ -158,5 +156,5 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
*
* Can be used to cleanup state or resources.
*/
XPTI_CALLBACK_API void xptiTraceFinish(const char *stream_name) { /* noop */
XPTI_CALLBACK_API void xptiTraceFinish(const char *) { /* noop */
}
2 changes: 1 addition & 1 deletion examples/hello_world/hello_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "ur_api.h"

//////////////////////////////////////////////////////////////////////////
int main(int argc, char *argv[]) {
int main(int, char *[]) {
ur_result_t status;

// Initialize the platform
Expand Down
4 changes: 2 additions & 2 deletions scripts/templates/params.hpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ template <typename T> inline void serializeTagged(std::ostream &os, const void *
%if re.match(r"enum", obj['type']):
inline std::ostream &operator<<(std::ostream &os, enum ${th.make_enum_name(n, tags, obj)} value);
%elif re.match(r"struct", obj['type']):
inline std::ostream &operator<<(std::ostream &os, const ${obj['type']} ${th.make_type_name(n, tags, obj)} params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const ${obj['type']} ${th.make_type_name(n, tags, obj)} params);
%endif
%endfor # obj in spec['objects']
%endfor
Expand Down Expand Up @@ -353,7 +353,7 @@ for item in obj['members']:
%for tbl in th.get_pfncbtables(specs, meta, n, tags):
%for obj in tbl['functions']:

inline std::ostream &operator<<(std::ostream &os, const struct ${th.make_pfncb_param_type(n, tags, obj)} *params) {
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ${th.make_pfncb_param_type(n, tags, obj)} *params) {
<%
params_dict = dict()
for item in obj['params']:
Expand Down
33 changes: 16 additions & 17 deletions source/adapters/null/ur_null.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,20 @@ context_t::context_t() {
return UR_RESULT_SUCCESS;
};
//////////////////////////////////////////////////////////////////////////
urDdiTable.Platform.pfnGet = [](ur_adapter_handle_t *phAdapters,
uint32_t NumAdapters, uint32_t NumEntries,
ur_platform_handle_t *phPlatforms,
uint32_t *pNumPlatforms) {
if (phPlatforms != nullptr && NumEntries != 1) {
return UR_RESULT_ERROR_INVALID_SIZE;
}
if (pNumPlatforms != nullptr) {
*pNumPlatforms = 1;
}
if (nullptr != phPlatforms) {
*reinterpret_cast<void **>(phPlatforms) = d_context.get();
}
return UR_RESULT_SUCCESS;
};
urDdiTable.Platform.pfnGet =
[](ur_adapter_handle_t *, uint32_t, uint32_t NumEntries,
ur_platform_handle_t *phPlatforms, uint32_t *pNumPlatforms) {
if (phPlatforms != nullptr && NumEntries != 1) {
return UR_RESULT_ERROR_INVALID_SIZE;
}
if (pNumPlatforms != nullptr) {
*pNumPlatforms = 1;
}
if (nullptr != phPlatforms) {
*reinterpret_cast<void **>(phPlatforms) = d_context.get();
}
return UR_RESULT_SUCCESS;
};

//////////////////////////////////////////////////////////////////////////
urDdiTable.Platform.pfnGetApiVersion = [](ur_platform_handle_t,
Expand Down Expand Up @@ -122,8 +121,8 @@ context_t::context_t() {

//////////////////////////////////////////////////////////////////////////
urDdiTable.Device.pfnGetInfo =
[](ur_device_handle_t hDevice, ur_device_info_t infoType,
size_t propSize, void *pDeviceInfo, size_t *pPropSizeRet) {
[](ur_device_handle_t, ur_device_info_t infoType, size_t propSize,
void *pDeviceInfo, size_t *pPropSizeRet) {
switch (infoType) {
case UR_DEVICE_INFO_TYPE:
if (pDeviceInfo && propSize != sizeof(ur_device_type_t)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ void umfPoolDestroy(umf_memory_pool_handle_t hPool) {
free(hPool);
}

enum umf_result_t umfFree(void *ptr) { return UMF_RESULT_ERROR_NOT_SUPPORTED; }
enum umf_result_t umfFree(void *ptr) {
(void)ptr;
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_memory_pool_handle_t umfPoolByPtr(const void *ptr) { return NULL; }
umf_memory_pool_handle_t umfPoolByPtr(const void *ptr) {
(void)ptr;
return NULL;
}

enum umf_result_t
umfPoolGetMemoryProviders(umf_memory_pool_handle_t hPool, size_t numProviders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
#include "memory_tracker.h"

#include <windows.h>

#if defined(UMF_SHARED_LIBRARY)
critnib *TRACKER = NULL;
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
BOOL APIENTRY DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpvReserved) {
if (fdwReason == DLL_PROCESS_DETACH) {
critnib_delete(TRACKER);
} else if (fdwReason == DLL_PROCESS_ATTACH) {
Expand Down
Loading