[Chapel Merge] Adjust runtime headers to better handle C++ compil

Branch: refs/heads/master
Revision: d2568a7
Author: mppf
Log Message:

Merge pull request #16847 from mppf/runtime-changes-better-cpp

Adjust runtime headers to better handle C++ compilation

One approach we are investigating as part of the GPU effort is to include
interoperability with CUDA code through clang's CUDA support. But since
CUDA is an extension of C++, this means we need to have better C++
support within the runtime headers (since these are "include"d in the
generated code - even for --llvm compilation). This issue motivated
this PR.

We have made a number of changes to the runtime in the past in order to
support compilation within C++ files. This mainly comes up in the context
of compiling re2-interface.cc.

This PR improves upon previous efforts to allow the runtime headers to
compile with C++:

  • renames an argument named private since it is a keyword in C++
  • wrap function declarations in extern "C" { } across the runtime
    headers (but avoid #includeing anything within these blocks). We
    were doing this in some cases already - this PR applies it more
    comprehensively.
  • replaces the workaround for complex support in C++ from c6a6c63 with a
    more principled change
  • [x] full local testing

Reviewed by @leekillough and general direction checked with @gbtitus - thanks!

Modified Files:
M runtime/etc/rtmain.c
M runtime/include/arg.h
M runtime/include/atomics/cstdlib/chpl-atomics.h
M runtime/include/atomics/intrinsics/chpl-atomics.h
M runtime/include/atomics/locks/chpl-atomics.h
M runtime/include/chpl-align.h
M runtime/include/chpl-arg-bundle.h
M runtime/include/chpl-bitops.h
M runtime/include/chpl-cache-task-decls.h
M runtime/include/chpl-cache.h
M runtime/include/chpl-comm-callbacks-internal.h
M runtime/include/chpl-comm-compiler-llvm-support.h
M runtime/include/chpl-comm-compiler-macros.h
M runtime/include/chpl-comm-diags.h
M runtime/include/chpl-comm-internal.h
M runtime/include/chpl-comm-locales.h
M runtime/include/chpl-comm-native-atomics.h
M runtime/include/chpl-comm-strd-xfer.h
M runtime/include/chpl-comm.h
M runtime/include/chpl-env.h
M runtime/include/chpl-export-wrappers.h
M runtime/include/chpl-external-array.h
M runtime/include/chpl-file-utils.h
M runtime/include/chpl-format.h
M runtime/include/chpl-gen-includes.h
M runtime/include/chpl-init.h
M runtime/include/chpl-linefile-support.h
M runtime/include/chpl-mem-array.h
M runtime/include/chpl-mem-consistency.h
M runtime/include/chpl-mem-desc.h
M runtime/include/chpl-mem-sys.h
M runtime/include/chpl-mem.h
M runtime/include/chpl-prefetch.h
M runtime/include/chpl-privatization.h
M runtime/include/chpl-string-support.h
M runtime/include/chpl-string.h
M runtime/include/chpl-tasks-callbacks-internal.h
M runtime/include/chpl-tasks.h
M runtime/include/chpl-thread-local-storage.h
M runtime/include/chpl-threads.h
M runtime/include/chpl-visual-debug.h
M runtime/include/chpl-wide-ptr-fns.h
M runtime/include/chpl_rt_utils_static.h
M runtime/include/chplcast.h
M runtime/include/chplcgfns.h
M runtime/include/chpldirent.h
M runtime/include/chplexit.h
M runtime/include/chplglob.h
M runtime/include/chplio.h
M runtime/include/chpllaunch.h
M runtime/include/chplmath.h
M runtime/include/chplmemtrack.h
M runtime/include/chplsys.h
M runtime/include/chpltimers.h
M runtime/include/chpltypes.h
M runtime/include/comm/chpl-comm-task-decls.h
M runtime/include/comm/gasnet/chpl-comm-impl.h
M runtime/include/comm/gasnet/chpl-comm-launch.h
M runtime/include/comm/gasnet/chpl-comm-task-decls.h
M runtime/include/comm/ofi/chpl-comm-impl.h
M runtime/include/comm/ofi/chpl-comm-launch.h
M runtime/include/comm/ofi/chpl-comm-task-decls.h
M runtime/include/comm/ugni/chpl-comm-impl.h
M runtime/include/comm/ugni/chpl-comm-launch.h
M runtime/include/comm/ugni/chpl-comm-task-decls.h
M runtime/include/comm/ugni/comm-ugni-heap-pages.h
M runtime/include/config.h
M runtime/include/encoding/encoding-support.h
M runtime/include/error.h
M runtime/include/gdb.h
M runtime/include/llvm/chapel_libc_wrapper.h
M runtime/include/localeModels/apu/chpl-locale-model.h
M runtime/include/localeModels/flat/chpl-locale-model.h
M runtime/include/localeModels/gpu/chpl-locale-model.h
M runtime/include/localeModels/numa/chpl-locale-model.h
M runtime/include/mem/cstdlib/chpl-mem-impl.h
M runtime/include/mem/jemalloc/chpl-mem-impl.h
M runtime/include/qio/bulkget.h
M runtime/include/qio/qbuffer.h
M runtime/include/qio/qio.h
M runtime/include/qio/qio_formatted.h
M runtime/include/qio/qio_plugin_api.h
M runtime/include/qio/qio_popen.h
M runtime/include/qio/qio_style.h
M runtime/include/threads/pthreads/chpl-threads-impl.h
M runtime/src/comm/ofi/comm-ofi-internal.h
M runtime/src/comm/ugni/comm-ugni-mem.h
M runtime/src/launch/aprun/aprun-utils.h
M runtime/src/launch/pals/pals-utils.h

Compare: https://github.com/chapel-lang/chapel/compare/af44fcc4b5f9...d2568a74b633