Skip to content

Commit

Permalink
CI: Fortran 2018 testing
Browse files Browse the repository at this point in the history
This patch enables Fortran 2018 standard compliance testing.  We could
do 2023, but our current CI of choice doesn't yet have a compiler which
can do this.

The actual content of this PR is a decoupling of FCFLAGS_DEBUG and
FCFLAGS_FMS.  There is now a default FCFLAGS macro which is used by the
other two macros.  One can now optionally configure FCFLAGS_DEBUG
without worrying about the impact on FCFLAGS_FMS.

The motivation here is that we don't want to test for F2018/2023
compliance in FMS.
  • Loading branch information
marshallward committed Sep 17, 2024
1 parent b67e93a commit b2db6bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/actions/ubuntu-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runs:
run: |
echo "::group::config.mk"
cd .testing
echo "FCFLAGS_DEBUG = -g -O0 -Wextra -Wno-compare-reals -fbacktrace -ffpe-trap=invalid,zero,overflow -fcheck=bounds" >> config.mk
echo "FCFLAGS_DEBUG = -g -O0 -std=f2018 -Wextra -Wno-compare-reals -fbacktrace -ffpe-trap=invalid,zero,overflow -fcheck=bounds" >> config.mk
echo "FCFLAGS_REPRO = -g -O2 -fbacktrace" >> config.mk
echo "FCFLAGS_INIT = -finit-real=snan -finit-integer=2147483647 -finit-derived" >> config.mk
echo "FCFLAGS_FMS = -g -fbacktrace -O0" >> config.mk
Expand Down
8 changes: 5 additions & 3 deletions .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,21 @@ export FMS_URL
# TODO: This needs more automated configuration
MPIRUN ?= mpirun

# Generic compiler variables are pass through to the builds
# Generic compiler variables are passed through to the builds
export CC
export MPICC
export FC
export MPIFC

# Builds are distinguished by FCFLAGS
FCFLAGS_DEBUG ?= -g -O0
FCFLAGS ?= -g -O0

FCFLAGS_DEBUG ?= $(FCFLAGS)
FCFLAGS_REPRO ?= -g -O2
FCFLAGS_OPT ?= -g -O3 -mavx -fno-omit-frame-pointer
FCFLAGS_INIT ?=
FCFLAGS_COVERAGE ?= -g -O0 -fbacktrace --coverage
FCFLAGS_FMS ?= $(FCFLAGS_DEBUG)
FCFLAGS_FMS ?= $(FCFLAGS)
# Additional notes:
# - These default values are simple, minimalist flags, supported by nearly all
# compilers, and are somewhat analogous to GFDL's DEBUG and REPRO builds.
Expand Down

0 comments on commit b2db6bf

Please sign in to comment.