ci: Update to Fedora 40
Fedora 40 comes with a RedHat branch of GCC 14.0, which supports the features we need for C++ modules.
Fedora 40 comes with LLVM/Clang 18, so enable FindOpenACC tests.
The HIP tests do not fully work in CI on Fedora 40, so move the Fedora+HIP job to a dedicated Fedora 39 base image instead.
See !8983 (merged) for the update to Fedora 39.
Issue: #25932
Edited by Brad King