From 1c60469bc82c86d8301299443b9e9d42970389db Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Tue, 11 Jul 2023 19:46:59 +0000 Subject: [PATCH] Fixing compiler warnings from nvhpc on Polaris --- src/apex/apex_ompt.cpp | 4 +++- src/wrappers/memory_wrapper.cpp | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/apex/apex_ompt.cpp b/src/apex/apex_ompt.cpp index 13331042..3e030b11 100644 --- a/src/apex/apex_ompt.cpp +++ b/src/apex/apex_ompt.cpp @@ -1412,12 +1412,14 @@ extern "C" void apex_ompt_work ( static const char * taskloop_str = "Taskloop"; static const char * unknown_str = "Unknown"; + /* static const char * iterations_type = "Iterations"; static const char * collapsed_type = "Iterations (collapsed)"; static const char * sections_type = "Sections"; static const char * units_type = "Units of Work"; static const char * single_type = "Single"; - //char * count_type = const_cast(iterations_type); + char * count_type = const_cast(iterations_type); + */ switch(wstype) { case ompt_work_loop: diff --git a/src/wrappers/memory_wrapper.cpp b/src/wrappers/memory_wrapper.cpp index bfa2095a..37b950cc 100644 --- a/src/wrappers/memory_wrapper.cpp +++ b/src/wrappers/memory_wrapper.cpp @@ -172,8 +172,16 @@ get_system_function_handle(char const * name, T caller) return handle; } +// __THROW is defined by gcc extensions to allow C and C++ +// compilers to build with the same headers. If it isn't +// defined, make sure we define it. + +#ifndef __THROW +#define __THROW +#endif + extern "C" -void* malloc (size_t size) { +void* malloc (size_t size) __THROW { static malloc_p _malloc = NULL; static bool initializing = false; static bool bootstrapped = false; @@ -197,7 +205,7 @@ void* malloc (size_t size) { } extern "C" -void free (void* ptr) { +void free (void* ptr) __THROW { static free_p _free = NULL; static bool initializing = false; static bool bootstrapped = false; @@ -248,7 +256,7 @@ int puts (const char* s) { } extern "C" -void* calloc (size_t nmemb, size_t size) { +void* calloc (size_t nmemb, size_t size) __THROW { static calloc_p _calloc = NULL; static bool initializing = false; static bool bootstrapped = false; @@ -272,7 +280,7 @@ void* calloc (size_t nmemb, size_t size) { } extern "C" -void* realloc (void* ptr, size_t size) { +void* realloc (void* ptr, size_t size) __THROW { static realloc_p _realloc = NULL; static bool initializing = false; static bool bootstrapped = false;