On Wed, Aug 07, 2024 at 05:57:05PM +0200, Tobias Burnus wrote:
> for C/C++, -fno-builtin-omp_is_initial_device already disabled the
> expansion.

Good idea.

> RFC: Should be document this new built-in some where? If so, where? As part
> of the routine description in libgomp.texi? Or in extend.texi (or even
> invoke.texi)?

I think libgomp.texi in the omp_is_initial_device description, mention
that the compiler folds it by default and that if that is undesirable,
there is this option to use.
> 
> > Maybe would be worth testing that omp_is_initial_device is not treated like
> > a builtin in C++ in custom namespace, or as a static or non-static member
> > function, or for C or Fortran as nested function.
> 
> For C/C++, it uses the same mechanism (both_p = true) as all other builtins;
> thus, I just hope that it works there.

Sure, I expect it to work fine, just thought it wouldn't hurt to double
check that in a test.

> For Fortran, this plus into gfc_get_extern_function_decl, i.e. that name
> appears as external declaration. While the user could mess around, it checks
> that it is a function and the return type is the expected on (i.e. logical).
> Thus, there shouldn't be any issue with nested functions.

And for Fortran I was wondering more whether it would work or not.
Say
program foobar
  if (omp_is_initial_device ()) stop 1
contains
  logical function omp_is_initial_device ()
    omp_is_initial_device = .false.
  end function omp_is_initial_device
end program foobar
or so?

        Jakub

Reply via email to