Hi Sandra, hello world,
Sandra Loosemore wrote:
On 6/2/25 12:15, Tobias Burnus wrote:
The problem is that 'int'/'int*' became 'omp_interop_rc_t ret_code'
and 'omp_interop_rc_t *ret_code'.
...
I think the patch just confuses readers, as-is. Plus it has a grammar
bug. How about instead of
+Note that OpenMP prior to 6.0 use the type @code{int} for
@var{ret_code}
+in C/C++.
we say something like
Libgomp implements the OpenMP 6.0 version of this function for C and
C++, which is not compatible with its type signature in previous
versions of the OpenMP specification. In older versions, the type
@code{int} was used in place of the enumerated type
@code{omp_interop_rc_t}.
How about the following version?
Tobias
libgomp.texi (omp_interop_*): Add note about 5.2-to-6.0 incompatibility
GCC uses the 6.0 types - which are unfortunately not quite compatible with
code expecting 5.1/5.2 data types. Therefore, this commit adds a note to
hopefully reduce surprises. Namely:
For C/C++: while OpenMP 5.1 and 5.2 used 'int *ret_code', OpenMP 6.0 uses
'omp_interop_rc_t *ret_code' in omp_interop_{int,ptr,str} and 'int' instead
of 'omp_interop_rc_t ret_code' in omp_get_interop_rc_desc.
Neither C nor C++ like passing the wrong pointer type, albeit for C, GCC < 14
and clang only warn (gcc >= r14-6037-g9715c545d33b3a has an error) and
using -fpermissive turns it into a warning and -Wno-incompatible-pointer-types
silences it for C.
C++ also dislikes passing an int to an enum, albeit -fpermissive turns the
error into a warning with g++ (but not clang++). And, here, using an enum
on the caller side works with both int and enum on the callee side.
libgomp/ChangeLog:
* libgomp.texi (omp_interop_{int,ptr,str,rc_desc}): Add note about
the 'ret_code' type change in OpenMP 6.
Co-authored-by: Sandra Loosemore <sloosem...@baylibre.com>
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index 8e487bcd168..0e527752a80 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -3130,3 +3130,8 @@ and Fortran or used with @code{NULL} as argument in C and C++. If successful,
In GCC, the effect of running this routine in a @code{target} region that is not
the initial device is unspecified.
+GCC implements the OpenMP 6.0 version of this function for C and C++, which is not
+compatible with its type signature in previous versions of the OpenMP specification.
+In older versions, the type @code{int*} was used for the @var{ret_code} argument
+in place of a pointer to the enumerated type @code{omp_interop_rc_t}.
+
@@ -3176,3 +3181,8 @@ and Fortran or used with @code{NULL} as argument in C and C++. If successful,
In GCC, the effect of running this routine in a @code{target} region that is not
the initial device is unspecified.
+GCC implements the OpenMP 6.0 version of this function for C and C++, which is not
+compatible with its type signature in previous versions of the OpenMP specification.
+In older versions, the type @code{int*} was used for the @var{ret_code} argument
+in place of a pointer to the enumerated type @code{omp_interop_rc_t}.
+
@@ -3222,3 +3232,8 @@ and Fortran or used with @code{NULL} as argument in C and C++. If successful,
In GCC, the effect of running this routine in a @code{target} region that is not
the initial device is unspecified.
+GCC implements the OpenMP 6.0 version of this function for C and C++, which is not
+compatible with its type signature in previous versions of the OpenMP specification.
+In older versions, the type @code{int*} was used for the @var{ret_code} argument
+in place of a pointer to the enumerated type @code{omp_interop_rc_t}.
+
@@ -3348,6 +3363,11 @@ the @var{ret_code} in human-readable form.
The behavior is unspecified if value of @var{ret_code} was not set by an
interoperability routine invoked for @var{interop}.
+GCC implements the OpenMP 6.0 version of this function for C and C++, which is not
+compatible with its type signature in previous versions of the OpenMP specification.
+In older versions, the type @code{int} was used for the @var{ret_code} argument
+in place of the enumerated type @code{omp_interop_rc_t}.
+
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{const char *omp_get_interop_rc_desc(const omp_interop_t interop,