[flang] Limits C++ implementation behaviors
authorJean Perier <jperier@nvidia.com>
Fri, 1 Mar 2019 12:27:10 +0000 (04:27 -0800)
committerGitHub <noreply@github.com>
Wed, 27 Mar 2019 17:16:07 +0000 (10:16 -0700)
commit4fdf4fa18d6ca139db18b059970e721cc92e46f0
tree340d049ccc1285a7654ba259ea8ce3ecbefe153c
parentdd2c2d5798665143da509aff5177474bf120393f
[flang] Limits C++ implementation behaviors

The issue addressed here is the use of cast between object pointers
and function pointers. It is implementation defined because C++,
just like C, does not mandate that function and object pointers
must have the same size.
It is needed to have such cast because it is a will to ba able to
call inside F18 numerical function from libraries linked during
a Fortran program compilation in order to perform folding.
dlopen returns function pointers as void* that need to be cast to
pointer before use.
This change limits the usage of such cast inside ifdefs where POSIX
is required. In POSIX context, such cast is defined. Dlopen is
anyway used only if the environment is POSIX compliant.
In the rest of the code, opaque function pointers have been changed
from void* to void*(*)(). reinterpret_cast from function pointer to
function pointer are standard compliant.

Original-commit: flang-compiler/f18@4b2f29a1289e955469c9b9778a7db0034b0fce70
Tree-same-pre-rewrite: false
flang/lib/evaluate/rte-interface.h
flang/lib/evaluate/rte.cc
flang/lib/evaluate/rte.h