From c8ab91282399e8475f415aad3c9be9eff3f67aec Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 20 Aug 2019 14:32:17 +0200 Subject: [PATCH] ENH: use foamVersion::api instead of OPENFOAM compiler define - This improves consistency for warnAboutAge and build information when the API level changes --- src/OpenFOAM/db/error/error.C | 7 ++++--- src/OpenFOAM/db/error/error.H | 2 +- src/OpenFOAM/global/version/foamVersion.C | 6 ++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/OpenFOAM/db/error/error.C b/src/OpenFOAM/db/error/error.C index 6c24ba4d88..a121cb6e92 100644 --- a/src/OpenFOAM/db/error/error.C +++ b/src/OpenFOAM/db/error/error.C @@ -31,6 +31,7 @@ License #include "dictionary.H" #include "JobInfo.H" #include "Pstream.H" +#include "foamVersion.H" #include "OSspecific.H" // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // @@ -49,12 +50,12 @@ void Foam::error::warnAboutAge(const char* what, const int version) << " This " << what << " is considered to be VERY old!\n" << std::endl; } - else if (version < OPENFOAM) + else if (version < foamVersion::api) { const int months = ( // YYMM -> months - (12 * (OPENFOAM/100) + (OPENFOAM % 100)) + (12 * (foamVersion::api/100) + (foamVersion::api % 100)) - (12 * (version/100) + (version % 100)) ); @@ -63,7 +64,7 @@ void Foam::error::warnAboutAge(const char* what, const int version) << " months old.\n" << std::endl; } - // No warning for (OPENFOAM < version). + // No warning for (foamVersion::api < version). // We use this to denote future expiry dates of transition features. } diff --git a/src/OpenFOAM/db/error/error.H b/src/OpenFOAM/db/error/error.H index 8dc2e6cff2..ef521eefbd 100644 --- a/src/OpenFOAM/db/error/error.H +++ b/src/OpenFOAM/db/error/error.H @@ -103,7 +103,7 @@ public: // \param what description for the warning // \param version is the old version (YYMM) for determining the // age in months compared to the current OpenFOAM version - // as conveyed by the \c OPENFOAM compiler define. + // as conveyed by the \c foamVersion::api value. static void warnAboutAge(const char* what, const int version); diff --git a/src/OpenFOAM/global/version/foamVersion.C b/src/OpenFOAM/global/version/foamVersion.C index 4b71a18fc3..0a11350559 100644 --- a/src/OpenFOAM/global/version/foamVersion.C +++ b/src/OpenFOAM/global/version/foamVersion.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,10 +43,8 @@ bool Foam::foamVersion::patched() void Foam::foamVersion::printBuildInfo(const bool full) { - // Can use #if OPENFOAM directly - Info<< "Using: OpenFOAM-" << foamVersion::version.c_str() - << " (" << OPENFOAM << ") (see www.OpenFOAM.com)" << nl + << " (" << foamVersion::api << ") (see www.OpenFOAM.com)\n" << "Build: " << foamVersion::build.c_str(); if (foamVersion::patched())