Hello

I found this almost two-year old thread while looking for how the OpenMP 5.0 deprecations were to be handled.

E.g. if somebody tries hard to write portable OpenMP code and has:
  omp_lock_t lock;
  #if __OPENMP__ >= 201811L
  omp_init_lock_with_hint (&lock, omp_sync_hint_contended);
  #elif __OPENMP__ >= 201511L
  omp_init_lock_with_hint (&lock, omp_lock_hint_contended);
  #else
  omp_init_lock (&lock);
  #endif
they would now get a warning even when they did the right thing.
So, deprecating those when we change __OPENMP__ macro is the right thing.

What if we made the definition of __GOMP_DEPRECATED in the original patch conditional on the current value of __OPENMP__? i.e. Something like:

+#if defined(__GNUC__) && __OPENMP__ >= 201811L
+# define __GOMP_DEPRECATED __attribute__((__deprecated__))
+#else
+# define __GOMP_DEPRECATED
+#endif

In that case, __GOMP_DEPRECATED will not do anything until __OPENMP__ is updated to reflect OpenMP 5.0, but when it is, the functions will immediately be marked deprecated without any further work.

However, GFortran does not support the deprecated attribute, so how should it behave? My first thought would be to print out a warning message at runtime the first time a deprecated function is called (printing it out every time would probably be too annoying), and maybe add an environment variable that can be set to disable the warning. A similar runtime warning could also be printed if the OMP_NESTED environment variable is set. Again, printing these warnings could be surpressed until the value of __OPENMP__ is bumped up.

Kwok

Reply via email to