diff --git a/.circleci/config.yml b/.circleci/config.yml index 58467039fe..cfefa41f3c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -247,7 +247,7 @@ jobs: command: git clone --branch $CIRCLE_BRANCH https://github.com/esmf-org/esmf.git - run: name: Docker Run API Changes - command: docker build -t "esmf/api-change:${CIRCLE_BRANCH_NEW}" --file "ESCOMP-Containers/ESMF/API_changes/Dockerfile" --build-arg DOCKER_NAMESPACE="esmf" --build-arg TAG1="ESMF_8_2_0" --build-arg TAG2="${CIRCLE_BRANCH}" --no-cache . + command: docker build -t "esmf/api-change:${CIRCLE_BRANCH_NEW}" --file "ESCOMP-Containers/ESMF/API_changes/Dockerfile" --build-arg DOCKER_NAMESPACE="esmf" --build-arg TAG1="v8.3.0" --build-arg TAG2="${CIRCLE_BRANCH}" --no-cache . - run: name: Extract API Changes command: bash esmf/.circleci/sh/extract-artifacts.sh "/tmp/artifacts" "/artifacts/api_change-artifacts.zip" "esmf/api-change:${CIRCLE_BRANCH_NEW}" @@ -490,12 +490,11 @@ workflows: docs-commit: jobs: -# - should-build-docs: -# type: approval -# - build-esmf-docs: -# requires: -# - should-build-docs - - build-esmf-docs + - should-build-docs: + type: approval + - build-esmf-docs: + requires: + - should-build-docs - publish-esmf-docs: requires: - build-esmf-docs @@ -504,9 +503,9 @@ workflows: # only: # - develop # - /^release/.*$/ - - build-esmpy-docs -# requires: -# - should-build-docs + - build-esmpy-docs: + requires: + - should-build-docs - publish-esmpy-docs: requires: - build-esmpy-docs diff --git a/.gitattributes b/.gitattributes index a1a9b010d6..22a1f037bb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,5 @@ src/doc export-ignore .gitattributes export-ignore .gitignore export-ignore + +*.C linguist-language=C++ diff --git a/.github/ISSUE_TEMPLATE/01_esmf_issue.md b/.github/ISSUE_TEMPLATE/01_esmf_issue.md new file mode 100644 index 0000000000..b89e97d44c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01_esmf_issue.md @@ -0,0 +1,5 @@ +--- +name: Framework Issue +about: Issues for tracking specific changes to the ESMF codebase. These are typically created by ESMF Core Team members. + +--- diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..a2116143d0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: ESMF Support + url: http://earthsystemmodeling.org/support/ + about: To get help with using ESMF, please send an email to esmf_support@ucar.edu. diff --git a/.github/workflows/api-change.yml b/.github/workflows/api-change.yml new file mode 100644 index 0000000000..9927a96129 --- /dev/null +++ b/.github/workflows/api-change.yml @@ -0,0 +1,47 @@ +name: Generate API changes + +on: + workflow_dispatch: + inputs: + tag1: + description: 'First ESMF Tag' + required: true + default: 'v8.3.0' + tag2: + description: 'Second ESMF Tag' + required: true + default: 'develop' + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + + - name: Checkout Dockerfiles + uses: actions/checkout@v3 + with: + repository: esmf-org/esmf-containers + path: esmf-containers + ref: main + + - name: Build Docker image + run: | + cd ${{ github.workspace }}/esmf-containers/api-change + docker build . --tag esmf/api-change --build-arg TAG1="${{ inputs.tag1 }}" --build-arg TAG2="${{ inputs.tag2 }}" + + - name: Copy artifacts + run: | + mkdir -p ${{ github.workspace }}/artifacts + CID=$(docker run -dit --name runner esmf/api-change) + docker cp ${CID}:/artifacts/api_change-artifacts.zip ${{ github.workspace }}/artifacts + docker stop ${CID} + docker rm ${CID} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: api-change + path: ${{ github.workspace }}/artifacts diff --git a/.github/workflows/build-esmf-docs.yml b/.github/workflows/build-esmf-docs.yml new file mode 100644 index 0000000000..a65cc5cff4 --- /dev/null +++ b/.github/workflows/build-esmf-docs.yml @@ -0,0 +1,75 @@ +name: Build ESMF Docs + +on: + workflow_dispatch: + push: + +concurrency: + group: build-esmf-docs-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + + - name: Checkout Dockerfiles + uses: actions/checkout@v3 + with: + repository: esmf-org/esmf-containers + path: esmf-containers + ref: main + + - name: Build Docker image + run: | + cd ${{ github.workspace }}/esmf-containers/build-esmf-docs/esmf + docker build . --tag esmf/build-esmf-docs --build-arg ESMF_BRANCH="${{ github.ref_name }}" --no-cache + + - name: Extract artifacts + run: | + mkdir -p ${{ github.workspace }}/artifacts + CID=$(docker run -dit --name runner esmf/build-esmf-docs) + docker cp ${CID}:/artifacts/doc-artifacts.zip ${{ github.workspace }}/artifacts + docker stop ${CID} + docker rm ${CID} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: esmf-docs + path: ${{ github.workspace }}/artifacts + + - name: Checkout esmf-org.github.io + uses: actions/checkout@v3 + with: + repository: esmf-org/esmf-org.github.io + path: esmf-org.github.io + token: ${{ secrets.ESMF_WEB_TOKEN }} + + - name: Copy docs + run: | + cd ${{ github.workspace }}/esmf-org.github.io + mkdir -p docs/nightly/${{ github.ref_name }}/dev_guide + cd ${{ github.workspace }}/artifacts + unzip doc-artifacts.zip + cd ${{ github.workspace }}/artifacts/artifacts/doc-esmf + cp -rf ./* ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ + cd ${{ github.workspace }}/artifacts/artifacts/doc-nuopc + cp -rf NUOPC_refdoc ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ + cp -rf NUOPC_refdoc.pdf ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ + cp -rf NUOPC_howtodoc ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ + cp -rf NUOPC_howtodoc.pdf ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ + cd ${{ github.workspace }}/artifacts/artifacts/doc-dev_guide + cp -rf ./dev_guide/dev_guide/* ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/dev_guide/ + + - name: Commit and publish docs + uses: actions-js/push@master + with: + repository: esmf-org/esmf-org.github.io + directory: ${{ github.workspace }}/esmf-org.github.io + branch: master + github_token: ${{ secrets.ESMF_WEB_TOKEN }} + message: 'Publish ESMF Docs' diff --git a/.github/workflows/build-esmpy-docs.yml b/.github/workflows/build-esmpy-docs.yml new file mode 100644 index 0000000000..6ab3132a41 --- /dev/null +++ b/.github/workflows/build-esmpy-docs.yml @@ -0,0 +1,69 @@ +name: Build ESMPy Docs + +on: + workflow_dispatch: + push: + +concurrency: + group: build-esmpy-docs-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + + - name: Checkout Dockerfiles + uses: actions/checkout@v3 + with: + repository: esmf-org/esmf-containers + path: esmf-containers + ref: main + + - name: Build Docker image + run: | + cd ${{ github.workspace }}/esmf-containers/build-esmf-docs/esmpy + docker build . --tag esmf/build-esmpy-docs --build-arg ESMF_BRANCH="${{ github.ref_name }}" --no-cache + + - name: Copy artifacts + run: | + mkdir -p ${{ github.workspace }}/artifacts + CID=$(docker run -dit --name runner esmf/build-esmpy-docs) + docker cp ${CID}:/artifacts/doc-esmpy.zip ${{ github.workspace }}/artifacts + docker stop ${CID} + docker rm ${CID} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: esmpy-docs + path: ${{ github.workspace }}/artifacts + + - name: Checkout esmpy_doc + uses: actions/checkout@v3 + with: + repository: esmf-org/esmpy_doc + path: esmpy_doc + token: ${{ secrets.ESMF_WEB_TOKEN }} + + - name: Copy docs + run: | + cd ${{ github.workspace }}/esmpy_doc + mkdir -p docs/nightly/${{ github.ref_name }} + cd ${{ github.workspace }}/artifacts + unzip doc-esmpy.zip + cd ${{ github.workspace }}/artifacts/doc-esmpy/esmpy_doc + cp -rf html ${{ github.workspace }}/esmpy_doc/docs/nightly/${{ github.ref_name }}/ + cp -rf latex/ESMPy.pdf ${{ github.workspace }}/esmpy_doc/docs/nightly/${{ github.ref_name }}/ + + - name: Commit and publish docs + uses: actions-js/push@master + with: + repository: esmf-org/esmpy_doc + directory: ${{ github.workspace }}/esmpy_doc + branch: master + github_token: ${{ secrets.ESMF_WEB_TOKEN }} + message: 'Publish ESMPy Docs' diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml new file mode 100644 index 0000000000..ee49fda09d --- /dev/null +++ b/.github/workflows/test-coverage.yml @@ -0,0 +1,43 @@ +name: Test Coverage + +on: + workflow_dispatch: + inputs: + esmf_branch: + description: 'ESMF Branch' + required: true + default: 'develop' + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + + - name: Checkout Dockerfiles + uses: actions/checkout@v3 + with: + repository: esmf-org/esmf-containers + path: esmf-containers + ref: main + + - name: Build Docker image + run: | + cd ${{ github.workspace }}/esmf-containers/test-coverage + docker build . --tag esmf/test-coverage --build-arg ESMF_BRANCH="${{ inputs.esmf_branch }}" + + - name: Copy artifacts + run: | + mkdir -p ${{ github.workspace }}/artifacts + CID=$(docker run -dit --name runner esmf/test-coverage) + docker cp ${CID}:/artifacts/test_coverage-artifacts.zip ${{ github.workspace }}/artifacts + docker stop ${CID} + docker rm ${CID} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: test-coverage + path: ${{ github.workspace }}/artifacts diff --git a/.gitignore b/.gitignore index 1aa37bcca4..138c7d0697 100644 --- a/.gitignore +++ b/.gitignore @@ -117,6 +117,8 @@ src/system_tests/ESMF_ArrayRedistMPMD/user_model2.mod src/system_tests/ESMF_ArrayRedistMPMD/user_model2.o src/system_tests/ESMF_ArrayRedistSharedObj/user_coupler.so src/system_tests/ESMF_ArrayRedistSharedObj/user_model1.so +src/system_tests/ESMF_ArrayRedistSharedObj/user_coupler.dylib +src/system_tests/ESMF_ArrayRedistSharedObj/user_model1.dylib src/Infrastructure/Trace/preload/preload.o src/Infrastructure/Trace/preload/preload_io.o diff --git a/README.md b/README.md index 737bc743d7..c0b7ba2752 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -[![ESMF](https://circleci.com/gh/esmf-org/esmf.svg?style=svg)](http://www.earthsystemmodeling.org/docs/nightly/develop/ESMF_refdoc/) +[![ESMF Doc Build](https://github.com/esmf-org/esmf/actions/workflows/build-esmf-docs.yml/badge.svg)](https://github.com/esmf-org/esmf/actions/workflows/build-esmf-docs.yml) +[![ESMPy Doc Build](https://github.com/esmf-org/esmf/actions/workflows/build-esmpy-docs.yml/badge.svg)](https://github.com/esmf-org/esmf/actions/workflows/build-esmpy-docs.yml) -# Earth System Modeling Framework (ESMF) +# Earth System Modeling Framework (ESMF) >Copyright (c) 2002-2022 University Corporation for Atmospheric Research, Massachusetts Institute of Technology, Geophysical Fluid Dynamics Laboratory, University of Michigan, National Centers for Environmental Prediction, Los Alamos National Laboratory, Argonne National Laboratory, NASA Goddard Space Flight Center. All rights reserved. @@ -32,8 +33,10 @@ conda create -c conda-forge -n esmf esmpy ## Add-On Packages Several add-on packages are included with ESMF under [`./src/addon`](https://github.com/esmf-org/esmf/tree/master/src/addon): - * [ESMPy](src/addon/ESMPy/README.md) - Python interface to ESMF. - * [NUOPC](src/addon/NUOPC/README) - Interoperability layer developed under the National Unified Operational Prediction Capability (NUOPC) program. + * [ESMPy](src/addon/esmpy) - Python interface to ESMF. + * [ESMX](src/addon/ESMX) - A layer providing the Earth System Model eXecutable. + The ESMX layer is built on top of ESMF and NUOPC. + * [NUOPC](src/addon/NUOPC) - Interoperability layer developed under the National Unified Operational Prediction Capability (NUOPC) program. See each addon package for a specific README file. diff --git a/build/common.mk b/build/common.mk index dea441ea16..7bce715e6a 100644 --- a/build/common.mk +++ b/build/common.mk @@ -356,6 +356,10 @@ ifeq ($(ESMF_MACHINE),x86_64) # except x86_64 export ESMF_ABI = 64 endif +ifeq ($(ESMF_MACHINE),arm64) +# and arm64 +export ESMF_ABI = 64 +endif endif ifeq ($(ESMF_OS),Cygwin) @@ -633,6 +637,9 @@ ESMF_EXDIR = $(ESMF_BUILD)/examples/examples$(ESMF_BOPT)/$(ESMF_OS).$(ESMF_ # apps executable directory ESMF_APPSDIR = $(ESMF_BUILD)/apps/apps$(ESMF_BOPT)/$(ESMF_OS).$(ESMF_COMPILER).$(ESMF_ABI).$(ESMF_COMM).$(ESMF_SITE) +# unified nuopc executable directory +ESMF_ESMXDIR = $(ESMF_BUILD)/src/addon/ESMX + # include file directory ESMF_INCDIR = $(ESMF_BUILD)/src/include diff --git a/build/doc/user_arch.tex b/build/doc/user_arch.tex index eddb154377..dcb91394ee 100644 --- a/build/doc/user_arch.tex +++ b/build/doc/user_arch.tex @@ -8,6 +8,108 @@ click the {\em Supported Platforms} link under one of the releases on the \htmladdnormallink{ESMF releases page}{http://earthsystemmodeling.org/static/releases.html}. +All possible combinations of {\tt ESMF\_OS}, {\tt ESMF\_COMPILER}, {\tt ESMF\_COMM}, +and {\tt ESMF\_ABI} build environment variables are listed in the following table. +Where multiple options exist, and the default is independent +of {\tt ESMF\_MACHINE}, the default value is in {\bf bold}. +A {\tt default} value in the compiler column indicates +the vendor compiler. A {\tt mpi} value in the comm column indicates +the vendor MPI implementation. + +\begin{longtable}{lllll} + {\bfseries\footnotesize ESMF\_OS} &{\bfseries\footnotesize ESMF\_COMPILER} & {\bfseries\footnotesize ESMF\_COMM} & {\bfseries\footnotesize ESMF\_ABI} \\ + +AIX &\tt default &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 32, {\bf 64} \\ +Cygwin &\tt g95 &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,lam,openmpi,user &\tt 32, 64 \\ +Cygwin &\tt gfortran &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,lam,msmpi,openmpi,user &\tt 32, 64 \\ +Darwin &\tt absoft &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt g95 &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt gfortran &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt gfortranclang &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt intel &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,intelmpi,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt intelclang &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,intelmpi,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt intelgcc &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,intelmpi,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt nag &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt pgi &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Darwin &\tt xlf &\footnotesize \tt mpiuni,{\bf mpi},mpich,mpich1,mpich2,mpich3,lam,openmpi,user &\tt 32 \\ +Darwin &\tt xlfgcc &\footnotesize \tt mpiuni,{\bf mpi},mpich,mpich1,mpich2,mpich3,lam,openmpi,user &\tt 32 \\ +IRIX64 &\tt default &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 32, {\bf 64} \\ +Linux &\tt absoft &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Linux &\tt absoftintel &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,lam,openmpi,user &\tt 32, 64 \\ +Linux &\tt aocc &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich2, &\tt 32, 64, \\ + & &\footnotesize \tt intelmpi,lam,openmpi,user &\tt ia64\_64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt arm &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich2, &\tt 32, 64, \\ + & &\footnotesize \tt intelmpi,lam,openmpi,user &\tt ia64\_64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt g95 &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64, \\ + & & &\tt ia64\_64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt gfortran &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich2, &\tt 32, 64, \\ + & &\footnotesize \tt intelmpi,lam,openmpi,user &\tt ia64\_64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt gfortranclang &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich2, &\tt 32, 64, \\ + & & \footnotesize \tt lam,openmpi,user &\tt ia64\_64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt intel &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich2, &\tt 32, 64, \\ + & &\footnotesize \tt intelmpi,scalimpi,lam,openmpi,user &\tt ia64\_64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium, \\ + & & &\tt mic \\ +Linux &\tt intelgcc &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich2, &\tt 32, 64, \\ + & &\footnotesize \tt intelmpi,lam,openmpi,user &\tt ia64\_64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt lahey &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Linux &\tt llvm &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich2, &\tt 32, 64, \\ + & &\footnotesize \tt intelmpi,lam,openmpi,user &\tt ia64\_64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt nag &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,mvapich2,lam,openmpi,user &\tt 32, 64 \\ +Linux &\tt nagintel &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,lam,openmpi,user &\tt 32, 64 \\ +Linux &\tt nvhpc &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich,mvapich2 &\tt 32, 64, \\ + & &\footnotesize \tt intelmpi,openmpi,user &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt pathscale &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,lam,openmpi,user &\tt 32, 64, \\ + & & &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt pgi &\footnotesize \tt {\bf mpiuni},mpi,mpt,mpich,mpich1,mpich2,mpich3,mvapich,mvapich2 &\tt 32, 64, \\ + & &\footnotesize \tt intelmpi,scalimpi,lam,openmpi,user &\tt x86\_64\_32, \\ + & & &\tt x86\_64\_small, \\ + & & &\tt x86\_64\_medium \\ +Linux &\tt pgigcc &\footnotesize \tt {\bf mpiuni},mpich,mpich1,mpich2,mpich3,lam,openmpi,user &\tt 32 \\ +Linux &\tt sxcross &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 32 \\ +Linux &\tt xlf &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 32 \\ +MinGW &\tt gfortran &\footnotesize \tt {\bf mpiuni},msmpi,user &\tt 32, 64 \\ +MinGW &\tt intel &\footnotesize \tt {\bf mpiuni},msmpi,user &\tt 32, 64 \\ +MinGW &\tt intelcl &\footnotesize \tt {\bf mpiuni},msmpi,user &\tt 32, 64 \\ +OSF1 &\tt default &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 \\ +SunOS &\tt default &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 32, {\bf 64} \\ +Unicos &\tt default &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 \\ +Unicos &\tt aocc &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 \\ +Unicos &\tt cce &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 \\ +Unicos &\tt gfortran &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 \\ +Unicos &\tt intel &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 \\ +Unicos &\tt nvhpc &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 \\ +Unicos &\tt pathscale &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 \\ +Unicos &\tt pgi &\footnotesize \tt mpiuni,{\bf mpi},user &\tt 64 + +\end{longtable} \vspace{1ex} diff --git a/build_config/Darwin.gfortran.default/README b/build_config/Darwin.gfortran.default/README index 95d6be165a..3bf077b83d 100644 --- a/build_config/Darwin.gfortran.default/README +++ b/build_config/Darwin.gfortran.default/README @@ -1,12 +1,12 @@ -Settings for Darwin (Mac OS X), using the GNU gfortran compiler -(part of the GCC 4.0 release) and GNU C++ compiler (g++). Due to bugs -in early versions of gfortran, ESMF requires gfortran version 4.3 or newer. +Settings for Darwin (Mac OS X), using the GNU gfortran compiler +and GNU C++ compiler (g++). -On some Darwin systems, the clang compiler is provided as an alias to g++. -This is detected and properly supported. On systems where both g++ and clang -exist, ensure that the PATH environement variable is set correctly such that -the desired c++ environment is used. For example, if clang is the desired -compiler, the path to it should be prior to the path to the gcc bin directory. +On Mac OS X, the system-level g++ invokes clang++, so unless you ensure +that you have a true g++ early in your path (or build the MPI compiler +wrappers to ensure that they wrap the true g++), you will end up using +clang++ even if you think you are using the GNU C++ compiler. In that +case, you should use the gfortranclang configuration instead of this +gfortran configuration. Requires the following environment settings: diff --git a/build_config/Darwin.gfortran.default/build_rules.mk b/build_config/Darwin.gfortran.default/build_rules.mk index 6331b7ff43..0f11bc6cc3 100644 --- a/build_config/Darwin.gfortran.default/build_rules.mk +++ b/build_config/Darwin.gfortran.default/build_rules.mk @@ -114,14 +114,15 @@ ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} --version # See if g++ is really clang # ESMF_CLANGSTR := $(findstring clang, $(shell $(ESMF_CXXCOMPILER) --version)) +ifeq ($(ESMF_CLANGSTR), clang) +$(error "The detected C++ compiler is actually clang. Set ESMF_COMPILER=gfortranclang.") +endif ############################################################ # Special debug flags # ESMF_F90OPTFLAG_G += -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument -fbacktrace -fimplicit-none -fcheck=all,no-pointer -ifneq ($(ESMF_CLANGSTR), clang) ESMF_CXXOPTFLAG_G += -Wall -Wextra -Wno-unused -endif ############################################################ # Fortran symbol convention @@ -193,14 +194,19 @@ endif ############################################################ # OpenMP compiler and linker flags # -ifneq ($(ESMF_CLANGSTR), clang) ESMF_OPENMP_F90COMPILEOPTS += -fopenmp ESMF_OPENMP_CXXCOMPILEOPTS += -fopenmp ESMF_OPENMP_F90LINKOPTS += -fopenmp ESMF_OPENMP_CXXLINKOPTS += -fopenmp -else -ESMF_OPENMP=OFF -endif + +############################################################ +# OpenACC compiler and linker flags +# +ESMF_OPENACCDEFAULT = OFF +ESMF_OPENACC_F90COMPILEOPTS += -fopenacc +ESMF_OPENACC_CXXCOMPILEOPTS += -fopenacc +ESMF_OPENACC_F90LINKOPTS += -fopenacc +ESMF_OPENACC_CXXLINKOPTS += -fopenacc ############################################################ # Need this until the file convention is fixed (then remove these two lines) @@ -242,9 +248,6 @@ ESMF_CLINKRPATHS = # Link against libesmf.a using the F90 linker front-end # ESMF_F90LINKLIBS += -lstdc++ -ifeq ($(ESMF_CLANGSTR), clang) -ESMF_F90LINKLIBS += -lc++ -endif ############################################################ # Link against libesmf.a using the C++ linker front-end @@ -255,3 +258,11 @@ ESMF_CXXLINKLIBS += -lgfortran # Shared library options ESMF_SL_LIBOPTS += -dynamiclib ESMF_SL_LIBLIBS += $(ESMF_F90LINKPATHS) $(ESMF_F90LINKLIBS) $(ESMF_CXXLINKPATHS) $(ESMF_CXXLINKLIBS) + +############################################################ +# Shared object options +# +ESMF_SO_F90COMPILEOPTS = -fPIC +ESMF_SO_F90LINKOPTS = -shared +ESMF_SO_CXXCOMPILEOPTS = -fPIC +ESMF_SO_CXXLINKOPTS = -shared diff --git a/build_config/Darwin.gfortranclang.default/ESMC_Conf.h b/build_config/Darwin.gfortranclang.default/ESMC_Conf.h index d994615798..c55e5d0d8e 100644 --- a/build_config/Darwin.gfortranclang.default/ESMC_Conf.h +++ b/build_config/Darwin.gfortranclang.default/ESMC_Conf.h @@ -30,12 +30,8 @@ Licensed under the University of Illinois-NCSA License. #if defined (__cplusplus) // Typedef to match the data type of the 'hidden' string length // argument that Fortran uses when passing CHARACTER strings. -#if (__GNUC__ > 7) #include typedef size_t ESMCI_FortranStrLenArg; -#else -typedef int ESMCI_FortranStrLenArg; -#endif #endif #define ESMC_PRESENT(arg) ( (arg) != 0 ) diff --git a/build_config/Darwin.gfortranclang.default/README b/build_config/Darwin.gfortranclang.default/README index c75fffcbc1..5cee14a1a3 100644 --- a/build_config/Darwin.gfortranclang.default/README +++ b/build_config/Darwin.gfortranclang.default/README @@ -1,7 +1,20 @@ -Settings for Darwin (Mac OS X), using the GNU gfortran compiler -(part of the GCC 4.0 release) and the clang C++ compiler (g++). Due to bugs -in early versions of gfortran, ESMF requires gfortran version 4.3 or newer. +Settings for Darwin (Mac OS X), using the GNU gfortran compiler and the +clang C++ compiler (clang++). Note that, on Mac OS X, the system-level +g++ invokes clang++, so unless you ensure that you have a true g++ early +in your path (or build the MPI compiler wrappers to ensure that they +wrap the true g++), you will end up using clang++ even if you think you +are using the GNU C++ compiler, and so you should use this +configuration. Requires the following environment settings: ESMF_COMPILER gfortranclang + +CAUTION: +For ESMF regression testing we set ESMF_F90LINKERDEFAULT to the C++ +compiler in build_rules.mk because this is needed for clean handling of +exceptions for this compiler combination. For applications with main +programs in Fortran we have found that this is not always necessary. +However, if your application aborts with a message like "libc++abi: +terminating with uncaught exception", that is a sign that you may need +to link with a C++ compiler rather than a Fortran compiler. diff --git a/build_config/Darwin.gfortranclang.default/build_rules.mk b/build_config/Darwin.gfortranclang.default/build_rules.mk index 5903562187..1244029d6d 100644 --- a/build_config/Darwin.gfortranclang.default/build_rules.mk +++ b/build_config/Darwin.gfortranclang.default/build_rules.mk @@ -1,17 +1,18 @@ # $Id$ # -# Darwin.gfortran.default +# Darwin.gfortranclang.default # ############################################################ # Default compiler setting. # ESMF_F90DEFAULT = gfortran -ESMF_CXXDEFAULT = clang +ESMF_F90LINKERDEFAULT = clang++ +ESMF_CXXDEFAULT = clang++ ESMF_CDEFAULT = clang ESMF_CPPDEFAULT = clang -E -P -x c -ESMF_CXXCOMPILECPPFLAGS += -x c++ +ESMF_CXXCOMPILEOPTS += -x c++ -mmacosx-version-min=10.7 -stdlib=libc++ ############################################################ # Default MPI setting. @@ -35,6 +36,7 @@ ifeq ($(ESMF_COMM),mpich1) ESMF_F90COMPILECPPFLAGS+= -DESMF_MPICH1 ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPICH1 ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKERDEFAULT = mpiCC ESMF_CXXDEFAULT = mpiCC ESMF_CDEFAULT = mpicc ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) @@ -44,6 +46,7 @@ else ifeq ($(ESMF_COMM),mpich2) # Mpich2 --------------------------------------------------- ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKERDEFAULT = mpicxx ESMF_CXXDEFAULT = mpicxx ESMF_CDEFAULT = mpicc ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) @@ -54,15 +57,18 @@ else ifeq ($(ESMF_COMM),mpich) # Mpich3 and up -------------------------------------------- ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKERDEFAULT = mpicxx ESMF_CXXDEFAULT = mpicxx ESMF_CDEFAULT = mpicc ESMF_CXXLINKLIBS += $(shell $(ESMF_DIR)/scripts/libs.mpich3f90) +ESMF_F90LINKLIBS += $(shell $(ESMF_DIR)/scripts/libs.mpich3f90) ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) else ifeq ($(ESMF_COMM),mvapich2) # Mvapich2 ------------------------------------------------- ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKERDEFAULT = mpicxx ESMF_CXXDEFAULT = mpicxx ESMF_CDEFAULT = mpicc ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) @@ -72,6 +78,7 @@ ifeq ($(ESMF_COMM),lam) # LAM (assumed to be built with gfortran) ------------------ ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2 ESMF_F90DEFAULT = mpif77 +ESMF_F90LINKERDEFAULT = mpic++ ESMF_CXXDEFAULT = mpic++ ESMF_CDEFAULT = mpicc ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) @@ -86,8 +93,9 @@ ESMF_F90DEFAULT = mpifort else ESMF_F90DEFAULT = mpif90 endif +ESMF_F90LINKERDEFAULT = mpicxx ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2 -ESMF_F90LINKLIBS += $(shell $(ESMF_DIR)/scripts/libs.openmpif90 $(ESMF_F90DEFAULT)) +ESMF_F90LINKLIBS += $(shell $(ESMF_DIR)/scripts/libs.openmpif90_forcxx $(ESMF_F90DEFAULT)) ESMF_CXXDEFAULT = mpicxx ESMF_CDEFAULT = mpicc ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) @@ -116,14 +124,9 @@ ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} -v --version ############################################################ # Special debug flags # -ESMF_F90OPTFLAG_G += -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument -fbacktrace -fimplicit-none -fcheck=all,no-pointer +ESMF_F90OPTFLAG_G += -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument -fimplicit-none -fcheck=all,no-pointer ESMF_CXXOPTFLAG_G += -Wall -Wextra -Wno-unused -############################################################ -# Gfortran runtime library on Darwin does not currently seem thread-safe -# -ESMF_PTHREADS := OFF - ############################################################ # Fortran symbol convention # @@ -207,6 +210,12 @@ ESMF_F90COMPILEFIXCPP = -cpp -ffixed-form # ESMF_F90COMPILEOPTS += -ffree-line-length-none +############################################################ +# Trying to produce a backtrace can lead programs to hang without any useful information +# rather than aborting cleanly, so disable backtraces. +# +ESMF_F90COMPILEOPTS += -fno-backtrace + ############################################################ # Set rpath syntax # @@ -214,22 +223,6 @@ ESMF_F90RPATHPREFIX = -Wl,-rpath, ESMF_CXXRPATHPREFIX = -Wl,-rpath, ESMF_CRPATHPREFIX = -Wl,-rpath, -############################################################ -# Determine where clang's libraries are located -# -# TODO: The -print-file-name option doesn't seem to work properly yet. -#ESMF_LIBSTDCXX := $(shell $(ESMF_CXXCOMPILER) -print-file-name=libstdc++.dylib) -#ifeq ($(ESMF_LIBSTDCXX),libstdc++.dylib) -#ESMF_LIBSTDCXX := $(shell $(ESMF_CXXCOMPILER) -print-file-name=libstdc++.a) -#endif -#ESMF_F90LINKPATHS += -L$(dir $(ESMF_LIBSTDCXX)) - -#ESMF_LIBCXX := $(shell $(ESMF_CXXCOMPILER) -print-file-name=libc++.dylib) -#ifeq ($(ESMF_LIBCXX),libc++.dylib) -#ESMF_LIBCXX := $(shell $(ESMF_CXXCOMPILER) -print-file-name=libc++.a) -#endif -#ESMF_F90LINKPATHS += -L$(dir $(ESMF_LIBCXX)) - ############################################################ # Determine where gfortran's libraries are located # @@ -239,24 +232,33 @@ ESMF_LIBGFORTRAN := $(shell $(ESMF_F90COMPILER) -print-file-name=libgfortran.a) endif ESMF_CXXLINKPATHS += -L$(dir $(ESMF_LIBGFORTRAN)) ESMF_CXXLINKRPATHS += $(ESMF_CXXRPATHPREFIX)$(dir $(ESMF_LIBGFORTRAN)) - -############################################################ -# Link against libesmf.a using the F90 linker front-end -# -ESMF_F90LINKLIBS += -lstdc++ -lc++ +# With clang, we use a C++ linker for Fortran programs, so use the same link paths as for CXX: +ESMF_F90LINKPATHS += -L$(dir $(ESMF_LIBGFORTRAN)) +ESMF_F90LINKRPATHS += $(ESMF_CXXRPATHPREFIX)$(dir $(ESMF_LIBGFORTRAN)) ############################################################ # Link against libesmf.a using the C++ linker front-end # -ESMF_CXXLINKLIBS += -lgfortran -lstdc++ -lc++ +ESMF_CXXLINKLIBS += -lgfortran +# With clang, we use a C++ linker for Fortran programs, so use the same link libs as for CXX: +ESMF_F90LINKLIBS += -lgfortran ############################################################ # Shared library options ESMF_SL_LIBOPTS += -dynamiclib -ESMF_SL_LIBLIBS += $(ESMF_F90LINKPATHS) $(ESMF_F90LINKLIBS) $(ESMF_CXXLINKPATHS) $(ESMF_CXXLINKLIBS) +# No need for "$(ESMF_F90LINKPATHS) $(ESMF_F90LINKLIBS)" in the following because they are identical to the CXX versions: +ESMF_SL_LIBLIBS += $(ESMF_CXXLINKPATHS) $(ESMF_CXXLINKLIBS) ############################################################ # Static builds on Darwin do not support trace lib due to missing linker option ifeq ($(ESMF_SHARED_LIB_BUILD),OFF) ESMF_TRACE_LIB_BUILD = OFF endif + +############################################################ +# Shared object options +# +ESMF_SO_F90COMPILEOPTS = -fPIC +ESMF_SO_F90LINKOPTS = -shared +ESMF_SO_CXXCOMPILEOPTS = -fPIC +ESMF_SO_CXXLINKOPTS = -shared diff --git a/build_config/Linux.aocc.default/ESMC_Conf.h b/build_config/Linux.aocc.default/ESMC_Conf.h new file mode 100644 index 0000000000..e38d89f02c --- /dev/null +++ b/build_config/Linux.aocc.default/ESMC_Conf.h @@ -0,0 +1,43 @@ +#ifdef ESMC_RCS_HEADER +"$Id$" +"Defines the configuration for this machine" +#endif + +#if 0 +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif + +#if !defined(INCLUDED_CONF_H) +#define INCLUDED_CONF_H + +#define PARCH_linux + +#ifdef ESMF_LOWERCASE_SINGLEUNDERSCORE +#define FTN_X(func) func##_ +#define FTNX(func) func##_ +#endif +#ifdef ESMF_LOWERCASE_DOUBLEUNDERSCORE +#define FTN_X(func) func##__ +#define FTNX(func) func##_ +#endif + +#if defined (__cplusplus) +// Typedef to match the data type of the 'hidden' string length +// argument that Fortran uses when passing CHARACTER strings. +#if (__GNUC__ > 7) +#include +typedef size_t ESMCI_FortranStrLenArg; +#else +typedef int ESMCI_FortranStrLenArg; +#endif +#endif + +#define ESMC_PRESENT(arg) ( (arg) != 0 ) + +#endif diff --git a/build_config/Linux.aocc.default/ESMF_Conf.inc b/build_config/Linux.aocc.default/ESMF_Conf.inc new file mode 100644 index 0000000000..28343681b2 --- /dev/null +++ b/build_config/Linux.aocc.default/ESMF_Conf.inc @@ -0,0 +1,22 @@ +#if 0 +$Id$ + +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif + +#if !defined(__cplusplus) +#if (__GNUC__ == 4) && (__GNUC_MINOR__ < 5) +#error "The gfortran compiler must be version 4.5 or newer." +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ < 6) +#define ESMF_NO_F2003_ALLOC_STRING_LENS +#endif + +#endif diff --git a/build_config/Linux.aocc.default/README b/build_config/Linux.aocc.default/README new file mode 100644 index 0000000000..d93a29a30e --- /dev/null +++ b/build_config/Linux.aocc.default/README @@ -0,0 +1,5 @@ +Settings for Linux, using the AMD Optimized Compilers (AOCC). + +Requires the following environment settings: + +ESMF_COMPILER aocc diff --git a/build_config/Linux.aocc.default/build_rules.mk b/build_config/Linux.aocc.default/build_rules.mk new file mode 100644 index 0000000000..8636c5f1a9 --- /dev/null +++ b/build_config/Linux.aocc.default/build_rules.mk @@ -0,0 +1,271 @@ +# $Id$ +# +# Linux.aocc.default +# + +############################################################ +# Default compiler setting. +# +ESMF_F90DEFAULT = flang +ESMF_CXXDEFAULT = clang++ +ESMF_CDEFAULT = clang +ESMF_CPPDEFAULT = clang -E -P -x c + +ESMF_CXXCOMPILECPPFLAGS += -x c++ + +############################################################ +# Default MPI setting. +# +ifeq ($(ESMF_COMM),default) +export ESMF_COMM := mpiuni +endif + +############################################################ +# MPI dependent settings. +# +ifeq ($(ESMF_COMM),mpiuni) +# MPI stub library ----------------------------------------- +ESMF_F90COMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILEPATHS += -I$(ESMF_DIR)/src/Infrastructure/stubs/mpiuni +ESMF_MPIRUNDEFAULT = $(ESMF_DIR)/src/Infrastructure/stubs/mpiuni/mpirun +else +ifeq ($(ESMF_COMM),mpi) +# Vendor MPI ----------------------------------------------- +ESMF_F90LINKLIBS += -lmpi -lmpi++ +ESMF_CXXLINKLIBS += -lmpi -lmpi++ +ESMF_MPIRUNDEFAULT = mpiexec_mpt $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec_mpt $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mpt) +# MPT with compiler wrappers ------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKLIBS += -lmpi++ +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mpich1) +# Mpich1 --------------------------------------------------- +ESMF_F90COMPILECPPFLAGS+= -DESMF_MPICH1 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPICH1 +ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKLIBS += -lpmpich++ -lmpich +ESMF_CXXDEFAULT = mpiCC +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),mpich2) +# Mpich2 --------------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),mpich) +# Mpich3 and up -------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mvapich2) +# Mvapich2 --------------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),lam) +# LAM (assumed to be built with gfortran) ----------------------- +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2 +ESMF_F90DEFAULT = mpif77 +ESMF_CXXDEFAULT = mpic++ +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),openmpi) +# OpenMPI -------------------------------------------------- +ifeq ($(shell $(ESMF_DIR)/scripts/available mpifort),mpifort) +ESMF_F90DEFAULT = mpifort +else +ESMF_F90DEFAULT = mpif90 +endif +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2 +ESMF_F90LINKLIBS += $(shell $(ESMF_DIR)/scripts/libs.openmpif90 $(ESMF_F90DEFAULT)) +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),user) +# User specified flags ------------------------------------- +else +$(error Invalid ESMF_COMM setting: $(ESMF_COMM)) +endif +endif +endif +endif +endif +endif +endif +endif +endif +endif + +############################################################ +# Print compiler version string +# +ESMF_F90COMPILER_VERSION = ${ESMF_F90COMPILER} -v --version +ESMF_CXXCOMPILER_VERSION = ${ESMF_CXXCOMPILER} -v --version +ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} -v --version + +############################################################ +# Currently no support the Fortran2018 assumed type feature +# +ESMF_F90COMPILECPPFLAGS += -DESMF_NO_F2018ASSUMEDTYPE +ESMF_CXXCOMPILECPPFLAGS += -DESMF_NO_F2018ASSUMEDTYPE + +############################################################ +# Special debug flags +# +ESMF_F90OPTFLAG_G += -Wall -Wextra -Wconversion -Wno-unused + +############################################################ +# Fortran symbol convention +# +ifeq ($(ESMF_FORTRANSYMBOLS),default) +ESMF_F90COMPILEOPTS += +ESMF_F90LINKOPTS += +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_SINGLEUNDERSCORE +else +ifeq ($(ESMF_FORTRANSYMBOLS),lowercase_singleunderscore) +ESMF_F90COMPILEOPTS += -fno-second-underscore +ESMF_F90LINKOPTS += -fno-second-underscore +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_SINGLEUNDERSCORE +else +ifeq ($(ESMF_FORTRANSYMBOLS),lowercase_doubleunderscore) +ESMF_F90COMPILEOPTS += -fsecond-underscore +ESMF_F90LINKOPTS += -fsecond-underscore +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_DOUBLEUNDERSCORE +else +$(error "ESMF_FORTRANSYMBOLS = $(ESMF_FORTRANSYMBOLS)" not supported by ESMF and/or this platform) +endif +endif +endif + +############################################################ +# Construct the ABISTRING +# +ifeq ($(ESMF_MACHINE),ia64) +ifeq ($(ESMF_ABI),64) +ESMF_ABISTRING := $(ESMF_MACHINE)_64 +else +$(error Invalid ESMF_MACHINE / ESMF_ABI combination: $(ESMF_MACHINE) / $(ESMF_ABI)) +endif +endif +ifeq ($(ESMF_MACHINE),x86_64) +ifeq ($(ESMF_ABI),32) +ESMF_ABISTRING := $(ESMF_MACHINE)_32 +endif +ifeq ($(ESMF_ABI),64) +ESMF_ABISTRING := x86_64_small +endif +endif + +############################################################ +# Set memory model compiler flags according to ABISTRING +# +ifeq ($(ESMF_ABISTRING),x86_64_32) +ESMF_CXXCOMPILEOPTS += -m32 +ESMF_CXXLINKOPTS += -m32 +ESMF_F90COMPILEOPTS += -m32 +ESMF_F90LINKOPTS += -m32 +endif +ifeq ($(ESMF_ABISTRING),x86_64_small) +ESMF_CXXCOMPILEOPTS += -m64 -mcmodel=small +ESMF_CXXLINKOPTS += -m64 -mcmodel=small +ESMF_F90COMPILEOPTS += -m64 -mcmodel=small +ESMF_F90LINKOPTS += -m64 -mcmodel=small +endif +ifeq ($(ESMF_ABISTRING),x86_64_medium) +ESMF_CXXCOMPILEOPTS += -m64 -mcmodel=medium +ESMF_CXXLINKOPTS += -m64 -mcmodel=medium +ESMF_F90COMPILEOPTS += -m64 -mcmodel=medium +ESMF_F90LINKOPTS += -m64 -mcmodel=medium +endif + +############################################################ +# Conditionally add pthread compiler and linker flags +# +ifeq ($(ESMF_PTHREADS),ON) +ESMF_F90COMPILEOPTS += -pthread +ESMF_CXXCOMPILEOPTS += -pthread +ESMF_F90LINKOPTS += -pthread +ESMF_CXXLINKOPTS += -pthread +endif + +############################################################ +# OpenMP compiler and linker flags +# +ESMF_OPENMP=ON +ESMF_OPENMP_F90COMPILEOPTS += -fopenmp +ESMF_OPENMP_CXXCOMPILEOPTS += -fopenmp +ESMF_OPENMP_F90LINKOPTS += -fopenmp +ESMF_OPENMP_CXXLINKOPTS += -fopenmp + +############################################################ +# Need this until the file convention is fixed (then remove these two lines) +# +ESMF_F90COMPILEFREENOCPP = -ffree-form +ESMF_F90COMPILEFIXCPP = -cpp -ffixed-form + +############################################################ +# Set rpath syntax +# +ESMF_F90RPATHPREFIX = -Wl,-rpath, +ESMF_CXXRPATHPREFIX = -Wl,-rpath, +ESMF_CRPATHPREFIX = -Wl,-rpath, + +############################################################ +# Link against libesmf.a using the F90 linker front-end +# +ESMF_F90LINKLIBS += -lrt -lstdc++ -ldl + +############################################################ +# Link against libesmf.a using the C++ linker front-end +# +ESMF_CXXLINKLIBS += -lrt -lflang -lflangrti -lpgmath -ldl + +############################################################ +# Linker option that ensures that the specified libraries are +# used to also resolve symbols needed by other libraries. +# +ESMF_F90LINKOPTS += -Wl,--no-as-needed +ESMF_CXXLINKOPTS += -Wl,--no-as-needed + +############################################################ +# Shared library options +# +ESMF_SL_LIBOPTS += -shared + +############################################################ +# Shared object options +# +ESMF_SO_F90COMPILEOPTS = -fPIC +ESMF_SO_F90LINKOPTS = -shared +ESMF_SO_F90LINKOPTSEXE = -Wl,-export-dynamic +ESMF_SO_CXXCOMPILEOPTS = -fPIC +ESMF_SO_CXXLINKOPTS = -shared +ESMF_SO_CXXLINKOPTSEXE = -Wl,-export-dynamic diff --git a/build_config/Linux.arm.default/ESMC_Conf.h b/build_config/Linux.arm.default/ESMC_Conf.h new file mode 100644 index 0000000000..3aedb38650 --- /dev/null +++ b/build_config/Linux.arm.default/ESMC_Conf.h @@ -0,0 +1,39 @@ +#ifdef ESMC_RCS_HEADER +"$Id$" +"Defines the configuration for this machine" +#endif + +#if 0 +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif + +#if !defined(INCLUDED_CONF_H) +#define INCLUDED_CONF_H + +#define PARCH_linux + +#ifdef ESMF_LOWERCASE_SINGLEUNDERSCORE +#define FTN_X(func) func##_ +#define FTNX(func) func##_ +#endif +#ifdef ESMF_LOWERCASE_DOUBLEUNDERSCORE +#define FTN_X(func) func##__ +#define FTNX(func) func##_ +#endif + +#if defined (__cplusplus) +// Typedef to match the data type of the 'hidden' string length +// argument that Fortran uses when passing CHARACTER strings. +#include +typedef size_t ESMCI_FortranStrLenArg; +#endif + +#define ESMC_PRESENT(arg) ( (arg) != 0 ) + +#endif diff --git a/build_config/Linux.arm.default/ESMF_Conf.inc b/build_config/Linux.arm.default/ESMF_Conf.inc new file mode 100644 index 0000000000..7c130bde51 --- /dev/null +++ b/build_config/Linux.arm.default/ESMF_Conf.inc @@ -0,0 +1,11 @@ +#if 0 +$Id$ + +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif diff --git a/build_config/Linux.arm.default/README b/build_config/Linux.arm.default/README new file mode 100644 index 0000000000..d3ee1bbfad --- /dev/null +++ b/build_config/Linux.arm.default/README @@ -0,0 +1,5 @@ +Settings for Linux, using the ARM compilers: armclang and armflang. + +Requires the following environment settings: + +ESMF_COMPILER arm diff --git a/build_config/Linux.arm.default/build_rules.mk b/build_config/Linux.arm.default/build_rules.mk new file mode 100644 index 0000000000..f6767aaa31 --- /dev/null +++ b/build_config/Linux.arm.default/build_rules.mk @@ -0,0 +1,296 @@ +# $Id$ +# +# Linux.arm.default +# + +############################################################ +# Default compiler setting. +# +ESMF_F90DEFAULT = armflang +ESMF_CXXDEFAULT = armclang +ESMF_CDEFAULT = armclang +ESMF_CPPDEFAULT = armclang -E -P -x c + +ESMF_CXXCOMPILECPPFLAGS += -x c++ + +############################################################ +# Default MPI setting. +# +ifeq ($(ESMF_COMM),default) +export ESMF_COMM := mpiuni +endif + +############################################################ +# MPI dependent settings. +# +ifeq ($(ESMF_COMM),mpiuni) +# MPI stub library ----------------------------------------- +ESMF_F90COMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILEPATHS += -I$(ESMF_DIR)/src/Infrastructure/stubs/mpiuni +ESMF_MPIRUNDEFAULT = $(ESMF_DIR)/src/Infrastructure/stubs/mpiuni/mpirun +else +ifeq ($(ESMF_COMM),mpi) +# Vendor MPI ----------------------------------------------- +ESMF_F90LINKLIBS += -lmpi -lmpi++ +ESMF_CXXLINKLIBS += -lmpi -lmpi++ +ESMF_MPIRUNDEFAULT = mpiexec_mpt $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec_mpt $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mpt) +# MPT with compiler wrappers ------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKLIBS += -lmpi++ +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mpich1) +# Mpich1 --------------------------------------------------- +ESMF_F90COMPILECPPFLAGS+= -DESMF_MPICH1 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPICH1 +ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKLIBS += -lpmpich++ -lmpich +ESMF_CXXDEFAULT = mpiCC +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),mpich2) +# Mpich2 --------------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),mpich) +# Mpich3 and up -------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mvapich2) +# Mvapich2 --------------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),lam) +# LAM (assumed to be built with armflang) ----------------------- +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2 +ESMF_F90DEFAULT = mpif77 +ESMF_CXXDEFAULT = mpic++ +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),openmpi) +# OpenMPI -------------------------------------------------- +ifeq ($(shell $(ESMF_DIR)/scripts/available mpifort),mpifort) +ESMF_F90DEFAULT = mpifort +else +ESMF_F90DEFAULT = mpif90 +endif +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2 +ESMF_F90LINKLIBS += $(shell $(ESMF_DIR)/scripts/libs.openmpif90 $(ESMF_F90DEFAULT)) +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),user) +# User specified flags ------------------------------------- +else +$(error Invalid ESMF_COMM setting: $(ESMF_COMM)) +endif +endif +endif +endif +endif +endif +endif +endif +endif +endif + +############################################################ +# Print compiler version string +# +ESMF_F90COMPILER_VERSION = ${ESMF_F90COMPILER} -v --version +ESMF_CXXCOMPILER_VERSION = ${ESMF_CXXCOMPILER} -v --version +ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} -v --version + +############################################################ +# Currently no support for the Fortran2018 assumed type feature +# +ESMF_F90COMPILECPPFLAGS += -DESMF_NO_F2018ASSUMEDTYPE +ESMF_CXXCOMPILECPPFLAGS += -DESMF_NO_F2018ASSUMEDTYPE + +############################################################ +# Special debug flags +# +ESMF_F90OPTFLAG_G += -Wall -Wextra -Wconversion -Wno-unused -Wno-unused-dummy-argument -fbacktrace -fimplicit-none -fcheck=all,no-pointer + +############################################################ +# Fortran symbol convention +# +ifeq ($(ESMF_FORTRANSYMBOLS),default) +ESMF_F90COMPILEOPTS += +ESMF_F90LINKOPTS += +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_SINGLEUNDERSCORE +else +ifeq ($(ESMF_FORTRANSYMBOLS),lowercase_singleunderscore) +ESMF_F90COMPILEOPTS += -fno-second-underscore +ESMF_F90LINKOPTS += -fno-second-underscore +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_SINGLEUNDERSCORE +else +ifeq ($(ESMF_FORTRANSYMBOLS),lowercase_doubleunderscore) +ESMF_F90COMPILEOPTS += -fsecond-underscore +ESMF_F90LINKOPTS += -fsecond-underscore +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_DOUBLEUNDERSCORE +else +$(error "ESMF_FORTRANSYMBOLS = $(ESMF_FORTRANSYMBOLS)" not supported by ESMF and/or this platform) +endif +endif +endif + +############################################################ +# Construct the ABISTRING +# +ifeq ($(ESMF_MACHINE),ia64) +ifeq ($(ESMF_ABI),64) +ESMF_ABISTRING := $(ESMF_MACHINE)_64 +else +$(error Invalid ESMF_MACHINE / ESMF_ABI combination: $(ESMF_MACHINE) / $(ESMF_ABI)) +endif +endif +ifeq ($(ESMF_MACHINE),x86_64) +ifeq ($(ESMF_ABI),32) +ESMF_ABISTRING := $(ESMF_MACHINE)_32 +endif +ifeq ($(ESMF_ABI),64) +ESMF_ABISTRING := x86_64_small +endif +endif + +############################################################ +# Set memory model compiler flags according to ABISTRING +# +ifeq ($(ESMF_ABISTRING),x86_64_32) +ESMF_CXXCOMPILEOPTS += -m32 +ESMF_CXXLINKOPTS += -m32 +ESMF_F90COMPILEOPTS += -m32 +ESMF_F90LINKOPTS += -m32 +endif +ifeq ($(ESMF_ABISTRING),x86_64_small) +ESMF_CXXCOMPILEOPTS += -m64 -mcmodel=small +ESMF_CXXLINKOPTS += -m64 -mcmodel=small +ESMF_F90COMPILEOPTS += -m64 -mcmodel=small +ESMF_F90LINKOPTS += -m64 -mcmodel=small +endif +ifeq ($(ESMF_ABISTRING),x86_64_medium) +ESMF_CXXCOMPILEOPTS += -m64 -mcmodel=medium +ESMF_CXXLINKOPTS += -m64 -mcmodel=medium +ESMF_F90COMPILEOPTS += -m64 -mcmodel=medium +ESMF_F90LINKOPTS += -m64 -mcmodel=medium +endif + +############################################################ +# Conditionally add pthread compiler and linker flags +# +ifeq ($(ESMF_PTHREADS),ON) +ESMF_F90COMPILEOPTS += -pthread +ESMF_CXXCOMPILEOPTS += -pthread +ESMF_F90LINKOPTS += -pthread +ESMF_CXXLINKOPTS += -pthread +endif + +############################################################ +# OpenMP compiler and linker flags +# +ESMF_OPENMP=OFF +# ESMF_OPENMP_F90COMPILEOPTS += -fopenmp +# ESMF_OPENMP_CXXCOMPILEOPTS += -fopenmp +# ESMF_OPENMP_F90LINKOPTS += -fopenmp +# ESMF_OPENMP_CXXLINKOPTS += -fopenmp + +############################################################ +# Need this until the file convention is fixed (then remove these two lines) +# +ESMF_F90COMPILEFREENOCPP = -ffree-form +ESMF_F90COMPILEFIXCPP = -cpp -ffixed-form + +############################################################ +# Set unlimited line length limit for free format files +# +ESMF_F90COMPILEOPTS += -ffree-line-length-none + +############################################################ +# Set rpath syntax +# +ESMF_F90RPATHPREFIX = -Wl,-rpath, +ESMF_CXXRPATHPREFIX = -Wl,-rpath, +ESMF_CRPATHPREFIX = -Wl,-rpath, + +############################################################ +# Determine where gcc's libraries are located +# +ESMF_LIBSTDCXX := $(shell $(ESMF_CXXCOMPILER) $(ESMF_CXXCOMPILEOPTS) -print-file-name=libstdc++.so) +ifeq ($(ESMF_LIBSTDCXX),libstdc++.so) +ESMF_LIBSTDCXX := $(shell $(ESMF_CXXCOMPILER) $(ESMF_CXXCOMPILEOPTS) -print-file-name=libstdc++.a) +endif +ESMF_F90LINKPATHS += -L$(dir $(ESMF_LIBSTDCXX)) +ESMF_F90LINKRPATHS += $(ESMF_F90RPATHPREFIX)$(dir $(ESMF_LIBSTDCXX)) + +############################################################ +# Determine where armflang's libraries are located +# +ESMF_LIBARMFLANG := $(shell $(ESMF_F90COMPILER) $(ESMF_F90COMPILEOPTS) -print-file-name=libarmflang.so) +ifeq ($(ESMF_LIBARMFLANG),libarmflang.so) +ESMF_LIBARMFLANG := $(shell $(ESMF_F90COMPILER) $(ESMF_F90COMPILEOPTS) -print-file-name=libarmflang.a) +endif +ESMF_CXXLINKPATHS += -L$(dir $(ESMF_LIBARMFLANG)) +ESMF_CXXLINKRPATHS += $(ESMF_CXXRPATHPREFIX)$(dir $(ESMF_LIBARMFLANG)) + +############################################################ +# Link against libesmf.a using the F90 linker front-end +# +ESMF_F90LINKLIBS += -lrt -lstdc++ -ldl + +############################################################ +# Link against libesmf.a using the C++ linker front-end +# +ESMF_CXXLINKLIBS += -lrt -larmflang -lstdc++ -lm -ldl + +############################################################ +# Linker option that ensures that the specified libraries are +# used to also resolve symbols needed by other libraries. +# +ESMF_F90LINKOPTS += -Wl,--no-as-needed +ESMF_CXXLINKOPTS += -Wl,--no-as-needed + +############################################################ +# Shared library options +# +ESMF_SL_LIBOPTS += -shared + +############################################################ +# Shared object options +# +ESMF_SO_F90COMPILEOPTS = -fPIC +ESMF_SO_F90LINKOPTS = -shared +ESMF_SO_F90LINKOPTSEXE = -Wl,-export-dynamic +ESMF_SO_CXXCOMPILEOPTS = -fPIC +ESMF_SO_CXXLINKOPTS = -shared +ESMF_SO_CXXLINKOPTSEXE = -Wl,-export-dynamic diff --git a/build_config/Linux.gfortran.default/README b/build_config/Linux.gfortran.default/README index fd176606a0..e694b5fc52 100644 --- a/build_config/Linux.gfortran.default/README +++ b/build_config/Linux.gfortran.default/README @@ -1,6 +1,4 @@ -Settings for Linux, using the gfortran compiler that comes with the GCC of -version 4.0.0 and up. Due to bugs in early versions of gfortran, ESMF -requires gfortran version 4.3 or newer. +Settings for Linux, using the GNU gfortran compiler and GNU C++ compiler (g++). Requires the following environment settings: diff --git a/build_config/Linux.gfortran.default/build_rules.mk b/build_config/Linux.gfortran.default/build_rules.mk index a4a55e3c84..dbbb1e557d 100644 --- a/build_config/Linux.gfortran.default/build_rules.mk +++ b/build_config/Linux.gfortran.default/build_rules.mk @@ -230,6 +230,15 @@ ESMF_OPENMP_CXXCOMPILEOPTS += -fopenmp ESMF_OPENMP_F90LINKOPTS += -fopenmp ESMF_OPENMP_CXXLINKOPTS += -fopenmp +############################################################ +# OpenACC compiler and linker flags +# +ESMF_OPENACCDEFAULT = OFF +ESMF_OPENACC_F90COMPILEOPTS += -fopenacc +ESMF_OPENACC_CXXCOMPILEOPTS += -fopenacc +ESMF_OPENACC_F90LINKOPTS += -fopenacc +ESMF_OPENACC_CXXLINKOPTS += -fopenacc + ############################################################ # Need this until the file convention is fixed (then remove these two lines) # diff --git a/build_config/Linux.gfortranclang.default/ESMC_Conf.h b/build_config/Linux.gfortranclang.default/ESMC_Conf.h index e38d89f02c..3aedb38650 100644 --- a/build_config/Linux.gfortranclang.default/ESMC_Conf.h +++ b/build_config/Linux.gfortranclang.default/ESMC_Conf.h @@ -30,12 +30,8 @@ Licensed under the University of Illinois-NCSA License. #if defined (__cplusplus) // Typedef to match the data type of the 'hidden' string length // argument that Fortran uses when passing CHARACTER strings. -#if (__GNUC__ > 7) #include typedef size_t ESMCI_FortranStrLenArg; -#else -typedef int ESMCI_FortranStrLenArg; -#endif #endif #define ESMC_PRESENT(arg) ( (arg) != 0 ) diff --git a/build_config/Linux.gfortranclang.default/README b/build_config/Linux.gfortranclang.default/README index 8386deb4ae..d619483db5 100644 --- a/build_config/Linux.gfortranclang.default/README +++ b/build_config/Linux.gfortranclang.default/README @@ -1,6 +1,4 @@ -Settings for Linux, using the clang C++ compiler and gfortran compiler. -Due to bugs in early versions of gfortran, ESMF requires gfortran version 4.3 -or newer. +Settings for Linux, using the clang C++ compiler and GNU gfortran compiler. Requires the following environment settings: diff --git a/build_config/Linux.llvm.default/ESMC_Conf.h b/build_config/Linux.llvm.default/ESMC_Conf.h new file mode 100644 index 0000000000..3aedb38650 --- /dev/null +++ b/build_config/Linux.llvm.default/ESMC_Conf.h @@ -0,0 +1,39 @@ +#ifdef ESMC_RCS_HEADER +"$Id$" +"Defines the configuration for this machine" +#endif + +#if 0 +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif + +#if !defined(INCLUDED_CONF_H) +#define INCLUDED_CONF_H + +#define PARCH_linux + +#ifdef ESMF_LOWERCASE_SINGLEUNDERSCORE +#define FTN_X(func) func##_ +#define FTNX(func) func##_ +#endif +#ifdef ESMF_LOWERCASE_DOUBLEUNDERSCORE +#define FTN_X(func) func##__ +#define FTNX(func) func##_ +#endif + +#if defined (__cplusplus) +// Typedef to match the data type of the 'hidden' string length +// argument that Fortran uses when passing CHARACTER strings. +#include +typedef size_t ESMCI_FortranStrLenArg; +#endif + +#define ESMC_PRESENT(arg) ( (arg) != 0 ) + +#endif diff --git a/build_config/Linux.llvm.default/ESMF_Conf.inc b/build_config/Linux.llvm.default/ESMF_Conf.inc new file mode 100644 index 0000000000..7c130bde51 --- /dev/null +++ b/build_config/Linux.llvm.default/ESMF_Conf.inc @@ -0,0 +1,11 @@ +#if 0 +$Id$ + +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif diff --git a/build_config/Linux.llvm.default/README b/build_config/Linux.llvm.default/README new file mode 100644 index 0000000000..32e8e40f21 --- /dev/null +++ b/build_config/Linux.llvm.default/README @@ -0,0 +1,10 @@ +Settings for Linux, using the LLVM compilers: clang and flang-new. + +Requires the following environment settings: + +ESMF_COMPILER llvm + +CAUTION: +This configuration, last tested with LLVM 15.0.1 from https://github.com/llvm/llvm-project.git, +has NOT been able to successfully build the ESMF library. The configuration is included with +ESMF for future testing with LLVM, and will likely require modifications. diff --git a/build_config/Linux.llvm.default/build_rules.mk b/build_config/Linux.llvm.default/build_rules.mk new file mode 100644 index 0000000000..cb7bcae9f3 --- /dev/null +++ b/build_config/Linux.llvm.default/build_rules.mk @@ -0,0 +1,290 @@ +# $Id$ +# +# Linux.llvm.default +# + +############################################################ +# Default compiler setting. +# +ESMF_F90DEFAULT = flang-new +ESMF_CXXDEFAULT = clang +ESMF_CDEFAULT = clang +ESMF_CPPDEFAULT = clang -E -P -x c + +ESMF_CXXCOMPILECPPFLAGS += -x c++ + +############################################################ +# Default MPI setting. +# +ifeq ($(ESMF_COMM),default) +export ESMF_COMM := mpiuni +endif + +############################################################ +# MPI dependent settings. +# +ifeq ($(ESMF_COMM),mpiuni) +# MPI stub library ----------------------------------------- +ESMF_F90COMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILEPATHS += -I$(ESMF_DIR)/src/Infrastructure/stubs/mpiuni +ESMF_MPIRUNDEFAULT = $(ESMF_DIR)/src/Infrastructure/stubs/mpiuni/mpirun +else +ifeq ($(ESMF_COMM),mpi) +# Vendor MPI ----------------------------------------------- +ESMF_F90LINKLIBS += -lmpi -lmpi++ +ESMF_CXXLINKLIBS += -lmpi -lmpi++ +ESMF_MPIRUNDEFAULT = mpiexec_mpt $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec_mpt $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mpt) +# MPT with compiler wrappers ------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKLIBS += -lmpi++ +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mpich1) +# Mpich1 --------------------------------------------------- +ESMF_F90COMPILECPPFLAGS+= -DESMF_MPICH1 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPICH1 +ESMF_F90DEFAULT = mpif90 +ESMF_F90LINKLIBS += -lpmpich++ -lmpich +ESMF_CXXDEFAULT = mpiCC +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),mpich2) +# Mpich2 --------------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),mpich) +# Mpich3 and up -------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),mvapich2) +# Mvapich2 --------------------------------------------------- +ESMF_F90DEFAULT = mpif90 +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),lam) +# LAM (assumed to be built with flang-new) ----------------------- +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2 +ESMF_F90DEFAULT = mpif77 +ESMF_CXXDEFAULT = mpic++ +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +ESMF_F90COMPILECPPFLAGS+= -DESMF_NO_MPI3 +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_MPI3 +else +ifeq ($(ESMF_COMM),openmpi) +# OpenMPI -------------------------------------------------- +ifeq ($(shell $(ESMF_DIR)/scripts/available mpifort),mpifort) +ESMF_F90DEFAULT = mpifort +else +ESMF_F90DEFAULT = mpif90 +endif +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2 +ESMF_F90LINKLIBS += $(shell $(ESMF_DIR)/scripts/libs.openmpif90 $(ESMF_F90DEFAULT)) +ESMF_CXXDEFAULT = mpicxx +ESMF_CDEFAULT = mpicc +ESMF_MPIRUNDEFAULT = mpirun $(ESMF_MPILAUNCHOPTIONS) +ESMF_MPIMPMDRUNDEFAULT = mpiexec $(ESMF_MPILAUNCHOPTIONS) +else +ifeq ($(ESMF_COMM),user) +# User specified flags ------------------------------------- +else +$(error Invalid ESMF_COMM setting: $(ESMF_COMM)) +endif +endif +endif +endif +endif +endif +endif +endif +endif +endif + +############################################################ +# Print compiler version string +# +ESMF_F90COMPILER_VERSION = ${ESMF_F90COMPILER} -v --version +ESMF_CXXCOMPILER_VERSION = ${ESMF_CXXCOMPILER} -v --version +ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} -v --version + +############################################################ +# Special debug flags +# +ESMF_F90OPTFLAG_G += + +############################################################ +# Fortran symbol convention +# +ifeq ($(ESMF_FORTRANSYMBOLS),default) +ESMF_F90COMPILEOPTS += +ESMF_F90LINKOPTS += +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_SINGLEUNDERSCORE +else +ifeq ($(ESMF_FORTRANSYMBOLS),lowercase_singleunderscore) +ESMF_F90COMPILEOPTS += -fno-second-underscore +ESMF_F90LINKOPTS += -fno-second-underscore +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_SINGLEUNDERSCORE +else +ifeq ($(ESMF_FORTRANSYMBOLS),lowercase_doubleunderscore) +ESMF_F90COMPILEOPTS += -fsecond-underscore +ESMF_F90LINKOPTS += -fsecond-underscore +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_DOUBLEUNDERSCORE +else +$(error "ESMF_FORTRANSYMBOLS = $(ESMF_FORTRANSYMBOLS)" not supported by ESMF and/or this platform) +endif +endif +endif + +############################################################ +# Construct the ABISTRING +# +ifeq ($(ESMF_MACHINE),ia64) +ifeq ($(ESMF_ABI),64) +ESMF_ABISTRING := $(ESMF_MACHINE)_64 +else +$(error Invalid ESMF_MACHINE / ESMF_ABI combination: $(ESMF_MACHINE) / $(ESMF_ABI)) +endif +endif +ifeq ($(ESMF_MACHINE),x86_64) +ifeq ($(ESMF_ABI),32) +ESMF_ABISTRING := $(ESMF_MACHINE)_32 +endif +ifeq ($(ESMF_ABI),64) +ESMF_ABISTRING := x86_64_small +endif +endif + +############################################################ +# Set memory model compiler flags according to ABISTRING +# +ifeq ($(ESMF_ABISTRING),x86_64_32) +ESMF_CXXCOMPILEOPTS += -m32 +ESMF_CXXLINKOPTS += -m32 +ESMF_F90COMPILEOPTS += -m32 +ESMF_F90LINKOPTS += -m32 +endif +ifeq ($(ESMF_ABISTRING),x86_64_small) +ESMF_CXXCOMPILEOPTS += -m64 -mcmodel=small +ESMF_CXXLINKOPTS += -m64 -mcmodel=small +ESMF_F90COMPILEOPTS += -m64 -mcmodel=small +ESMF_F90LINKOPTS += -m64 -mcmodel=small +endif +ifeq ($(ESMF_ABISTRING),x86_64_medium) +ESMF_CXXCOMPILEOPTS += -m64 -mcmodel=medium +ESMF_CXXLINKOPTS += -m64 -mcmodel=medium +ESMF_F90COMPILEOPTS += -m64 -mcmodel=medium +ESMF_F90LINKOPTS += -m64 -mcmodel=medium +endif + +############################################################ +# Conditionally add pthread compiler and linker flags +# +ifeq ($(ESMF_PTHREADS),ON) +ESMF_F90COMPILEOPTS += -pthread +ESMF_CXXCOMPILEOPTS += -pthread +ESMF_F90LINKOPTS += -pthread +ESMF_CXXLINKOPTS += -pthread +endif + +############################################################ +# OpenMP compiler and linker flags +# +ESMF_OPENMP=OFF +# ESMF_OPENMP_F90COMPILEOPTS += -fopenmp +# ESMF_OPENMP_CXXCOMPILEOPTS += -fopenmp +# ESMF_OPENMP_F90LINKOPTS += -fopenmp +# ESMF_OPENMP_CXXLINKOPTS += -fopenmp + +############################################################ +# Need this until the file convention is fixed (then remove these two lines) +# +ESMF_F90COMPILEFREENOCPP = -ffree-form +ESMF_F90COMPILEFIXCPP = -cpp -ffixed-form + +############################################################ +# Set unlimited line length limit for free format files +# +ESMF_F90COMPILEOPTS += -ffree-line-length-none + +############################################################ +# Set rpath syntax +# +ESMF_F90RPATHPREFIX = -Wl,-rpath, +ESMF_CXXRPATHPREFIX = -Wl,-rpath, +ESMF_CRPATHPREFIX = -Wl,-rpath, + +############################################################ +# Determine where gcc's libraries are located +# +ESMF_LIBSTDCXX := $(shell $(ESMF_CXXCOMPILER) $(ESMF_CXXCOMPILEOPTS) -print-file-name=libstdc++.so) +ifeq ($(ESMF_LIBSTDCXX),libstdc++.so) +ESMF_LIBSTDCXX := $(shell $(ESMF_CXXCOMPILER) $(ESMF_CXXCOMPILEOPTS) -print-file-name=libstdc++.a) +endif +ESMF_F90LINKPATHS += -L$(dir $(ESMF_LIBSTDCXX)) +ESMF_F90LINKRPATHS += $(ESMF_F90RPATHPREFIX)$(dir $(ESMF_LIBSTDCXX)) + +############################################################ +# Determine where flang-new's libraries are located +# +ESMF_LIBFLANG := $(shell $(ESMF_F90COMPILER) $(ESMF_F90COMPILEOPTS) -print-file-name=libflang.so) +ifeq ($(ESMF_LIBFLANG),libflang.so) +ESMF_LIBFLANG := $(shell $(ESMF_F90COMPILER) $(ESMF_F90COMPILEOPTS) -print-file-name=libflang.a) +endif +ESMF_CXXLINKPATHS += -L$(dir $(ESMF_LIBFLANG)) +ESMF_CXXLINKRPATHS += $(ESMF_CXXRPATHPREFIX)$(dir $(ESMF_LIBFLANG)) + +############################################################ +# Link against libesmf.a using the F90 linker front-end +# +ESMF_F90LINKLIBS += -lrt -lstdc++ -ldl + +############################################################ +# Link against libesmf.a using the C++ linker front-end +# +ESMF_CXXLINKLIBS += -lrt -lflang -lstdc++ -lm -ldl + +############################################################ +# Linker option that ensures that the specified libraries are +# used to also resolve symbols needed by other libraries. +# +ESMF_F90LINKOPTS += -Wl,--no-as-needed +ESMF_CXXLINKOPTS += -Wl,--no-as-needed + +############################################################ +# Shared library options +# +ESMF_SL_LIBOPTS += -shared + +############################################################ +# Shared object options +# +ESMF_SO_F90COMPILEOPTS = -fPIC +ESMF_SO_F90LINKOPTS = -shared +ESMF_SO_F90LINKOPTSEXE = -Wl,-export-dynamic +ESMF_SO_CXXCOMPILEOPTS = -fPIC +ESMF_SO_CXXLINKOPTS = -shared +ESMF_SO_CXXLINKOPTSEXE = -Wl,-export-dynamic diff --git a/build_config/Linux.nvhpc.default/build_rules.mk b/build_config/Linux.nvhpc.default/build_rules.mk index 1a7be55967..c163e27d32 100644 --- a/build_config/Linux.nvhpc.default/build_rules.mk +++ b/build_config/Linux.nvhpc.default/build_rules.mk @@ -8,7 +8,7 @@ # ESMF_F90DEFAULT = nvfortran ESMF_CXXDEFAULT = nvc++ -ESMF_CDEFAULT = nvcc +ESMF_CDEFAULT = nvc ############################################################ # Default MPI setting. @@ -130,9 +130,9 @@ endif ############################################################ # Print compiler version string # -ESMF_F90COMPILER_VERSION = ${ESMF_F90COMPILER} --version -ESMF_CXXCOMPILER_VERSION = ${ESMF_CXXCOMPILER} --version -ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} --version +ESMF_F90COMPILER_VERSION = ${ESMF_F90COMPILER} --version -c +ESMF_CXXCOMPILER_VERSION = ${ESMF_CXXCOMPILER} --version -c +ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} --version -c ############################################################ # Currently no support the Fortran2018 assumed type feature @@ -200,6 +200,7 @@ ESMF_OPENMP_CXXLINKOPTS += -mp ############################################################ # OpenACC compiler and linker flags (the -Minfo just there for debugging) # +ESMF_OPENACCDEFAULT = OFF ESMF_OPENACC_F90COMPILEOPTS += -acc -Minfo ESMF_OPENACC_CXXCOMPILEOPTS += -acc -Minfo ESMF_OPENACC_F90LINKOPTS += -acc -Minfo diff --git a/build_config/Linux.pgi.default/README b/build_config/Linux.pgi.default/README index 5ad4c8069d..dfb33083ba 100644 --- a/build_config/Linux.pgi.default/README +++ b/build_config/Linux.pgi.default/README @@ -3,6 +3,3 @@ Settings for Linux, using the commercial Portland Group PGI Fortran and C++ comp Requires the following environment settings: ESMF_COMPILER pgi - -For pre-7.1 compilers, please see the ESMF_Conf.inc file for several -macros that must be enabled for proper operation. diff --git a/build_config/Linux.pgigcc.default/README b/build_config/Linux.pgigcc.default/README index 14f0331861..c85882cf86 100644 --- a/build_config/Linux.pgigcc.default/README +++ b/build_config/Linux.pgigcc.default/README @@ -4,6 +4,3 @@ and the GNU C++ compiler (g++). Requires the following environment settings: ESMF_COMPILER pgigcc - -For pre-7.1 compilers, please see the ESMF_Conf.inc file for several -macros that must be enabled for proper operation. diff --git a/build_config/MinGW.gfortran.default/README b/build_config/MinGW.gfortran.default/README index fbe024801a..6ff0e2caaa 100644 --- a/build_config/MinGW.gfortran.default/README +++ b/build_config/MinGW.gfortran.default/README @@ -1,4 +1,4 @@ -Settings for MinGW/MSYS, using gfortran 4.3 or later. +Settings for MinGW/MSYS using the GNU gfortran compiler. Supports the following environment settings: @@ -11,4 +11,3 @@ using MinGW 6.1 and MSYS 1.0.11. MinGW and MSYS are available from http://www.mingw.org. 2.) The MinGW version of gcc is required for preprocessing. - diff --git a/build_config/Unicos.aocc.default/ESMC_Conf.h b/build_config/Unicos.aocc.default/ESMC_Conf.h new file mode 100644 index 0000000000..e38d89f02c --- /dev/null +++ b/build_config/Unicos.aocc.default/ESMC_Conf.h @@ -0,0 +1,43 @@ +#ifdef ESMC_RCS_HEADER +"$Id$" +"Defines the configuration for this machine" +#endif + +#if 0 +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif + +#if !defined(INCLUDED_CONF_H) +#define INCLUDED_CONF_H + +#define PARCH_linux + +#ifdef ESMF_LOWERCASE_SINGLEUNDERSCORE +#define FTN_X(func) func##_ +#define FTNX(func) func##_ +#endif +#ifdef ESMF_LOWERCASE_DOUBLEUNDERSCORE +#define FTN_X(func) func##__ +#define FTNX(func) func##_ +#endif + +#if defined (__cplusplus) +// Typedef to match the data type of the 'hidden' string length +// argument that Fortran uses when passing CHARACTER strings. +#if (__GNUC__ > 7) +#include +typedef size_t ESMCI_FortranStrLenArg; +#else +typedef int ESMCI_FortranStrLenArg; +#endif +#endif + +#define ESMC_PRESENT(arg) ( (arg) != 0 ) + +#endif diff --git a/build_config/Unicos.aocc.default/ESMF_Conf.inc b/build_config/Unicos.aocc.default/ESMF_Conf.inc new file mode 100644 index 0000000000..28343681b2 --- /dev/null +++ b/build_config/Unicos.aocc.default/ESMF_Conf.inc @@ -0,0 +1,22 @@ +#if 0 +$Id$ + +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif + +#if !defined(__cplusplus) +#if (__GNUC__ == 4) && (__GNUC_MINOR__ < 5) +#error "The gfortran compiler must be version 4.5 or newer." +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ < 6) +#define ESMF_NO_F2003_ALLOC_STRING_LENS +#endif + +#endif diff --git a/build_config/Unicos.aocc.default/README b/build_config/Unicos.aocc.default/README new file mode 100644 index 0000000000..8df09e459d --- /dev/null +++ b/build_config/Unicos.aocc.default/README @@ -0,0 +1,5 @@ +Settings for Unicos/lc on Cray, using the AMD Optimized Compilers (AOCC). + +Requires the following environment settings: + +ESMF_COMPILER aocc diff --git a/build_config/Unicos.aocc.default/build_rules.mk b/build_config/Unicos.aocc.default/build_rules.mk new file mode 100644 index 0000000000..d0b0784ff7 --- /dev/null +++ b/build_config/Unicos.aocc.default/build_rules.mk @@ -0,0 +1,168 @@ +# $Id$ +# +# Unicos.aocc.default +# + +############################################################ +# Default compiler setting. +# +ESMF_F90DEFAULT = ftn +ESMF_CXXDEFAULT = CC +ESMF_CDEFAULT = cc + +############################################################ +# Default MPI setting. +# +ifeq ($(ESMF_COMM),default) +export ESMF_COMM := mpi +endif + +############################################################ +# MPI dependent settings. +# +ifeq ($(ESMF_COMM),mpiuni) +# MPI stub library ----------------------------------------- +ESMF_F90COMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILEPATHS += -I$(ESMF_DIR)/src/Infrastructure/stubs/mpiuni +ESMF_MPIRUNDEFAULT = $(ESMF_DIR)/src/Infrastructure/stubs/mpiuni/mpirun +else +ifeq ($(ESMF_COMM),mpi) +# Vendor MPI ----------------------------------------------- +ESMF_F90LINKLIBS += +ESMF_CXXLINKLIBS += +ESMF_MPIRUNDEFAULT = mpirun.srun +ESMF_MPIMPMDRUNDEFAULT = +else +ifeq ($(ESMF_COMM),user) +# User specified flags ------------------------------------- +else +$(error Invalid ESMF_COMM setting: $(ESMF_COMM)) +endif +endif +endif + +############################################################ +# Print compiler version string +# +ESMF_F90COMPILER_VERSION = ${ESMF_F90COMPILER} -v --version +ESMF_CXXCOMPILER_VERSION = ${ESMF_CXXCOMPILER} -v --version +ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} -v --version + +############################################################ +# Currently no support the Fortran2018 assumed type feature +# +ESMF_F90COMPILECPPFLAGS += -DESMF_NO_F2018ASSUMEDTYPE +ESMF_CXXCOMPILECPPFLAGS += -DESMF_NO_F2018ASSUMEDTYPE + +############################################################ +# Special debug flags +# +ESMF_F90OPTFLAG_G += -Wall -Wextra -Wconversion -Wno-unused + +############################################################ +# Fortran symbol convention +# +ifeq ($(ESMF_FORTRANSYMBOLS),default) +ESMF_F90COMPILEOPTS += +ESMF_F90LINKOPTS += +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_SINGLEUNDERSCORE +else +ifeq ($(ESMF_FORTRANSYMBOLS),lowercase_singleunderscore) +ESMF_F90COMPILEOPTS += -fno-second-underscore +ESMF_F90LINKOPTS += -fno-second-underscore +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_SINGLEUNDERSCORE +else +ifeq ($(ESMF_FORTRANSYMBOLS),lowercase_doubleunderscore) +ESMF_F90COMPILEOPTS += -fsecond-underscore +ESMF_F90LINKOPTS += -fsecond-underscore +ESMF_CXXCOMPILEOPTS += -DESMF_LOWERCASE_DOUBLEUNDERSCORE +else +$(error "ESMF_FORTRANSYMBOLS = $(ESMF_FORTRANSYMBOLS)" not supported by ESMF and/or this platform) +endif +endif +endif + +############################################################ +# XT compute nodes do not have support for POSIX IPC (memory mapped files) +# +ESMF_CXXCOMPILECPPFLAGS += -DESMF_NO_POSIXIPC + +############################################################ +# Conditionally add pthread compiler and linker flags +# +ifeq ($(ESMF_PTHREADS),ON) +ESMF_F90COMPILEOPTS += -pthread +ESMF_CXXCOMPILEOPTS += -pthread +ESMF_F90LINKOPTS += -pthread +ESMF_CXXLINKOPTS += -pthread +endif + +############################################################ +# OpenMP compiler and linker flags +# +ESMF_OPENMP=ON +ESMF_OPENMP_F90COMPILEOPTS += -fopenmp +ESMF_OPENMP_CXXCOMPILEOPTS += -fopenmp +ESMF_OPENMP_F90LINKOPTS += -fopenmp +ESMF_OPENMP_CXXLINKOPTS += -fopenmp + +############################################################ +# OpenACC compiler and linker flags +# +ESMF_OPENACCDEFAULT = OFF +ESMF_OPENACC_F90COMPILEOPTS += -fopenacc +ESMF_OPENACC_CXXCOMPILEOPTS += -fopenacc +ESMF_OPENACC_F90LINKOPTS += -fopenacc +ESMF_OPENACC_CXXLINKOPTS += -fopenacc + +############################################################ +# Need this until the file convention is fixed (then remove these two lines) +# +ESMF_F90COMPILEFREENOCPP = -ffree-form +ESMF_F90COMPILEFIXCPP = -cpp -ffixed-form + +############################################################ +# Set rpath syntax +# +ESMF_F90RPATHPREFIX = -Wl,-rpath, +ESMF_CXXRPATHPREFIX = -Wl,-rpath, +ESMF_CRPATHPREFIX = -Wl,-rpath, + +############################################################ +# Link against libesmf.a using the F90 linker front-end +# +ESMF_F90LINKLIBS += -lrt -lstdc++ -ldl + +############################################################ +# Link against libesmf.a using the C++ linker front-end +# +ESMF_CXXLINKLIBS += -lrt -lflang -lflangrti -lpgmath -ldl + +############################################################ +# Shared library options +# +ESMF_SL_LIBOPTS += -shared + +############################################################ +# Shared object options +# +ESMF_SO_F90COMPILEOPTS = -fPIC +ESMF_SO_F90LINKOPTS = -shared +ESMF_SO_F90LINKOPTSEXE = -Wl,-export-dynamic +ESMF_SO_CXXCOMPILEOPTS = -fPIC +ESMF_SO_CXXLINKOPTS = -shared +ESMF_SO_CXXLINKOPTSEXE = -Wl,-export-dynamic + +############################################################ +# Disable WebService testing for now +# +# TODO: Remove this variable and associated infrastructure as soon as +# TODO: WebService testing is robust enough to work on all systems. +# +ESMF_NOWEBSERVTESTING = TRUE + +############################################################ +# Override default C preprocessor on this platform +# +ESMF_CPPDEFAULT = gcc -E -P -x c diff --git a/build_config/Unicos.gfortran.default/README b/build_config/Unicos.gfortran.default/README index 2f8a9df2db..2a49b57d48 100644 --- a/build_config/Unicos.gfortran.default/README +++ b/build_config/Unicos.gfortran.default/README @@ -1,5 +1,4 @@ -Settings for Unicos/lc on Cray XT/XE/XK, using gfortran and g++ out of the GNU Compiler Collection. Due to bugs in early versions of gfortran, ESMF -requires gfortran version 4.3 or newer. +Settings for Unicos/lc on Cray XT/XE/XK, using gfortran and g++ out of the GNU Compiler Collection. Requires the following environment settings: diff --git a/build_config/Unicos.gfortran.default/build_rules.mk b/build_config/Unicos.gfortran.default/build_rules.mk index fb3413fcd4..260ed7a37b 100644 --- a/build_config/Unicos.gfortran.default/build_rules.mk +++ b/build_config/Unicos.gfortran.default/build_rules.mk @@ -101,6 +101,15 @@ ESMF_OPENMP_CXXCOMPILEOPTS += -fopenmp ESMF_OPENMP_F90LINKOPTS += -fopenmp ESMF_OPENMP_CXXLINKOPTS += -fopenmp +############################################################ +# OpenACC compiler and linker flags +# +ESMF_OPENACCDEFAULT = OFF +ESMF_OPENACC_F90COMPILEOPTS += -fopenacc +ESMF_OPENACC_CXXCOMPILEOPTS += -fopenacc +ESMF_OPENACC_F90LINKOPTS += -fopenacc +ESMF_OPENACC_CXXLINKOPTS += -fopenacc + ############################################################ # Need this until the file convention is fixed (then remove these two lines) # diff --git a/build_config/Unicos.nvhpc.default/ESMC_Conf.h b/build_config/Unicos.nvhpc.default/ESMC_Conf.h new file mode 100644 index 0000000000..aee30299c8 --- /dev/null +++ b/build_config/Unicos.nvhpc.default/ESMC_Conf.h @@ -0,0 +1,33 @@ +#ifdef ESMC_RCS_HEADER +"$Id$" +"Defines the configuration for this machine" +#endif + +#if 0 +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif + +#if !defined(INCLUDED_CONF_H) +#define INCLUDED_CONF_H + +#define PARCH_linux + +#define FTN_X(func) func##_ +#define FTNX(func) func##_ + +#if defined (__cplusplus) +// Typedef to match the data type of the 'hidden' string length +// argument that Fortran uses when passing CHARACTER strings. +#include +typedef size_t ESMCI_FortranStrLenArg; +#endif + +#define ESMC_PRESENT(arg) ( (arg) != 0 ) + +#endif diff --git a/build_config/Unicos.nvhpc.default/ESMF_Conf.inc b/build_config/Unicos.nvhpc.default/ESMF_Conf.inc new file mode 100644 index 0000000000..7c130bde51 --- /dev/null +++ b/build_config/Unicos.nvhpc.default/ESMF_Conf.inc @@ -0,0 +1,11 @@ +#if 0 +$Id$ + +Earth System Modeling Framework +Copyright 2002-2022, University Corporation for Atmospheric Research, +Massachusetts Institute of Technology, Geophysical Fluid Dynamics +Laboratory, University of Michigan, National Centers for Environmental +Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +NASA Goddard Space Flight Center. +Licensed under the University of Illinois-NCSA License. +#endif diff --git a/build_config/Unicos.nvhpc.default/README b/build_config/Unicos.nvhpc.default/README new file mode 100644 index 0000000000..a65d957223 --- /dev/null +++ b/build_config/Unicos.nvhpc.default/README @@ -0,0 +1,5 @@ +Settings for Linux/lc on Cray, using the NVIDIA HPC compilers. + +Requires the following environment settings: + +ESMF_COMPILER nvhpc diff --git a/build_config/Unicos.nvhpc.default/build_rules.mk b/build_config/Unicos.nvhpc.default/build_rules.mk new file mode 100644 index 0000000000..edde1d3d35 --- /dev/null +++ b/build_config/Unicos.nvhpc.default/build_rules.mk @@ -0,0 +1,167 @@ +# $Id$ +# +# Unicos.nvhpc.default +# + +############################################################ +# Default compiler setting. +# +ESMF_F90DEFAULT = ftn +ESMF_CXXDEFAULT = CC +ESMF_CDEFAULT = cc + +############################################################ +# Default MPI setting. +# +ifeq ($(ESMF_COMM),default) +export ESMF_COMM := mpi +endif + +############################################################ +# MPI dependent settings. +# +ifeq ($(ESMF_COMM),mpiuni) +# MPI stub library ----------------------------------------- +ESMF_F90COMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILECPPFLAGS+= -DESMF_MPIUNI +ESMF_CXXCOMPILEPATHS += -I$(ESMF_DIR)/src/Infrastructure/stubs/mpiuni +ESMF_MPIRUNDEFAULT = $(ESMF_DIR)/src/Infrastructure/stubs/mpiuni/mpirun +else +ifeq ($(ESMF_COMM),mpi) +# Vendor MPI ----------------------------------------------- +ESMF_F90LINKLIBS += +ESMF_CXXLINKLIBS += +ESMF_MPIRUNDEFAULT = mpirun.srun +ESMF_MPIMPMDRUNDEFAULT = +else +ifeq ($(ESMF_COMM),user) +# User specified flags ------------------------------------- +else +$(error Invalid ESMF_COMM setting: $(ESMF_COMM)) +endif +endif +endif + +############################################################ +# Print compiler version string +# +ESMF_F90COMPILER_VERSION = ${ESMF_F90COMPILER} --version -c +ESMF_CXXCOMPILER_VERSION = ${ESMF_CXXCOMPILER} --version -c +ESMF_CCOMPILER_VERSION = ${ESMF_CCOMPILER} --version -c + +############################################################ +# Currently no support the Fortran2018 assumed type feature +# +ESMF_F90COMPILECPPFLAGS += -DESMF_NO_F2018ASSUMEDTYPE +ESMF_CXXCOMPILECPPFLAGS += -DESMF_NO_F2018ASSUMEDTYPE + +############################################################ +# Construct the ABISTRING +# +ifeq ($(ESMF_MACHINE),x86_64) +ifeq ($(ESMF_ABI),32) +ESMF_ABISTRING := $(ESMF_MACHINE)_32 +endif +ifeq ($(ESMF_ABI),64) +ESMF_ABISTRING := x86_64_small +endif +endif + +############################################################ +# Set memory model compiler flags according to ABISTRING +# +ifeq ($(ESMF_ABISTRING),x86_64_32) +ESMF_CXXCOMPILEOPTS += +ESMF_CXXLINKOPTS += +ESMF_F90COMPILEOPTS += +ESMF_F90LINKOPTS += +endif +ifeq ($(ESMF_ABISTRING),x86_64_small) +ESMF_CXXCOMPILEOPTS += -mcmodel=small +ESMF_CXXLINKOPTS += -mcmodel=small +ESMF_F90COMPILEOPTS += -mcmodel=small +ESMF_F90LINKOPTS += -mcmodel=small +endif +ifeq ($(ESMF_ABISTRING),x86_64_medium) +ESMF_CXXCOMPILEOPTS += -mcmodel=medium +ESMF_CXXLINKOPTS += -mcmodel=medium +ESMF_F90COMPILEOPTS += -mcmodel=medium +ESMF_F90LINKOPTS += -mcmodel=medium +endif + +############################################################ +# Enable TR15581/F2003 Allocatable array resizing +# +ESMF_F90COMPILEOPTS += -Mallocatable=03 + +############################################################ +# Conditionally add pthread compiler and linker flags +# +ifeq ($(ESMF_PTHREADS),ON) +ESMF_F90COMPILEOPTS += -pthread +ESMF_CXXCOMPILEOPTS += -pthread +ESMF_F90LINKOPTS += -pthread +ESMF_CXXLINKOPTS += -pthread +endif + +############################################################ +# OpenMP compiler and linker flags +# +ESMF_OPENMP_F90COMPILEOPTS += -mp +ESMF_OPENMP_CXXCOMPILEOPTS += -mp +ESMF_OPENMP_F90LINKOPTS += -mp +ESMF_OPENMP_CXXLINKOPTS += -mp + +############################################################ +# OpenACC compiler and linker flags (the -Minfo just there for debugging) +# +ESMF_OPENACCDEFAULT = OFF +ESMF_OPENACC_F90COMPILEOPTS += -acc -Minfo +ESMF_OPENACC_CXXCOMPILEOPTS += -acc -Minfo +ESMF_OPENACC_F90LINKOPTS += -acc -Minfo +ESMF_OPENACC_CXXLINKOPTS += -acc -Minfo + +############################################################ +# Need this until the file convention is fixed (then remove these two lines) +# +ESMF_F90COMPILEFREENOCPP = -Mfreeform +ESMF_F90COMPILEFIXCPP = -Mpreprocess -Mnofreeform + +############################################################ +# Set rpath syntax +# +ESMF_F90RPATHPREFIX = -Wl,-rpath, +ESMF_CXXRPATHPREFIX = -Wl,-rpath, +ESMF_CRPATHPREFIX = -Wl,-rpath, + +############################################################ +# Link against libesmf.a using the F90 linker front-end +# +ESMF_F90LINKLIBS += -c++libs + +############################################################ +# Link against libesmf.a using the C++ linker front-end +# +ESMF_CXXLINKLIBS += -fortranlibs + +############################################################ +# Linker option that ensures that the specified libraries are +# used to also resolve symbols needed by other libraries. +# +ESMF_F90LINKOPTS += -Wl,--no-as-needed +ESMF_CXXLINKOPTS += -Wl,--no-as-needed + +############################################################ +# Shared library options +# +ESMF_SL_LIBOPTS += -shared + +############################################################ +# Shared object options +# +ESMF_SO_F90COMPILEOPTS = -fpic +ESMF_SO_F90LINKOPTS = -shared +ESMF_SO_F90LINKOPTSEXE = -Wl,-export-dynamic +ESMF_SO_CXXCOMPILEOPTS = -fpic +ESMF_SO_CXXLINKOPTS = -shared +ESMF_SO_CXXLINKOPTSEXE = -Wl,-export-dynamic diff --git a/build_config/Unicos.pgi.default/README b/build_config/Unicos.pgi.default/README index 53ca84d63d..536bea8f7e 100644 --- a/build_config/Unicos.pgi.default/README +++ b/build_config/Unicos.pgi.default/README @@ -3,6 +3,3 @@ Settings for Unicos/lc on Cray XT, using the Portland Group PGI Fortran and C++ Requires the following environment settings: ESMF_COMPILER pgi - -For pre-7.1 compilers, please see the ESMF_Conf.inc file for several -macros that must be enabled for proper operation. diff --git a/makefile b/makefile index 43563f29eb..5d66726882 100644 --- a/makefile +++ b/makefile @@ -73,10 +73,10 @@ test_esmfmkfile: script_info: test_esmfmkfile -@echo " " -@echo "--------------------------------------------------------------" - -@echo "ESMF_VERSION_STRING: $(ESMF_VERSION_STRING)" + -@echo "ESMF_VERSION_STRING: $(ESMF_VERSION_STRING)" ifeq ($(shell $(ESMF_DIR)/scripts/available git),git) - @if [ -d $(ESMF_DIR)/.git ] ; then \ - echo $(ESMF_VERSION_STRING_GIT);\ + @if [ "$(ESMF_VERSION_STRING_GIT)" != "" ] ; then \ + echo "ESMF_VERSION_STRING_GIT: $(ESMF_VERSION_STRING_GIT)";\ echo "--------------------------------------------------------------" ;\ git status ;\ else \ @@ -426,7 +426,7 @@ info_mk: chkdir_lib -@echo "#----------------------------------------------" >> $(MKINFO) -@echo "ESMF_VERSION_STRING=$(ESMF_VERSION_STRING)" >> $(MKINFO) ifeq ($(shell $(ESMF_DIR)/scripts/available git),git) - @if [ -d $(ESMF_DIR)/.git ] ; then \ + @if [ "$(ESMF_VERSION_STRING_GIT)" != "" ] ; then \ echo "ESMF_VERSION_STRING_GIT=$(ESMF_VERSION_STRING_GIT)" >> $(MKINFO) ; \ else \ echo "# Not a Git repository" >> $(MKINFO) ; \ @@ -445,6 +445,7 @@ endif -@echo "" >> $(MKINFO) -@echo "ESMF_APPSDIR=$(ESMF_APPSDIR)" >> $(MKINFO) -@echo "ESMF_LIBSDIR=$(ESMF_LIBDIR)" >> $(MKINFO) + -@echo "ESMF_ESMXDIR=$(ESMF_ESMXDIR)" >> $(MKINFO) -@echo "" >> $(MKINFO) -@echo "" >> $(MKINFO) -@echo "ESMF_F90COMPILER=$(ESMF_F90COMPILER)" >> $(MKINFO) @@ -658,7 +659,7 @@ endif # Rewrite esmf.mk during installation to ensure correct installation paths are encoded install_info_mk: - $(MAKE) info_mk ESMF_APPSDIR=$(ESMF_INSTALL_BINDIR_ABSPATH) ESMF_LDIR=$(ESMF_INSTALL_LIBDIR_ABSPATH) ESMF_LIBDIR=$(ESMF_INSTALL_LIBDIR_ABSPATH) ESMF_MODDIR=$(ESMF_INSTALL_MODDIR_ABSPATH) ESMF_INCDIR=$(ESMF_INSTALL_HEADERDIR_ABSPATH) + $(MAKE) info_mk ESMF_APPSDIR=$(ESMF_INSTALL_BINDIR_ABSPATH) ESMF_LDIR=$(ESMF_INSTALL_LIBDIR_ABSPATH) ESMF_LIBDIR=$(ESMF_INSTALL_LIBDIR_ABSPATH) ESMF_ESMXDIR=$(ESMF_INSTALL_HEADERDIR_ABSPATH)/ESMX ESMF_MODDIR=$(ESMF_INSTALL_MODDIR_ABSPATH) ESMF_INCDIR=$(ESMF_INSTALL_HEADERDIR_ABSPATH) # Relink apps during installation to ensure correct shared library location is encoded install_apps: @@ -695,6 +696,7 @@ install: cp -f $(ESMF_BUILD)/src/include/ESMC.h $(ESMF_INSTALL_HEADERDIR_ABSPATH) cp -f $(ESMF_BUILD)/src/include/ESMC_*.h $(ESMF_INSTALL_HEADERDIR_ABSPATH) cp -f $(ESMF_DIR)/build_config/$(ESMF_OS).$(ESMF_COMPILER).$(ESMF_SITE)/ESMC_Conf.h $(ESMF_INSTALL_HEADERDIR_ABSPATH) + cp -fr $(ESMF_ESMXDIR) $(ESMF_INSTALL_HEADERDIR_ABSPATH) mkdir -p $(ESMF_INSTALL_MODDIR_ABSPATH) cp -f $(ESMF_MODDIR)/*.mod $(ESMF_INSTALL_MODDIR_ABSPATH) mkdir -p $(ESMF_INSTALL_LIBDIR_ABSPATH) diff --git a/scripts/esmfversiongit b/scripts/esmfversiongit index 83beadea61..5ba3cc4b83 100755 --- a/scripts/esmfversiongit +++ b/scripts/esmfversiongit @@ -1,5 +1,6 @@ #!/bin/sh # return the ESMF version from Git if available, or empty string otherwise -if [ -d $ESMF_DIR/.git ] ; then \ +# test looks for .git directory or .git file (when esmf is a submodule) +if [ -d $ESMF_DIR/.git ] || [ -s $ESMF_DIR/.git ] ; then \ git describe --tags 2>&1 | grep -v fatal fi diff --git a/scripts/libs.openmpif90 b/scripts/libs.openmpif90 index be364582c7..6c911232c6 100755 --- a/scripts/libs.openmpif90 +++ b/scripts/libs.openmpif90 @@ -1,5 +1,5 @@ #!/bin/sh -# this scripts determines whether libmpi_cxx needs to be included or not. +# this scripts determines whether libmpi_cxx needs to be included or not when linking with a Fortran linker # Prior to OpenMPI 2.0, libmpi_cxx must be added. Post-2.0, it is optional. OPENMPI_MPIF90=`which $1` OPENMPI_LIBDIR=`dirname ${OPENMPI_MPIF90}`/../lib* diff --git a/scripts/libs.openmpif90_forcxx b/scripts/libs.openmpif90_forcxx new file mode 100755 index 0000000000..80b90bad3a --- /dev/null +++ b/scripts/libs.openmpif90_forcxx @@ -0,0 +1,9 @@ +#!/bin/sh +# This script obtains the Fortran OpenMPI libraries that need to be explicitly added to +# the link line when linking with a C++ linker. (This adds an extra instance of -lmpi, but +# that shouldn't be a problem.) +OPENMPI_MPIF90=`which $1` +libs=`${OPENMPI_MPIF90} --showme:libs` +# The above returns the names of the libraries without '-l'. Here we add '-l' to the start +# of each library name: +echo $libs | sed -E 's/(^| ) */ -l/g' diff --git a/scripts/nfconfigtest b/scripts/nfconfigtest index 26cb375c51..7b4d61a2da 100755 --- a/scripts/nfconfigtest +++ b/scripts/nfconfigtest @@ -1,8 +1,8 @@ #!/bin/sh # return "working" if nf-config is working, "notworking" otherwise -firstpart=`$1 --version | awk '{ print $1 }'` -if ([ $firstpart = "netCDF-Fortran" ]); then -echo "working" +$1 --flibs | grep -i 'not.*implemented' > /dev/null +if [ $? = 0 ]; then + echo "notworking" else -echo "notworking" + echo "working" fi diff --git a/src/Infrastructure/Array/include/ESMCI_Array.h b/src/Infrastructure/Array/include/ESMCI_Array.h index 450f08e11e..3ea6fb62f0 100644 --- a/src/Infrastructure/Array/include/ESMCI_Array.h +++ b/src/Infrastructure/Array/include/ESMCI_Array.h @@ -273,7 +273,7 @@ namespace ESMCI { totalElementCountPLocalDe = NULL; sizeSuperUndist = NULL; sizeDist = NULL; -#if !defined (PARCH_IRIX64) +#if !defined (ESMF_OS_IRIX64) rimSeqIndexI4.resize(0); rimSeqIndexI8.resize(0); #endif @@ -311,7 +311,7 @@ namespace ESMCI { totalElementCountPLocalDe = NULL; sizeSuperUndist = NULL; sizeDist = NULL; -#if !defined (PARCH_IRIX64) +#if !defined (ESMF_OS_IRIX64) rimSeqIndexI4.resize(0); rimSeqIndexI8.resize(0); #endif diff --git a/src/Infrastructure/Array/interface/ESMF_Array.F90 b/src/Infrastructure/Array/interface/ESMF_Array.F90 index 0401b94442..693cc5f512 100644 --- a/src/Infrastructure/Array/interface/ESMF_Array.F90 +++ b/src/Infrastructure/Array/interface/ESMF_Array.F90 @@ -459,9 +459,13 @@ subroutine ESMF_ArraySetDefault(array, keywordEnforcer, computationalLWidth, & ! Set the name in Base object if (present(name)) then - call c_ESMC_SetName(array, "Array", name, localrc) - if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & - ESMF_CONTEXT, rcToReturn=rc)) return + if (array%isNamedAlias) then + array%name = trim(name) + else + call c_ESMC_SetName(array, "Array", name, localrc) + if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & + ESMF_CONTEXT, rcToReturn=rc)) return + endif endif ! Deal with (optional) array arguments @@ -3831,7 +3835,7 @@ subroutine ESMF_ArrayWrite(array, fileName, keywordEnforcer, & ! ! !DESCRIPTION: ! Write Array data into a file. For this API to be functional, the -! environment variable {\tt ESMF\_PIO} should be set to "internal" when +! environment variable {\tt ESMF\_PIO} should be set to either "internal" or "external" when ! the ESMF library is built. Please see the section on ! Data I/O,~\ref{io:dataio}. ! @@ -3854,7 +3858,6 @@ subroutine ESMF_ArrayWrite(array, fileName, keywordEnforcer, & ! ! Limitations: ! \begin{itemize} -! \item Only single tile Arrays are supported. ! \item Not supported in {\tt ESMF\_COMM=mpiuni} mode. ! \end{itemize} ! @@ -3864,6 +3867,12 @@ subroutine ESMF_ArrayWrite(array, fileName, keywordEnforcer, & ! The {\tt ESMF\_Array} object that contains data to be written. ! \item[fileName] ! The name of the output file to which Array data is written. +! If this is a multi-tile Array, then fileName must contain +! exactly one instance of "\#"; this is a placeholder that will be replaced +! by the tile number, with each tile being written to a separate file. (For +! example, for a fileName of "myfile\#.nc", tile 1 will be written to +! "myfile1.nc", tile 2 to "myfile2.nc", etc.) +! (This handling of the fileName for multi-tile I/O is subject to change.) ! \item[{[variableName]}] ! Variable name in the output file; default is the "name" of Array. ! Use this argument only in the I/O format (such as NetCDF) that diff --git a/src/Infrastructure/Array/interface/ESMF_ArrayCreate.cppF90 b/src/Infrastructure/Array/interface/ESMF_ArrayCreate.cppF90 index 62842f9f62..917a872fc8 100644 --- a/src/Infrastructure/Array/interface/ESMF_ArrayCreate.cppF90 +++ b/src/Infrastructure/Array/interface/ESMF_ArrayCreate.cppF90 @@ -69,9 +69,9 @@ module ESMF_ArrayCreateMod ^ifndef ESMF_NO_SEQUENCE sequence ^endif - private +! private type(ESMF_Pointer) :: this - ESMF_INIT_DECLARE + ESMF_INIT_DECLARE_NAMED_ALIAS end type !------------------------------------------------------------------------------ diff --git a/src/Infrastructure/Array/interface/ESMF_ArrayGet.cppF90 b/src/Infrastructure/Array/interface/ESMF_ArrayGet.cppF90 index c039ecdd4c..1e3eb0a98a 100644 --- a/src/Infrastructure/Array/interface/ESMF_ArrayGet.cppF90 +++ b/src/Infrastructure/Array/interface/ESMF_ArrayGet.cppF90 @@ -543,9 +543,13 @@ type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below ! Special call to get name out of Base class if (present(name)) then - call c_ESMC_GetName(array, name, localrc) - if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & - ESMF_CONTEXT, rcToReturn=rc)) return + if (array%isNamedAlias) then + name = trim(array%name) + else + call c_ESMC_GetName(array, name, localrc) + if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & + ESMF_CONTEXT, rcToReturn=rc)) return + endif endif ! Special call to get vm out of Base class diff --git a/src/Infrastructure/Array/interface/ESMF_ArrayHa.F90 b/src/Infrastructure/Array/interface/ESMF_ArrayHa.F90 index 6d0870f466..f2ef0a028a 100644 --- a/src/Infrastructure/Array/interface/ESMF_ArrayHa.F90 +++ b/src/Infrastructure/Array/interface/ESMF_ArrayHa.F90 @@ -639,12 +639,11 @@ subroutine ESMF_ArrayRead(array, fileName, keywordEnforcer, variableName, & ! !DESCRIPTION: ! Read Array data from file and put it into an {\tt ESMF\_Array} object. ! For this API to be functional, the environment variable {\tt ESMF\_PIO} -! should be set to "internal" when the ESMF library is built. +! should be set to either "internal" or "external" when the ESMF library is built. ! Please see the section on Data I/O,~\ref{io:dataio}. ! ! Limitations: ! \begin{itemize} -! \item Only single tile Arrays are supported. ! \item Not supported in {\tt ESMF\_COMM=mpiuni} mode. ! \end{itemize} ! @@ -654,6 +653,12 @@ subroutine ESMF_ArrayRead(array, fileName, keywordEnforcer, variableName, & ! The {\tt ESMF\_Array} object in which the read data is returned. ! \item[fileName] ! The name of the file from which Array data is read. +! If this is a multi-tile Array, then fileName must contain +! exactly one instance of "\#"; this is a placeholder that will be replaced +! by the tile number, with each tile being read from a separate file. (For +! example, for a fileName of "myfile\#.nc", tile 1 will be read from +! "myfile1.nc", tile 2 from "myfile2.nc", etc.) +! (This handling of the fileName for multi-tile I/O is subject to change.) ! \item[{[variableName]}] ! Variable name in the file; default is the "name" of Array. ! Use this argument only in the I/O format (such as NetCDF) that diff --git a/src/Infrastructure/Array/src/ESMCI_Array.C b/src/Infrastructure/Array/src/ESMCI_Array.C index 593f4deb51..c281c7469b 100644 --- a/src/Infrastructure/Array/src/ESMCI_Array.C +++ b/src/Infrastructure/Array/src/ESMCI_Array.C @@ -3891,7 +3891,7 @@ int Array::read( // !DESCRIPTION: // Read Array data from file and put it into an ESMF_Array object. // For this API to be functional, the environment variable ESMF_PIO -// should be set to "internal" when the ESMF library is built. +// should be set to either "internal" or "external" when the ESMF library is built. // //EOPI //----------------------------------------------------------------------------- @@ -3969,7 +3969,7 @@ int Array::write( // // !DESCRIPTION: // Write Array data into a file. For this API to be functional, the -// environment variable {\tt ESMF\_PIO} should be set to "internal" when +// environment variable {\tt ESMF\_PIO} should be set to either "internal" or "external" when // the ESMF library is built. // //EOPI diff --git a/src/Infrastructure/ArrayBundle/interface/ESMCI_ArrayBundle_F.C b/src/Infrastructure/ArrayBundle/interface/ESMCI_ArrayBundle_F.C index 1eea8c89b8..31ebde237e 100644 --- a/src/Infrastructure/ArrayBundle/interface/ESMCI_ArrayBundle_F.C +++ b/src/Infrastructure/ArrayBundle/interface/ESMCI_ArrayBundle_F.C @@ -84,7 +84,7 @@ extern "C" { rc); return; }catch(...){ - ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "- Caught exception", + ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "Caught exception", ESMC_CONTEXT, rc); return; } @@ -117,7 +117,7 @@ extern "C" { rc); return; }catch(...){ - ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "- Caught exception", + ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "Caught exception", ESMC_CONTEXT, rc); return; } @@ -160,7 +160,7 @@ extern "C" { delete [] cname; }else if(*len_name){ ESMC_LogDefault.MsgFoundError(ESMC_RC_PTR_NULL, - "- Not a valid string", ESMC_CONTEXT, ESMC_NOT_PRESENT_FILTER(rc)); + "Not a valid string", ESMC_CONTEXT, ESMC_NOT_PRESENT_FILTER(rc)); return; } // return successfully @@ -202,7 +202,7 @@ extern "C" { // opt_arrayList was provided if (*len_arrayList < *arrayCount){ ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_SIZE, - "- opt_arrayList must provide arrayCount elements", ESMC_CONTEXT, rc); + "opt_arrayList must provide arrayCount elements", ESMC_CONTEXT, rc); return; } // opt_arrayList has correct number of elements @@ -223,6 +223,12 @@ extern "C" { // Initialize return code; assume routine not implemented if (rc!=NULL) *rc = ESMC_RC_NOT_IMPL; int localrc = ESMC_RC_NOT_IMPL; + // test if this is a valid ArrayBundle + if ((*ptr)->ESMC_BaseGetStatus()!=ESMF_STATUS_READY){ + ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_BAD, + "not a valid object", ESMC_CONTEXT, rc); + return; + } // fill simple return values if (ESMC_NOT_PRESENT_FILTER(arrayCount) != ESMC_NULL_POINTER) *arrayCount = (*ptr)->getCount(); @@ -231,7 +237,7 @@ extern "C" { // opt_arrayList was provided if (*len_arrayList < (*ptr)->getCount()){ ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_SIZE, - "- opt_arrayList must provide arrayCount elements", ESMC_CONTEXT, rc); + "opt_arrayList must provide arrayCount elements", ESMC_CONTEXT, rc); return; } // opt_arrayList has correct number of elements @@ -266,7 +272,7 @@ extern "C" { rc); return; }catch(...){ - ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "- Caught exception", + ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "Caught exception", ESMC_CONTEXT, rc); return; } @@ -300,7 +306,7 @@ extern "C" { rc); return; }catch(...){ - ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "- Caught exception", + ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "Caught exception", ESMC_CONTEXT, rc); return; } @@ -330,7 +336,7 @@ extern "C" { rc); return; }catch(...){ - ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "- Caught exception", + ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "Caught exception", ESMC_CONTEXT, rc); return; } @@ -555,7 +561,7 @@ extern "C" { rc); return; }catch(...){ - ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "- Caught exception", + ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "Caught exception", ESMC_CONTEXT, rc); return; } @@ -602,7 +608,7 @@ extern "C" { rc); return; }catch(...){ - ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "- Caught exception", + ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "Caught exception", ESMC_CONTEXT, rc); return; } @@ -628,24 +634,24 @@ extern "C" { // must provide valid factorList and factorIndexList args if (!present(factorIndexList)){ ESMC_LogDefault.MsgFoundError(ESMC_RC_PTR_NULL, - "- Not a valid pointer to factorIndexList array", ESMC_CONTEXT, rc); + "Not a valid pointer to factorIndexList array", ESMC_CONTEXT, rc); return; } if ((factorIndexList)->dimCount != 2){ ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_RANK, - "- factorIndexList array must be of rank 2", ESMC_CONTEXT, rc); + "factorIndexList array must be of rank 2", ESMC_CONTEXT, rc); return; } if ((factorIndexList)->extent[0] != 2 && (factorIndexList)->extent[0] != 4){ ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_SIZE, - "- 1st dimension of factorIndexList array must be of size 2 or 4", + "1st dimension of factorIndexList array must be of size 2 or 4", ESMC_CONTEXT, rc); return; } if ((factorIndexList)->extent[1] != *factorListCount){ ESMC_LogDefault.MsgFoundError(ESMC_RC_ARG_SIZE, - "- 2nd dimension of factorIndexList does not match factorListCount", + "2nd dimension of factorIndexList does not match factorListCount", ESMC_CONTEXT, rc); return; } @@ -674,7 +680,7 @@ extern "C" { rc); return; }catch(...){ - ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "- Caught exception", + ESMC_LogDefault.MsgFoundError(ESMC_RC_INTNRL_BAD, "Caught exception", ESMC_CONTEXT, rc); return; } diff --git a/src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90 b/src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90 index 53f62d9320..0ca67e1d31 100644 --- a/src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90 +++ b/src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90 @@ -61,9 +61,8 @@ module ESMF_ArrayBundleMod #ifndef ESMF_NO_SEQUENCE sequence #endif - private type(ESMF_Pointer) :: this - ESMF_INIT_DECLARE + ESMF_INIT_DECLARE_NAMED_ALIAS end type !------------------------------------------------------------------------------ @@ -991,7 +990,7 @@ subroutine ESMF_ArrayBundleGetListAll(arraybundle, keywordEnforcer, & ESMF_CONTEXT, rcToReturn=rc)) return enddo endif - + ! Fill arrayNameList if (present(arrayNameList)) then do i=1, min(size(arrayNameList), opt_arrayCount) @@ -1000,20 +999,24 @@ subroutine ESMF_ArrayBundleGetListAll(arraybundle, keywordEnforcer, & ESMF_CONTEXT, rcToReturn=rc)) return enddo endif - + ! Garbage collection deallocate(opt_arrayPtrList) ! Special call to get name out of Base class if (present(name)) then - call c_ESMC_GetName(arraybundle, name, localrc) - if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & - ESMF_CONTEXT, rcToReturn=rc)) return + if (arraybundle%isNamedAlias) then + name = trim(arraybundle%name) + else + call c_ESMC_GetName(arraybundle, name, localrc) + if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & + ESMF_CONTEXT, rcToReturn=rc)) return + endif endif - + ! Return successfully if (present(rc)) rc = ESMF_SUCCESS - + end subroutine ESMF_ArrayBundleGetListAll !------------------------------------------------------------------------------ @@ -1667,12 +1670,13 @@ subroutine ESMF_ArrayBundleRead(arraybundle, fileName, keywordEnforcer, & ! !DESCRIPTION: ! Read Array data to an ArrayBundle object from file(s). ! For this API to be functional, the environment variable {\tt ESMF\_PIO} -! should be set to "internal" when the ESMF library is built. +! should be set to either "internal" or "external" when the ESMF library is built. ! Please see the section on Data I/O,~\ref{io:dataio}. ! ! Limitations: ! \begin{itemize} -! \item Only single tile Arrays are supported. +! \item For multi-tile Arrays, all Arrays in the ArrayBundle must contain +! the same number of tiles. ! \item Not supported in {\tt ESMF\_COMM=mpiuni} mode. ! \end{itemize} ! @@ -1682,6 +1686,12 @@ subroutine ESMF_ArrayBundleRead(arraybundle, fileName, keywordEnforcer, & ! An {\tt ESMF\_ArrayBundle} object. ! \item[fileName] ! The name of the file from which ArrayBundle data is read. +! If the ArrayBundle contains multi-tile Arrays, then fileName must contain +! exactly one instance of "\#"; this is a placeholder that will be replaced +! by the tile number, with each tile being read from a separate file. (For +! example, for a fileName of "myfile\#.nc", tile 1 will be read from +! "myfile1.nc", tile 2 from "myfile2.nc", etc.) +! (This handling of the fileName for multi-tile I/O is subject to change.) ! \item[{[singleFile]}] ! A logical flag, the default is .true., i.e., all Arrays in the bundle ! are stored in one single file. If .false., each Array is stored @@ -3805,7 +3815,7 @@ subroutine ESMF_ArrayBundleWrite(arraybundle, fileName, keywordEnforcer, & ! ! !DESCRIPTION: ! Write the Arrays into a file. For this API to be functional, -! the environment variable {\tt ESMF\_PIO} should be set to "internal" +! the environment variable {\tt ESMF\_PIO} should be set to either "internal" or "external" ! when the ESMF library is built. Please see the section on ! Data I/O,~\ref{io:dataio}. ! @@ -3820,7 +3830,8 @@ subroutine ESMF_ArrayBundleWrite(arraybundle, fileName, keywordEnforcer, & ! ! Limitations: ! \begin{itemize} -! \item Only single tile Arrays are supported. +! \item For multi-tile Arrays,all Arrays in the ArrayBundle must contain +! the same number of tiles. ! \item Not supported in {\tt ESMF\_COMM=mpiuni} mode. ! \end{itemize} ! @@ -3830,6 +3841,12 @@ subroutine ESMF_ArrayBundleWrite(arraybundle, fileName, keywordEnforcer, & ! An {\tt ESMF\_ArrayBundle} object. ! \item[fileName] ! The name of the output file to which array bundle data is written. +! If the ArrayBundle contains multi-tile Arrays, then fileName must contain +! exactly one instance of "\#"; this is a placeholder that will be replaced +! by the tile number, with each tile being written to a separate file. (For +! example, for a fileName of "myfile\#.nc", tile 1 will be written to +! "myfile1.nc", tile 2 to "myfile2.nc", etc.) +! (This handling of the fileName for multi-tile I/O is subject to change.) ! \item[{[convention]}] ! Specifies an Attribute package associated with the ArrayBundle, and the ! contained Arrays, used to create NetCDF dimension labels and attributes diff --git a/src/Infrastructure/ArrayBundle/src/ESMCI_ArrayBundle.C b/src/Infrastructure/ArrayBundle/src/ESMCI_ArrayBundle.C index 6ed6af307e..a9cfa4dcdd 100644 --- a/src/Infrastructure/ArrayBundle/src/ESMCI_ArrayBundle.C +++ b/src/Infrastructure/ArrayBundle/src/ESMCI_ArrayBundle.C @@ -318,7 +318,7 @@ int ArrayBundle::read( // !DESCRIPTION: // Read Array data to an ArrayBundle object from file(s). // For this API to be functional, the environment variable {\tt ESMF\_PIO} -// should be set to "internal" when the ESMF library is built. +// should be set to either "internal" or "external" when the ESMF library is built. // //EOPI //----------------------------------------------------------------------------- @@ -426,7 +426,7 @@ int ArrayBundle::write( // // !DESCRIPTION: // Write the Arrays into a file. For this API to be functional, -// the environment variable {\tt ESMF\_PIO} should be set to "internal" +// the environment variable {\tt ESMF\_PIO} should be set to either "internal" or "external" // when the ESMF library is built. // //EOPI diff --git a/src/Infrastructure/Base/include/nlohmann/json/LICENSE.MIT b/src/Infrastructure/Base/include/nlohmann/json/LICENSE.MIT index db73c5f7d6..1c1f7a690d 100644 --- a/src/Infrastructure/Base/include/nlohmann/json/LICENSE.MIT +++ b/src/Infrastructure/Base/include/nlohmann/json/LICENSE.MIT @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2013-2019 Niels Lohmann +Copyright (c) 2013-2022 Niels Lohmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Infrastructure/Base/include/nlohmann/json/README.md b/src/Infrastructure/Base/include/nlohmann/json/README.md index 1ca7582aae..6e4a83fb56 100644 --- a/src/Infrastructure/Base/include/nlohmann/json/README.md +++ b/src/Infrastructure/Base/include/nlohmann/json/README.md @@ -1,7 +1,7 @@ # JSON for Modern C++ * URL: https://github.com/nlohmann/json -* Release: v3.7.3 +* Release: v3.11.2 * Git Clone Command: `git clone -b --depth 1 ` ## Updating to New Version @@ -17,4 +17,6 @@ * Added initial code (v3.2.0) to ESMF Attribute directory * Added `README.md` describing how to bring in additional versions * 2020-03-02, Ben Koziol - * Updated `nlohmann/json` to tag `v3.7.3`. \ No newline at end of file + * Updated `nlohmann/json` to tag `v3.7.3`. +* 2022-09-15, Bill Sacks + * Updated `nlohmann/json` to tag `v3.11.2`. diff --git a/src/Infrastructure/Base/include/nlohmann/json/json.hpp b/src/Infrastructure/Base/include/nlohmann/json/json.hpp index 7629ff7bbe..4d1a37ad7c 100644 --- a/src/Infrastructure/Base/include/nlohmann/json/json.hpp +++ b/src/Infrastructure/Base/include/nlohmann/json/json.hpp @@ -1,46 +1,30 @@ -/* - __ _____ _____ _____ - __| | __| | | | JSON for Modern C++ -| | |__ | | | | | | version 3.7.3 -|_____|_____|_____|_|___| https://github.com/nlohmann/json - -Licensed under the MIT License . -SPDX-License-Identifier: MIT -Copyright (c) 2013-2019 Niels Lohmann . - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + +/****************************************************************************\ + * Note on documentation: The source files contain links to the online * + * documentation of the public API at https://json.nlohmann.me. This URL * + * contains the most recent documentation and should also be applicable to * + * previous versions; documentation for deprecated functions is not * + * removed, but marked deprecated. See "Generate documentation" section in * + * file docs/README.md. * +\****************************************************************************/ #ifndef INCLUDE_NLOHMANN_JSON_HPP_ #define INCLUDE_NLOHMANN_JSON_HPP_ -#define NLOHMANN_JSON_VERSION_MAJOR 3 -#define NLOHMANN_JSON_VERSION_MINOR 7 -#define NLOHMANN_JSON_VERSION_PATCH 3 - #include // all_of, find, for_each -#include // assert -#include // and, not, or #include // nullptr_t, ptrdiff_t, size_t #include // hash, less #include // initializer_list -#include // istream, ostream +#ifndef JSON_NO_IO + #include // istream, ostream +#endif // JSON_NO_IO #include // random_access_iterator_tag #include // unique_ptr #include // accumulate @@ -49,16 +33,133 @@ SOFTWARE. #include // vector // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + #include +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// This file contains all macro definitions affecting or depending on the ABI + +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 2 + #warning "Already included a different version of the library!" + #endif + #endif +#endif + +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 2 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 +#endif + +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 +#endif + +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS +#endif + +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp +#else + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 +#endif + +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) + +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) + +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) + +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif + +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) + +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif + // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + #include // transform #include // array -#include // and, not #include // forward_list #include // inserter, front_inserter, end #include // map @@ -70,63 +171,169 @@ SOFTWARE. #include // valarray // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + +#include // nullptr_t #include // exception #include // runtime_error #include // to_string +#include // vector -// #include +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + +#include // array #include // size_t +#include // uint8_t +#include // string + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + -namespace nlohmann +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template struct make_void { + using type = void; +}; +template using void_t = typename make_void::type; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + + +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { -/// struct to capture the start position of the current token -struct position_t + +// https://en.cppreference.com/w/cpp/experimental/is_detected +struct nonesuch { - /// the total number of characters read - std::size_t chars_read_total = 0; - /// the number of characters read in the current line - std::size_t chars_read_current_line = 0; - /// the number of lines read - std::size_t lines_read = 0; + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; +}; - /// conversion to size_t to preserve SAX interface - constexpr operator size_t() const - { - return chars_read_total; - } +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> +{ + using value_t = std::true_type; + using type = Op; }; -} // namespace detail -} // namespace nlohmann +template class Op, class... Args> +using is_detected = typename detector::value_t; -// #include +template class Op, class... Args> +struct is_detected_lazy : is_detected { }; +template class Op, class... Args> +using detected_t = typename detector::type; + +template class Op, class... Args> +using detected_or = detector; + +template class Op, class... Args> +using detected_or_t = typename detected_or::type; + +template class Op, class... Args> +using is_detected_exact = std::is_same>; + +template class Op, class... Args> +using is_detected_convertible = + std::is_convertible, To>; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END -#include // pair // #include + + +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson +// SPDX-License-Identifier: MIT + /* Hedley - https://nemequ.github.io/hedley * Created by Evan Nemerson - * - * To the extent possible under law, the author(s) have dedicated all - * copyright and related and neighboring rights to this software to - * the public domain worldwide. This software is distributed without - * any warranty. - * - * For details, see . - * SPDX-License-Identifier: CC0-1.0 */ -#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 11) +#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) #if defined(JSON_HEDLEY_VERSION) #undef JSON_HEDLEY_VERSION #endif -#define JSON_HEDLEY_VERSION 11 +#define JSON_HEDLEY_VERSION 15 #if defined(JSON_HEDLEY_STRINGIFY_EX) #undef JSON_HEDLEY_STRINGIFY_EX @@ -148,6 +355,16 @@ struct position_t #endif #define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) +#if defined(JSON_HEDLEY_CONCAT3_EX) + #undef JSON_HEDLEY_CONCAT3_EX +#endif +#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c + +#if defined(JSON_HEDLEY_CONCAT3) + #undef JSON_HEDLEY_CONCAT3 +#endif +#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) + #if defined(JSON_HEDLEY_VERSION_ENCODE) #undef JSON_HEDLEY_VERSION_ENCODE #endif @@ -189,18 +406,18 @@ struct position_t #if defined(JSON_HEDLEY_MSVC_VERSION) #undef JSON_HEDLEY_MSVC_VERSION #endif -#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) +#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) -#elif defined(_MSC_FULL_VER) +#elif defined(_MSC_FULL_VER) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) #endif #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) #undef JSON_HEDLEY_MSVC_VERSION_CHECK #endif -#if !defined(_MSC_VER) +#if !defined(JSON_HEDLEY_MSVC_VERSION) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) #elif defined(_MSC_VER) && (_MSC_VER >= 1400) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) @@ -213,9 +430,9 @@ struct position_t #if defined(JSON_HEDLEY_INTEL_VERSION) #undef JSON_HEDLEY_INTEL_VERSION #endif -#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) -#elif defined(__INTEL_COMPILER) +#elif defined(__INTEL_COMPILER) && !defined(__ICL) #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) #endif @@ -228,6 +445,22 @@ struct position_t #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) #endif +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #undef JSON_HEDLEY_INTEL_CL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) + #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) +#endif + #if defined(JSON_HEDLEY_PGI_VERSION) #undef JSON_HEDLEY_PGI_VERSION #endif @@ -323,9 +556,17 @@ struct position_t #if defined(JSON_HEDLEY_TI_VERSION) #undef JSON_HEDLEY_TI_VERSION #endif -#if defined(__TI_COMPILER_VERSION__) +#if \ + defined(__TI_COMPILER_VERSION__) && \ + ( \ + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ + ) +#if (__TI_COMPILER_VERSION__ >= 16000000) #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif +#endif #if defined(JSON_HEDLEY_TI_VERSION_CHECK) #undef JSON_HEDLEY_TI_VERSION_CHECK @@ -336,6 +577,102 @@ struct position_t #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) #endif +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #undef JSON_HEDLEY_TI_CL2000_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) + #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #undef JSON_HEDLEY_TI_CL430_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) + #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #undef JSON_HEDLEY_TI_ARMCL_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) + #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) + #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #undef JSON_HEDLEY_TI_CL6X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) + #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #undef JSON_HEDLEY_TI_CL7X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) + #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #undef JSON_HEDLEY_TI_CLPRU_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) + #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) +#endif + #if defined(JSON_HEDLEY_CRAY_VERSION) #undef JSON_HEDLEY_CRAY_VERSION #endif @@ -363,7 +700,7 @@ struct position_t #if __VER__ > 1000 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) #else - #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0) + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) #endif #endif @@ -440,17 +777,41 @@ struct position_t #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) #endif +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #undef JSON_HEDLEY_MCST_LCC_VERSION +#endif +#if defined(__LCC__) && defined(__LCC_MINOR__) + #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) + #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) +#endif + #if defined(JSON_HEDLEY_GCC_VERSION) #undef JSON_HEDLEY_GCC_VERSION #endif #if \ defined(JSON_HEDLEY_GNUC_VERSION) && \ - !(defined(__clang__) && !defined(__INTEL_COMPILER)) && \ + !defined(__clang__) && \ !defined(JSON_HEDLEY_INTEL_VERSION) && \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_ARM_VERSION) && \ + !defined(JSON_HEDLEY_CRAY_VERSION) && \ !defined(JSON_HEDLEY_TI_VERSION) && \ - !defined(__COMPCERT__) + !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ + !defined(__COMPCERT__) && \ + !defined(JSON_HEDLEY_MCST_LCC_VERSION) #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION #endif @@ -466,17 +827,21 @@ struct position_t #if defined(JSON_HEDLEY_HAS_ATTRIBUTE) #undef JSON_HEDLEY_HAS_ATTRIBUTE #endif -#if defined(__has_attribute) - #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) +#if \ + defined(__has_attribute) && \ + ( \ + (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ + ) +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) #else - #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE #endif #if defined(__has_attribute) - #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #else #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif @@ -485,7 +850,7 @@ struct position_t #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE #endif #if defined(__has_attribute) - #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #else #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif @@ -509,6 +874,7 @@ struct position_t #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) #elif \ !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION) && \ (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) @@ -669,30 +1035,21 @@ struct position_t #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif -/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for - HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) - #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ -#endif -#if defined(__cplusplus) && JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") -# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ - xpr \ - JSON_HEDLEY_DIAGNOSTIC_POP -#else -# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x -#endif - #if \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ - (defined(__clang__) && !defined(__INTEL_COMPILER)) || \ + defined(__clang__) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ @@ -710,7 +1067,7 @@ struct position_t #if defined(JSON_HEDLEY_DIAGNOSTIC_POP) #undef JSON_HEDLEY_DIAGNOSTIC_POP #endif -#if (defined(__clang__) && !defined(__INTEL_COMPILER)) +#if defined(__clang__) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) @@ -719,13 +1076,21 @@ struct position_t #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) #elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") -#elif JSON_HEDLEY_TI_VERSION_CHECK(8,1,0) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) @@ -736,50 +1101,173 @@ struct position_t #define JSON_HEDLEY_DIAGNOSTIC_POP #endif -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) - #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") -#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) -#elif JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") -#else - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED -#endif - -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) - #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ #endif -#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") -#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") +# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") +# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# endif +#endif +#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x +#endif + +#if defined(JSON_HEDLEY_CONST_CAST) + #undef JSON_HEDLEY_CONST_CAST +#endif +#if defined(__cplusplus) +# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) +#elif \ + JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_REINTERPRET_CAST) + #undef JSON_HEDLEY_REINTERPRET_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) +#else + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_STATIC_CAST) + #undef JSON_HEDLEY_STATIC_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) +#else + #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_CPP_CAST) + #undef JSON_HEDLEY_CPP_CAST +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ + ((T) (expr)) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("diag_suppress=Pe137") \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) +# endif +#else +# define JSON_HEDLEY_CPP_CAST(T, expr) (expr) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) -#elif JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS #endif @@ -793,14 +1281,25 @@ struct position_t #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) #elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") -#elif JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES #endif @@ -818,39 +1317,73 @@ struct position_t #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL #endif +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunused-function") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif + #if defined(JSON_HEDLEY_DEPRECATED) #undef JSON_HEDLEY_DEPRECATED #endif #if defined(JSON_HEDLEY_DEPRECATED_FOR) #undef JSON_HEDLEY_DEPRECATED_FOR #endif -#if defined(__cplusplus) && (__cplusplus >= 201402L) - #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) - #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) #elif \ - JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \ + (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,3,0) + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) +#elif defined(__cplusplus) && (__cplusplus >= 201402L) + #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) - #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) - #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) + JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) @@ -867,7 +1400,8 @@ struct position_t #if \ JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) #else #define JSON_HEDLEY_UNAVAILABLE(available_since) @@ -876,21 +1410,41 @@ struct position_t #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) #undef JSON_HEDLEY_WARN_UNUSED_RESULT #endif -#if defined(__cplusplus) && (__cplusplus >= 201703L) - #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) -#elif \ +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG +#endif +#if \ JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) +#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) #elif defined(_Check_return_) /* SAL */ #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ #else #define JSON_HEDLEY_WARN_UNUSED_RESULT + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) #endif #if defined(JSON_HEDLEY_SENTINEL) @@ -900,7 +1454,8 @@ struct position_t JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) #else #define JSON_HEDLEY_SENTINEL(position) @@ -911,7 +1466,9 @@ struct position_t #endif #if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_NO_RETURN __noreturn -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +#elif \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define JSON_HEDLEY_NO_RETURN _Noreturn @@ -923,14 +1480,26 @@ struct position_t JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(18,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(17,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) -#elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) && defined(__cplusplus) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) @@ -955,54 +1524,57 @@ struct position_t #if defined(JSON_HEDLEY_UNREACHABLE_RETURN) #undef JSON_HEDLEY_UNREACHABLE_RETURN #endif -#if \ - (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) - #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) - #define JSON_HEDLEY_UNREACHABLE() __assume(0) -#elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) - #if defined(__cplusplus) - #define JSON_HEDLEY_UNREACHABLE() std::_nassert(0) - #else - #define JSON_HEDLEY_UNREACHABLE() _nassert(0) - #endif - #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return value -#elif defined(EXIT_FAILURE) - #define JSON_HEDLEY_UNREACHABLE() abort() -#else - #define JSON_HEDLEY_UNREACHABLE() - #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return value -#endif -#if !defined(JSON_HEDLEY_UNREACHABLE_RETURN) - #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() -#endif - #if defined(JSON_HEDLEY_ASSUME) #undef JSON_HEDLEY_ASSUME #endif #if \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_ASSUME(expr) __assume(expr) #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) -#elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) +#elif \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) #if defined(__cplusplus) #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) #else #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) #endif -#elif \ - (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && !defined(JSON_HEDLEY_ARM_VERSION)) || \ +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) - #define JSON_HEDLEY_ASSUME(expr) ((void) ((expr) ? 1 : (__builtin_unreachable(), 1))) + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() +#elif defined(JSON_HEDLEY_ASSUME) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif +#if !defined(JSON_HEDLEY_ASSUME) + #if defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) + #else + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) + #endif +#endif +#if defined(JSON_HEDLEY_UNREACHABLE) + #if \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) + #else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() + #endif #else - #define JSON_HEDLEY_ASSUME(expr) ((void) (expr)) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) +#endif +#if !defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) #endif JSON_HEDLEY_DIAGNOSTIC_PUSH @@ -1013,7 +1585,7 @@ JSON_HEDLEY_DIAGNOSTIC_PUSH #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" #endif #if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) - #if (defined(__clang__) && !defined(__INTEL_COMPILER)) + #if defined(__clang__) #pragma clang diagnostic ignored "-Wvariadic-macros" #elif defined(JSON_HEDLEY_GCC_VERSION) #pragma GCC diagnostic ignored "-Wvariadic-macros" @@ -1046,8 +1618,18 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) @@ -1080,44 +1662,50 @@ JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_UNPREDICTABLE #endif #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) - #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable(!!(expr)) + #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) #endif #if \ - JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) -# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability(expr, value, probability) -# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1, probability) -# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0, probability) -# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) -# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) -#if !defined(JSON_HEDLEY_BUILTIN_UNPREDICTABLE) - #define JSON_HEDLEY_BUILTIN_UNPREDICTABLE(expr) __builtin_expect_with_probability(!!(expr), 1, 0.5) -#endif + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) #elif \ - JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) || \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PREDICT(expr, expected, probability) \ - (((probability) >= 0.9) ? __builtin_expect(!!(expr), (expected)) : (((void) (expected)), !!(expr))) + (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ (__extension__ ({ \ - JSON_HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \ + double hedley_probability_ = (probability); \ ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ })) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ (__extension__ ({ \ - JSON_HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \ + double hedley_probability_ = (probability); \ ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ })) # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) #else -# define JSON_HEDLEY_PREDICT(expr, expected, probability) (((void) (expected)), !!(expr)) +# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) # define JSON_HEDLEY_LIKELY(expr) (!!(expr)) @@ -1137,12 +1725,24 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_MALLOC __declspec(restrict) #else #define JSON_HEDLEY_MALLOC @@ -1152,22 +1752,37 @@ JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_PURE #endif #if \ - JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) - #define JSON_HEDLEY_PURE __attribute__((__pure__)) + JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PURE __attribute__((__pure__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) - #define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") -#elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) && defined(__cplusplus) - #define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") +# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + ) +# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") #else - #define JSON_HEDLEY_PURE +# define JSON_HEDLEY_PURE #endif #if defined(JSON_HEDLEY_CONST) @@ -1180,9 +1795,19 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_CONST __attribute__((__const__)) #elif \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) @@ -1200,13 +1825,18 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ - (defined(__clang__) && !defined(__INTEL_COMPILER)) + defined(__clang__) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_RESTRICT __restrict #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) #define JSON_HEDLEY_RESTRICT _Restrict @@ -1227,8 +1857,15 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_INLINE __inline__ #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_INLINE __inline #else #define JSON_HEDLEY_INLINE @@ -1238,23 +1875,44 @@ JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_ALWAYS_INLINE #endif #if \ - JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) - #define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) - #define JSON_HEDLEY_ALWAYS_INLINE __forceinline -#elif JSON_HEDLEY_TI_VERSION_CHECK(7,0,0) && defined(__cplusplus) - #define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") + JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_ALWAYS_INLINE __forceinline +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + ) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) - #define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") #else - #define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE +# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE #endif #if defined(JSON_HEDLEY_NEVER_INLINE) @@ -1267,14 +1925,27 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) #elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") -#elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) && defined(__cplusplus) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") @@ -1296,26 +1967,32 @@ JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_IMPORT #endif #if defined(_WIN32) || defined(__CYGWIN__) - #define JSON_HEDLEY_PRIVATE - #define JSON_HEDLEY_PUBLIC __declspec(dllexport) - #define JSON_HEDLEY_IMPORT __declspec(dllimport) +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC __declspec(dllexport) +# define JSON_HEDLEY_IMPORT __declspec(dllimport) #else - #if \ - JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_EABI__) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) - #define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) - #define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) - #else - #define JSON_HEDLEY_PRIVATE - #define JSON_HEDLEY_PUBLIC - #endif - #define JSON_HEDLEY_IMPORT extern +# if \ + JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + ( \ + defined(__TI_EABI__) && \ + ( \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ + ) \ + ) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) +# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) +# else +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC +# endif +# define JSON_HEDLEY_IMPORT extern #endif #if defined(JSON_HEDLEY_NO_THROW) @@ -1324,10 +2001,12 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if \ JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) #define JSON_HEDLEY_NO_THROW __declspec(nothrow) #else @@ -1337,7 +2016,10 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if defined(JSON_HEDLEY_FALL_THROUGH) #undef JSON_HEDLEY_FALL_THROUGH #endif -#if JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(fallthrough,7,0,0) && !defined(JSON_HEDLEY_PGI_VERSION) +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) @@ -1354,7 +2036,8 @@ JSON_HEDLEY_DIAGNOSTIC_POP #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) #elif defined(_Ret_notnull_) /* SAL */ #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ @@ -1394,9 +2077,10 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) #endif #if !defined(__cplusplus) @@ -1415,8 +2099,12 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) #endif # elif \ - (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && !defined(JSON_HEDLEY_SUNPRO_VERSION) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ - JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) || \ + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION)) || \ + (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ @@ -1431,8 +2119,13 @@ JSON_HEDLEY_DIAGNOSTIC_POP defined(JSON_HEDLEY_GCC_VERSION) || \ defined(JSON_HEDLEY_INTEL_VERSION) || \ defined(JSON_HEDLEY_TINYC_VERSION) || \ - defined(JSON_HEDLEY_TI_VERSION) || \ - (defined(__clang__) && !defined(__INTEL_COMPILER)) + defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ + defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ + defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ + defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ + defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) # define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ sizeof(void) != \ sizeof(*( \ @@ -1481,7 +2174,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if \ !defined(__cplusplus) && ( \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ - JSON_HEDLEY_HAS_FEATURE(c_static_assert) || \ + (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ defined(_Static_assert) \ @@ -1490,58 +2183,12 @@ JSON_HEDLEY_DIAGNOSTIC_POP #elif \ (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ - (defined(__cplusplus) && JSON_HEDLEY_TI_VERSION_CHECK(8,3,0)) + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) # define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) #else # define JSON_HEDLEY_STATIC_ASSERT(expr, message) #endif -#if defined(JSON_HEDLEY_CONST_CAST) - #undef JSON_HEDLEY_CONST_CAST -#endif -#if defined(__cplusplus) -# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) -#elif \ - JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) -# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ - ((T) (expr)); \ - JSON_HEDLEY_DIAGNOSTIC_POP \ - })) -#else -# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) -#endif - -#if defined(JSON_HEDLEY_REINTERPRET_CAST) - #undef JSON_HEDLEY_REINTERPRET_CAST -#endif -#if defined(__cplusplus) - #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) -#else - #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (*((T*) &(expr))) -#endif - -#if defined(JSON_HEDLEY_STATIC_CAST) - #undef JSON_HEDLEY_STATIC_CAST -#endif -#if defined(__cplusplus) - #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) -#else - #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) -#endif - -#if defined(JSON_HEDLEY_CPP_CAST) - #undef JSON_HEDLEY_CPP_CAST -#endif -#if defined(__cplusplus) - #define JSON_HEDLEY_CPP_CAST(T, expr) static_cast(expr) -#else - #define JSON_HEDLEY_CPP_CAST(T, expr) (expr) -#endif - #if defined(JSON_HEDLEY_NULL) #undef JSON_HEDLEY_NULL #endif @@ -1593,9 +2240,12 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_DIAGNOSTIC_POP #elif \ JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) #else # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) @@ -1631,8 +2281,10 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if defined(JSON_HEDLEY_FLAGS) #undef JSON_HEDLEY_FLAGS #endif -#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) +#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) +#else + #define JSON_HEDLEY_FLAGS #endif #if defined(JSON_HEDLEY_FLAGS_CAST) @@ -1652,7 +2304,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if defined(JSON_HEDLEY_EMPTY_BASES) #undef JSON_HEDLEY_EMPTY_BASES #endif -#if JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0) +#if \ + (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) #else #define JSON_HEDLEY_EMPTY_BASES @@ -1663,7 +2317,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK #endif -#if (defined(__clang__) && !defined(__INTEL_COMPILER)) +#if defined(__clang__) #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) #else #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) @@ -1707,12 +2361,15 @@ JSON_HEDLEY_DIAGNOSTIC_POP #endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ -// This file contains all internal macro definitions +// This file contains all internal macro definitions (except those affecting ABI) // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them +// #include + + // exclude unsupported compilers #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) - #if (defined(__clang__) && !defined(__INTEL_COMPILER)) + #if defined(__clang__) #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif @@ -1724,26 +2381,128 @@ JSON_HEDLEY_DIAGNOSTIC_POP #endif // C++ language standard detection -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 - #define JSON_HAS_CPP_17 - #define JSON_HAS_CPP_14 -#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) - #define JSON_HAS_CPP_14 +// if the user manually specified the used c++ version this is skipped +#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) + #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 + #endif + // the cpp 11 flag is always specified because it is the minimal required version + #define JSON_HAS_CPP_11 #endif -// disable float-equal warnings on GCC/clang -#if (defined(__clang__) && !defined(__INTEL_COMPILER)) || defined(__GNUC__) || defined(__GNUG__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wfloat-equal" +#ifdef __has_include + #if __has_include() + #include + #endif #endif -// disable documentation warnings on clang -#if (defined(__clang__) && !defined(__INTEL_COMPILER)) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdocumentation" -#endif +#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) + #ifdef JSON_HAS_CPP_17 + #if defined(__cpp_lib_filesystem) + #define JSON_HAS_FILESYSTEM 1 + #elif defined(__cpp_lib_experimental_filesystem) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif !defined(__has_include) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #endif -// allow to disable exceptions + // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ + #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__clang_major__) && __clang_major__ < 7 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support + #if defined(_MSC_VER) && _MSC_VER < 1914 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before iOS 13 + #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before macOS Catalina + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + #endif +#endif + +#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_FILESYSTEM + #define JSON_HAS_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_THREE_WAY_COMPARISON + #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ + && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L + #define JSON_HAS_THREE_WAY_COMPARISON 1 + #else + #define JSON_HAS_THREE_WAY_COMPARISON 0 + #endif +#endif + +#ifndef JSON_HAS_RANGES + // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error + #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 + #define JSON_HAS_RANGES 0 + #elif defined(__cpp_lib_ranges) + #define JSON_HAS_RANGES 1 + #else + #define JSON_HAS_RANGES 0 + #endif +#endif + +#ifdef JSON_HAS_CPP_17 + #define JSON_INLINE_VARIABLE inline +#else + #define JSON_INLINE_VARIABLE +#endif + +#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) + #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define JSON_NO_UNIQUE_ADDRESS +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdocumentation" + #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +#endif + +// allow disabling exceptions #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) #define JSON_THROW(exception) throw exception #define JSON_TRY try @@ -1777,6 +2536,19 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER #endif +// allow overriding assert +#if !defined(JSON_ASSERT) + #include // assert + #define JSON_ASSERT(x) assert(x) +#endif + +// allow to access some private functions (needed by the test suite) +#if defined(JSON_TESTS_PRIVATE) + #define JSON_PRIVATE_UNLESS_TESTED public +#else + #define JSON_PRIVATE_UNLESS_TESTED private +#endif + /*! @brief macro to briefly define a mapping between an enum and JSON @def NLOHMANN_JSON_SERIALIZE_ENUM @@ -1817,413 +2589,603 @@ JSON_HEDLEY_DIAGNOSTIC_POP class StringType, class BooleanType, class NumberIntegerType, \ class NumberUnsignedType, class NumberFloatType, \ template class AllocatorType, \ - template class JSONSerializer> + template class JSONSerializer, \ + class BinaryType> #define NLOHMANN_BASIC_JSON_TPL \ basic_json + AllocatorType, JSONSerializer, BinaryType> + +// Macros to simplify conversion from/to types + +#define NLOHMANN_JSON_EXPAND( x ) x +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) +#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) +#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) +#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) +#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) + +#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; +#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); +#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } -namespace nlohmann -{ -namespace detail -{ -//////////////// -// exceptions // -//////////////// +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } /*! -@brief general exception of the @ref basic_json class +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } -This class is an extension of `std::exception` objects with a member @a id for -exception ids. It is used as the base class for all exceptions thrown by the -@ref basic_json class. This class can hence be used as "wildcard" to catch -exceptions. +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } -Subclasses: -- @ref parse_error for exceptions indicating a parse error -- @ref invalid_iterator for exceptions indicating errors with iterators -- @ref type_error for exceptions indicating executing a member function with - a wrong type -- @ref out_of_range for exceptions indicating access out of the defined range -- @ref other_error for exceptions indicating other library errors -@internal -@note To have nothrow-copy-constructible exceptions, we internally use - `std::runtime_error` which can cope with arbitrary-length error messages. - Intermediate strings are built with static functions and then passed to - the actual constructor. -@endinternal +// inspired from https://stackoverflow.com/a/26745591 +// allows to call any std function as if (e.g. with begin): +// using std::begin; begin(x); +// +// it allows using the detected idiom to retrieve the return type +// of such an expression +#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ + namespace detail { \ + using std::std_name; \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + } \ + \ + namespace detail2 { \ + struct std_name##_tag \ + { \ + }; \ + \ + template \ + std_name##_tag std_name(T&&...); \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + \ + template \ + struct would_call_std_##std_name \ + { \ + static constexpr auto const value = ::nlohmann::detail:: \ + is_detected_exact::value; \ + }; \ + } /* namespace detail2 */ \ + \ + template \ + struct would_call_std_##std_name : detail2::would_call_std_##std_name \ + { \ + } + +#ifndef JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_USE_IMPLICIT_CONVERSIONS 1 +#endif + +#if JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_EXPLICIT +#else + #define JSON_EXPLICIT explicit +#endif -@liveexample{The following code shows how arbitrary library exceptions can be -caught.,exception} +#ifndef JSON_DISABLE_ENUM_SERIALIZATION + #define JSON_DISABLE_ENUM_SERIALIZATION 0 +#endif -@since version 3.0.0 -*/ -class exception : public std::exception +#ifndef JSON_USE_GLOBAL_UDLS + #define JSON_USE_GLOBAL_UDLS 1 +#endif + +#if JSON_HAS_THREE_WAY_COMPARISON + #include // partial_ordering +#endif + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail { - public: - /// returns the explanatory string - JSON_HEDLEY_RETURNS_NON_NULL - const char* what() const noexcept override - { - return m.what(); - } - /// the id of the exception - const int id; +/////////////////////////// +// JSON type enumeration // +/////////////////////////// - protected: - JSON_HEDLEY_NON_NULL(3) - exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} +/*! +@brief the JSON type enumeration - static std::string name(const std::string& ename, int id_) - { - return "[json.exception." + ename + "." + std::to_string(id_) + "] "; - } +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. - private: - /// an exception object as storage for error messages - std::runtime_error m; +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : std::uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + binary, ///< binary array (ordered collection of bytes) + discarded ///< discarded by the parser callback function }; /*! -@brief exception indicating a parse error - -This exception is thrown by the library when a parse error occurs. Parse errors -can occur during the deserialization of JSON text, CBOR, MessagePack, as well -as when using JSON Patch. - -Member @a byte holds the byte index of the last read character in the input -file. - -Exceptions have ids 1xx. - -name / id | example message | description ------------------------------- | --------------- | ------------------------- -json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position. -json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. -json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. -json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. -json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. -json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`. -json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. -json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences. -json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number. -json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. -json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. -json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. -json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet). - -@note For an input with n bytes, 1 is the index of the first character and n+1 - is the index of the terminating null byte or the end of file. This also - holds true when reading a byte vector (CBOR or MessagePack). - -@liveexample{The following code shows how a `parse_error` exception can be -caught.,parse_error} - -@sa - @ref exception for the base class of the library exceptions -@sa - @ref invalid_iterator for exceptions indicating errors with iterators -@sa - @ref type_error for exceptions indicating executing a member function with - a wrong type -@sa - @ref out_of_range for exceptions indicating access out of the defined range -@sa - @ref other_error for exceptions indicating other library errors - -@since version 3.0.0 +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string < binary +- furthermore, each type is not smaller than itself +- discarded values are not comparable +- binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + +@since version 1.0.0 */ -class parse_error : public exception +#if JSON_HAS_THREE_WAY_COMPARISON + inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* +#else + inline bool operator<(const value_t lhs, const value_t rhs) noexcept +#endif { - public: - /*! - @brief create a parse error exception - @param[in] id_ the id of the exception - @param[in] pos the position where the error occurred (or with - chars_read_total=0 if the position cannot be - determined) - @param[in] what_arg the explanatory string - @return parse_error object - */ - static parse_error create(int id_, const position_t& pos, const std::string& what_arg) - { - std::string w = exception::name("parse_error", id_) + "parse error" + - position_string(pos) + ": " + what_arg; - return parse_error(id_, pos.chars_read_total, w.c_str()); - } + static constexpr std::array order = {{ + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } + }; - static parse_error create(int id_, std::size_t byte_, const std::string& what_arg) + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); +#if JSON_HAS_THREE_WAY_COMPARISON + if (l_index < order.size() && r_index < order.size()) { - std::string w = exception::name("parse_error", id_) + "parse error" + - (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") + - ": " + what_arg; - return parse_error(id_, byte_, w.c_str()); + return order[l_index] <=> order[r_index]; // *NOPAD* } + return std::partial_ordering::unordered; +#else + return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; +#endif +} - /*! - @brief byte index of the parse error +// GCC selects the built-in operator< over an operator rewritten from +// a user-defined spaceship operator +// Clang, MSVC, and ICC select the rewritten candidate +// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) +#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) +inline bool operator<(const value_t lhs, const value_t rhs) noexcept +{ + return std::is_lt(lhs <=> rhs); // *NOPAD* +} +#endif - The byte index of the last read character in the input file. +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END - @note For an input with n bytes, 1 is the index of the first character and - n+1 is the index of the terminating null byte or the end of file. - This also holds true when reading a byte vector (CBOR or MessagePack). - */ - const std::size_t byte; +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT - private: - parse_error(int id_, std::size_t byte_, const char* what_arg) - : exception(id_, what_arg), byte(byte_) {} - static std::string position_string(const position_t& pos) - { - return " at line " + std::to_string(pos.lines_read + 1) + - ", column " + std::to_string(pos.chars_read_current_line); - } -}; -/*! -@brief exception indicating errors with iterators - -This exception is thrown if iterators passed to a library function do not match -the expected semantics. - -Exceptions have ids 2xx. - -name / id | example message | description ------------------------------------ | --------------- | ------------------------- -json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. -json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. -json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. -json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid. -json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. -json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. -json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. -json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. -json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. -json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. -json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. -json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. -json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. -json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin(). - -@liveexample{The following code shows how an `invalid_iterator` exception can be -caught.,invalid_iterator} - -@sa - @ref exception for the base class of the library exceptions -@sa - @ref parse_error for exceptions indicating a parse error -@sa - @ref type_error for exceptions indicating executing a member function with - a wrong type -@sa - @ref out_of_range for exceptions indicating access out of the defined range -@sa - @ref other_error for exceptions indicating other library errors - -@since version 3.0.0 -*/ -class invalid_iterator : public exception -{ - public: - static invalid_iterator create(int id_, const std::string& what_arg) - { - std::string w = exception::name("invalid_iterator", id_) + what_arg; - return invalid_iterator(id_, w.c_str()); - } +// #include - private: - JSON_HEDLEY_NON_NULL(3) - invalid_iterator(int id_, const char* what_arg) - : exception(id_, what_arg) {} -}; + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ /*! -@brief exception indicating executing a member function with a wrong type - -This exception is thrown in case of a type error; that is, a library function is -executed on a JSON value whose type does not match the expected semantics. - -Exceptions have ids 3xx. - -name / id | example message | description ------------------------------ | --------------- | ------------------------- -json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. -json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. -json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &. -json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types. -json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types. -json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types. -json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types. -json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types. -json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types. -json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types. -json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types. -json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types. -json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined. -json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers. -json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive. -json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. | -json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) | - -@liveexample{The following code shows how a `type_error` exception can be -caught.,type_error} - -@sa - @ref exception for the base class of the library exceptions -@sa - @ref parse_error for exceptions indicating a parse error -@sa - @ref invalid_iterator for exceptions indicating errors with iterators -@sa - @ref out_of_range for exceptions indicating access out of the defined range -@sa - @ref other_error for exceptions indicating other library errors - -@since version 3.0.0 +@brief replace all occurrences of a substring by another string + +@param[in,out] s the string to manipulate; changed so that all + occurrences of @a f are replaced with @a t +@param[in] f the substring to replace with @a t +@param[in] t the string to replace @a f + +@pre The search string @a f must not be empty. **This precondition is +enforced with an assertion.** + +@since version 2.0.0 */ -class type_error : public exception +template +inline void replace_substring(StringType& s, const StringType& f, + const StringType& t) { - public: - static type_error create(int id_, const std::string& what_arg) - { - std::string w = exception::name("type_error", id_) + what_arg; - return type_error(id_, w.c_str()); - } + JSON_ASSERT(!f.empty()); + for (auto pos = s.find(f); // find first occurrence of f + pos != StringType::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find next occurrence of f + {} +} - private: - JSON_HEDLEY_NON_NULL(3) - type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} -}; +/*! + * @brief string escaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to escape + * @return escaped string + * + * Note the order of escaping "~" to "~0" and "/" to "~1" is important. + */ +template +inline StringType escape(StringType s) +{ + replace_substring(s, StringType{"~"}, StringType{"~0"}); + replace_substring(s, StringType{"/"}, StringType{"~1"}); + return s; +} /*! -@brief exception indicating access out of the defined range - -This exception is thrown in case a library function is called on an input -parameter that exceeds the expected range, for instance in case of array -indices or nonexisting object keys. - -Exceptions have ids 4xx. - -name / id | example message | description -------------------------------- | --------------- | ------------------------- -json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1. -json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. -json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object. -json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. -json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. -json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. -json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. | -json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. | -json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string | - -@liveexample{The following code shows how an `out_of_range` exception can be -caught.,out_of_range} - -@sa - @ref exception for the base class of the library exceptions -@sa - @ref parse_error for exceptions indicating a parse error -@sa - @ref invalid_iterator for exceptions indicating errors with iterators -@sa - @ref type_error for exceptions indicating executing a member function with - a wrong type -@sa - @ref other_error for exceptions indicating other library errors - -@since version 3.0.0 -*/ -class out_of_range : public exception + * @brief string unescaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to unescape + * @return unescaped string + * + * Note the order of escaping "~1" to "/" and "~0" to "~" is important. + */ +template +static void unescape(StringType& s) { - public: - static out_of_range create(int id_, const std::string& what_arg) - { - std::string w = exception::name("out_of_range", id_) + what_arg; - return out_of_range(id_, w.c_str()); - } + replace_substring(s, StringType{"~1"}, StringType{"/"}); + replace_substring(s, StringType{"~0"}, StringType{"~"}); +} - private: - JSON_HEDLEY_NON_NULL(3) - out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} -}; +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT -/*! -@brief exception indicating other library errors -This exception is thrown in case of errors that cannot be classified with the -other exception types. -Exceptions have ids 5xx. +#include // size_t -name / id | example message | description ------------------------------- | --------------- | ------------------------- -json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. +// #include -@sa - @ref exception for the base class of the library exceptions -@sa - @ref parse_error for exceptions indicating a parse error -@sa - @ref invalid_iterator for exceptions indicating errors with iterators -@sa - @ref type_error for exceptions indicating executing a member function with - a wrong type -@sa - @ref out_of_range for exceptions indicating access out of the defined range -@liveexample{The following code shows how an `other_error` exception can be -caught.,other_error} +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ -@since version 3.0.0 -*/ -class other_error : public exception +/// struct to capture the start position of the current token +struct position_t { - public: - static other_error create(int id_, const std::string& what_arg) + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; + + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const { - std::string w = exception::name("other_error", id_) + what_arg; - return other_error(id_, w.c_str()); + return chars_read_total; } - - private: - JSON_HEDLEY_NON_NULL(3) - other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} }; + } // namespace detail -} // namespace nlohmann +NLOHMANN_JSON_NAMESPACE_END // #include // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-FileCopyrightText: 2018 The Abseil Authors +// SPDX-License-Identifier: MIT -#include // not + +#include // array #include // size_t #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +#include // index_sequence, make_index_sequence, index_sequence_for -namespace nlohmann -{ +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { -// alias templates to reduce boilerplate -template -using enable_if_t = typename std::enable_if::type; template using uncvref_t = typename std::remove_cv::type>::type; -// implementation of C++14 index_sequence and affiliates -// source: https://stackoverflow.com/a/32223343 -template -struct index_sequence -{ - using type = index_sequence; - using value_type = std::size_t; - static constexpr std::size_t size() noexcept - { - return sizeof...(Ints); - } -}; +#ifdef JSON_HAS_CPP_14 -template -struct merge_and_renumber; +// the following utilities are natively available in C++14 +using std::enable_if_t; +using std::index_sequence; +using std::make_index_sequence; +using std::index_sequence_for; -template -struct merge_and_renumber, index_sequence> - : index_sequence < I1..., (sizeof...(I1) + I2)... > {}; +#else -template -struct make_index_sequence - : merge_and_renumber < typename make_index_sequence < N / 2 >::type, - typename make_index_sequence < N - N / 2 >::type > {}; +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +// The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h +// which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. + +//// START OF CODE FROM GOOGLE ABSEIL + +// integer_sequence +// +// Class template representing a compile-time integer sequence. An instantiation +// of `integer_sequence` has a sequence of integers encoded in its +// type through its template arguments (which is a common need when +// working with C++11 variadic templates). `absl::integer_sequence` is designed +// to be a drop-in replacement for C++14's `std::integer_sequence`. +// +// Example: +// +// template< class T, T... Ints > +// void user_function(integer_sequence); +// +// int main() +// { +// // user_function's `T` will be deduced to `int` and `Ints...` +// // will be deduced to `0, 1, 2, 3, 4`. +// user_function(make_integer_sequence()); +// } +template +struct integer_sequence +{ + using value_type = T; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +// index_sequence +// +// A helper template for an `integer_sequence` of `size_t`, +// `absl::index_sequence` is designed to be a drop-in replacement for C++14's +// `std::index_sequence`. +template +using index_sequence = integer_sequence; + +namespace utility_internal +{ + +template +struct Extend; + +// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. +template +struct Extend, SeqSize, 0> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; +}; + +template +struct Extend, SeqSize, 1> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; +}; + +// Recursion helper for 'make_integer_sequence'. +// 'Gen::type' is an alias for 'integer_sequence'. +template +struct Gen +{ + using type = + typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; +}; + +template +struct Gen +{ + using type = integer_sequence; +}; + +} // namespace utility_internal -template<> struct make_index_sequence<0> : index_sequence<> {}; -template<> struct make_index_sequence<1> : index_sequence<0> {}; +// Compile-time sequences of integers + +// make_integer_sequence +// +// This template alias is equivalent to +// `integer_sequence`, and is designed to be a drop-in +// replacement for C++14's `std::make_integer_sequence`. +template +using make_integer_sequence = typename utility_internal::Gen::type; + +// make_index_sequence +// +// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, +// and is designed to be a drop-in replacement for C++14's +// `std::make_index_sequence`. +template +using make_index_sequence = make_integer_sequence; -template +// index_sequence_for +// +// Converts a typename pack into an index sequence of the same length, and +// is designed to be a drop-in replacement for C++14's +// `std::index_sequence_for()` +template using index_sequence_for = make_index_sequence; +//// END OF CODE FROM GOOGLE ABSEIL + +#endif + // dispatch utility (taken from ranges-v3) template struct priority_tag : priority_tag < N - 1 > {}; template<> struct priority_tag<0> {}; @@ -2232,53 +3194,67 @@ template<> struct priority_tag<0> {}; template struct static_const { - static constexpr T value{}; + static JSON_INLINE_VARIABLE constexpr T value{}; }; -template -constexpr T static_const::value; +#ifndef JSON_HAS_CPP_17 + template + constexpr T static_const::value; +#endif + +template +inline constexpr std::array make_array(Args&& ... args) +{ + return std::array {{static_cast(std::forward(args))...}}; +} + } // namespace detail -} // namespace nlohmann +NLOHMANN_JSON_NAMESPACE_END // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + -#include // not #include // numeric_limits #include // false_type, is_constructible, is_integral, is_same, true_type #include // declval +#include // tuple // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT -#include // random_access_iterator_tag -// #include +#include // random_access_iterator_tag +// #include -namespace nlohmann -{ -namespace detail -{ -template struct make_void -{ - using type = void; -}; -template using void_t = typename make_void::type; -} // namespace detail -} // namespace nlohmann +// #include // #include -namespace nlohmann -{ +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { -template + +template struct iterator_types {}; -template +template struct iterator_types < It, void_t +template struct iterator_traits { }; -template +template struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> : iterator_types { }; -template +template struct iterator_traits::value>> { using iterator_category = std::random_access_iterator_tag; @@ -2313,143 +3289,135 @@ struct iterator_traits::value>> using pointer = T*; using reference = T&; }; -} // namespace detail -} // namespace nlohmann + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END // #include -// #include +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT -// #include -#include +// #include -// #include +NLOHMANN_JSON_NAMESPACE_BEGIN -// http://en.cppreference.com/w/cpp/experimental/is_detected -namespace nlohmann -{ -namespace detail -{ -struct nonesuch -{ - nonesuch() = delete; - ~nonesuch() = delete; - nonesuch(nonesuch const&) = delete; - nonesuch(nonesuch const&&) = delete; - void operator=(nonesuch const&) = delete; - void operator=(nonesuch&&) = delete; -}; +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); -template class Op, - class... Args> -struct detector -{ - using value_t = std::false_type; - using type = Default; -}; +NLOHMANN_JSON_NAMESPACE_END -template class Op, class... Args> -struct detector>, Op, Args...> -{ - using value_t = std::true_type; - using type = Op; -}; +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT -template