ENH: use foamVersion::api instead of OPENFOAM compiler define

- This improves consistency for warnAboutAge and build information
  when the API level changes
This commit is contained in:
Mark Olesen
2019-08-20 14:32:17 +02:00
committed by Andrew Heather
parent c8df98cc2a
commit c8ab912823
3 changed files with 7 additions and 8 deletions

View File

@ -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.
}

View File

@ -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);

View File

@ -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())