[Openmp-commits] [openmp] 35ab6d6 - [OpenMP][Tests][NFC] rename macro to avoid naming clash

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Wed Feb 24 09:04:05 PST 2021


Author: Joachim Protze
Date: 2021-02-24T18:03:54+01:00
New Revision: 35ab6d6390ecd285041590c00bac71a00e86aede

URL: https://github.com/llvm/llvm-project/commit/35ab6d6390ecd285041590c00bac71a00e86aede
DIFF: https://github.com/llvm/llvm-project/commit/35ab6d6390ecd285041590c00bac71a00e86aede.diff

LOG: [OpenMP][Tests][NFC] rename macro to avoid naming clash

When including <ostream>, the register_callback macro of the OMPT callback.h
clashes with a function defined in ostream. This patch renames the macro
and includes ompt into the macro name.

Added: 
    

Modified: 
    openmp/runtime/test/ompt/callback.h
    openmp/runtime/test/ompt/parallel/repeated_calls.c
    openmp/runtime/test/ompt/synchronization/barrier/implicit_task_data.c
    openmp/runtime/test/ompt/synchronization/master.c
    openmp/runtime/test/ompt/tasks/task_memory.c

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/test/ompt/callback.h b/openmp/runtime/test/ompt/callback.h
index 2bc26b51da18..e426558bf869 100644
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -234,14 +234,14 @@ ompt_label_##id:
          ((uint64_t)addr) / FUZZY_ADDRESS_DISCARD_BYTES + 1,                   \
          ((uint64_t)addr) / FUZZY_ADDRESS_DISCARD_BYTES + 2, addr)
 
-#define register_callback_t(name, type)                                        \
+#define register_ompt_callback_t(name, type)                                   \
   do {                                                                         \
     type f_##name = &on_##name;                                                \
     if (ompt_set_callback(name, (ompt_callback_t)f_##name) == ompt_set_never)  \
       printf("0: Could not register callback '" #name "'\n");                  \
   } while (0)
 
-#define register_callback(name) register_callback_t(name, name##_t)
+#define register_ompt_callback(name) register_ompt_callback_t(name, name##_t)
 
 #ifndef USE_PRIVATE_TOOL
 static void
@@ -1150,29 +1150,29 @@ int ompt_initialize(
   ompt_enumerate_states = (ompt_enumerate_states_t) lookup("ompt_enumerate_states");
   ompt_enumerate_mutex_impls = (ompt_enumerate_mutex_impls_t) lookup("ompt_enumerate_mutex_impls");
 
-  register_callback(ompt_callback_mutex_acquire);
-  register_callback_t(ompt_callback_mutex_acquired, ompt_callback_mutex_t);
-  register_callback_t(ompt_callback_mutex_released, ompt_callback_mutex_t);
-  register_callback(ompt_callback_nest_lock);
-  register_callback(ompt_callback_sync_region);
-  register_callback_t(ompt_callback_sync_region_wait, ompt_callback_sync_region_t);
-  register_callback_t(ompt_callback_reduction, ompt_callback_sync_region_t);
-  register_callback(ompt_callback_control_tool);
-  register_callback(ompt_callback_flush);
-  register_callback(ompt_callback_cancel);
-  register_callback(ompt_callback_implicit_task);
-  register_callback_t(ompt_callback_lock_init, ompt_callback_mutex_acquire_t);
-  register_callback_t(ompt_callback_lock_destroy, ompt_callback_mutex_t);
-  register_callback(ompt_callback_work);
-  register_callback(ompt_callback_masked);
-  register_callback(ompt_callback_parallel_begin);
-  register_callback(ompt_callback_parallel_end);
-  register_callback(ompt_callback_task_create);
-  register_callback(ompt_callback_task_schedule);
-  register_callback(ompt_callback_dependences);
-  register_callback(ompt_callback_task_dependence);
-  register_callback(ompt_callback_thread_begin);
-  register_callback(ompt_callback_thread_end);
+  register_ompt_callback(ompt_callback_mutex_acquire);
+  register_ompt_callback_t(ompt_callback_mutex_acquired, ompt_callback_mutex_t);
+  register_ompt_callback_t(ompt_callback_mutex_released, ompt_callback_mutex_t);
+  register_ompt_callback(ompt_callback_nest_lock);
+  register_ompt_callback(ompt_callback_sync_region);
+  register_ompt_callback_t(ompt_callback_sync_region_wait, ompt_callback_sync_region_t);
+  register_ompt_callback_t(ompt_callback_reduction, ompt_callback_sync_region_t);
+  register_ompt_callback(ompt_callback_control_tool);
+  register_ompt_callback(ompt_callback_flush);
+  register_ompt_callback(ompt_callback_cancel);
+  register_ompt_callback(ompt_callback_implicit_task);
+  register_ompt_callback_t(ompt_callback_lock_init, ompt_callback_mutex_acquire_t);
+  register_ompt_callback_t(ompt_callback_lock_destroy, ompt_callback_mutex_t);
+  register_ompt_callback(ompt_callback_work);
+  register_ompt_callback(ompt_callback_masked);
+  register_ompt_callback(ompt_callback_parallel_begin);
+  register_ompt_callback(ompt_callback_parallel_end);
+  register_ompt_callback(ompt_callback_task_create);
+  register_ompt_callback(ompt_callback_task_schedule);
+  register_ompt_callback(ompt_callback_dependences);
+  register_ompt_callback(ompt_callback_task_dependence);
+  register_ompt_callback(ompt_callback_thread_begin);
+  register_ompt_callback(ompt_callback_thread_end);
   printf("0: NULL_POINTER=%p\n", (void*)NULL);
   return 1; //success
 }

diff  --git a/openmp/runtime/test/ompt/parallel/repeated_calls.c b/openmp/runtime/test/ompt/parallel/repeated_calls.c
index 182697530172..84f85019c1ea 100644
--- a/openmp/runtime/test/ompt/parallel/repeated_calls.c
+++ b/openmp/runtime/test/ompt/parallel/repeated_calls.c
@@ -86,8 +86,8 @@ int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
   ompt_get_unique_id = (ompt_get_unique_id_t)lookup("ompt_get_unique_id");
   ompt_get_thread_data = (ompt_get_thread_data_t)lookup("ompt_get_thread_data");
 
-  register_callback(ompt_callback_thread_begin);
-  register_callback(ompt_callback_parallel_begin);
+  register_ompt_callback(ompt_callback_thread_begin);
+  register_ompt_callback(ompt_callback_parallel_begin);
   printf("0: NULL_POINTER=%p\n", (void *)NULL);
   return 1; // success
 }

diff  --git a/openmp/runtime/test/ompt/synchronization/barrier/implicit_task_data.c b/openmp/runtime/test/ompt/synchronization/barrier/implicit_task_data.c
index 21dddb594540..7ac3e9099c8e 100644
--- a/openmp/runtime/test/ompt/synchronization/barrier/implicit_task_data.c
+++ b/openmp/runtime/test/ompt/synchronization/barrier/implicit_task_data.c
@@ -121,7 +121,7 @@ on_ompt_callback_sync_region_wait(
   }
 }
 
-#define register_callback_t(name, type)                       \
+#define register_ompt_callback_t(name, type)                       \
 do{                                                           \
   type f_##name = &on_##name;                                 \
   if (ompt_set_callback(name, (ompt_callback_t)f_##name) ==   \
@@ -129,7 +129,7 @@ do{                                                           \
     printf("0: Could not register callback '" #name "'\n");   \
 }while(0)
 
-#define register_callback(name) register_callback_t(name, name##_t)
+#define register_ompt_callback(name) register_ompt_callback_t(name, name##_t)
 
 int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
                     ompt_data_t *tool_data) {
@@ -137,9 +137,9 @@ int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
   ompt_set_callback = (ompt_set_callback_t) lookup("ompt_set_callback");
   ompt_get_unique_id = (ompt_get_unique_id_t) lookup("ompt_get_unique_id");
   ompt_get_thread_data = (ompt_get_thread_data_t) lookup("ompt_get_thread_data");
-  register_callback(ompt_callback_sync_region);
-  register_callback_t(ompt_callback_sync_region_wait, ompt_callback_sync_region_t);
-  register_callback(ompt_callback_thread_begin);
+  register_ompt_callback(ompt_callback_sync_region);
+  register_ompt_callback_t(ompt_callback_sync_region_wait, ompt_callback_sync_region_t);
+  register_ompt_callback(ompt_callback_thread_begin);
   printf("0: NULL_POINTER=%p\n", (void*)NULL);
   return 1; //success
 }

diff  --git a/openmp/runtime/test/ompt/synchronization/master.c b/openmp/runtime/test/ompt/synchronization/master.c
index 2d74250fd82c..34ecc522b85f 100644
--- a/openmp/runtime/test/ompt/synchronization/master.c
+++ b/openmp/runtime/test/ompt/synchronization/master.c
@@ -62,7 +62,7 @@ int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
   ompt_get_unique_id = (ompt_get_unique_id_t)lookup("ompt_get_unique_id");
   ompt_get_thread_data = (ompt_get_thread_data_t)lookup("ompt_get_thread_data");
 
-  register_callback(ompt_callback_master);
+  register_ompt_callback(ompt_callback_master);
   printf("0: NULL_POINTER=%p\n", (void *)NULL);
   return 1; // success
 }

diff  --git a/openmp/runtime/test/ompt/tasks/task_memory.c b/openmp/runtime/test/ompt/tasks/task_memory.c
index fabb3c5ebb81..0be157437d57 100644
--- a/openmp/runtime/test/ompt/tasks/task_memory.c
+++ b/openmp/runtime/test/ompt/tasks/task_memory.c
@@ -77,9 +77,9 @@ int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
   ompt_get_unique_id = (ompt_get_unique_id_t)lookup("ompt_get_unique_id");
   ompt_get_task_memory = (ompt_get_task_memory_t)lookup("ompt_get_task_memory");
 
-  register_callback(ompt_callback_implicit_task);
-  register_callback(ompt_callback_task_create);
-  register_callback(ompt_callback_task_schedule);
+  register_ompt_callback(ompt_callback_implicit_task);
+  register_ompt_callback(ompt_callback_task_create);
+  register_ompt_callback(ompt_callback_task_schedule);
   printf("0: NULL_POINTER=%p\n", (void *)NULL);
   return 1; // success
 }


        


More information about the Openmp-commits mailing list