Commit 4e1bc2d2 authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: incorrect placement of compiler attributes

parent d7969b1b
Test-NamedEnum.C
EXE = $(FOAM_USER_APPBIN)/Test-NamedEnum
/* EXE_INC = */
/* EXE_LIBS = */
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Testing of NamedEnum.
The class is deprecated, but we may still need to support it for things
like swak4Foam etc.
\*---------------------------------------------------------------------------*/
#include "NamedEnum.H"
#include "FlatOutput.H"
// Expect compile-time warnings
using namespace Foam;
struct testing
{
enum class option { A, B, C, D };
static const Foam::NamedEnum<option, 4> option1Names;
};
// All names - we have no choice with NamedEnum
template<>
const char* Foam::NamedEnum<testing::option, 4>::names[] =
{
"a",
"b",
"c",
"d"
};
const Foam::NamedEnum<testing::option, 4> testing::option1Names;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
Info<< "Enum 1" << nl
<< " names: " << testing::option1Names << nl
<< " values: " << flatOutput(testing::option1Names.values())
<< nl << nl;
Info<< nl
<< int(testing::option1Names["a"]) << nl
<< testing::option1Names[testing::option::A] << nl;
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //
......@@ -243,7 +243,8 @@ public:
//- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method
bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
FOAM_DEPRECATED_FOR(2019-01, "good() method")
bool found() const
{
return this->good();
}
......@@ -296,7 +297,8 @@ public:
//- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method
bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
FOAM_DEPRECATED_FOR(2019-01, "good() method")
bool found() const
{
return this->good();
}
......
......@@ -219,7 +219,8 @@ public:
//- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method
bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
FOAM_DEPRECATED_FOR(2019-01, "good() method")
bool found() const
{
return this->good();
}
......@@ -271,7 +272,8 @@ public:
//- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method
bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
FOAM_DEPRECATED_FOR(2019-01, "good() method")
bool found() const
{
return this->good();
}
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -401,7 +401,8 @@ List<OutputIntListType> invertManyToMany
// \return The index found or return -1 if not found.
// \deprecated(2017-10) - use the UList find/found methods
template<class ListType>
label FOAM_DEPRECATED(2017-10) findIndex
FOAM_DEPRECATED_FOR(2017-10, "UList find/found methods")
label findIndex
(
const ListType& input,
typename ListType::const_reference val,
......
......@@ -1288,8 +1288,8 @@ public:
//- Deprecated(2018-07) find and return an entry data stream
//
// \deprecated(2018-07) - use lookup() method
ITstream& FOAM_DEPRECATED_FOR(2018-07, "lookup() method")
operator[](const word& keyword) const
FOAM_DEPRECATED_FOR(2018-07, "lookup() method")
ITstream& operator[](const word& keyword) const
{
return lookup(keyword);
}
......@@ -1297,8 +1297,8 @@ public:
//- Deprecated(2018-10) find and return a T.
// \deprecated(2018-10) - use get() method
template<class T>
T FOAM_DEPRECATED_FOR(2018-10, "get() method")
lookupType
FOAM_DEPRECATED_FOR(2018-10, "get() method")
T lookupType
(
const word& keyword,
bool recursive = false,
......@@ -1310,8 +1310,8 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
bool FOAM_DEPRECATED_FOR(2018-10, "found(keyType::option)")
found
FOAM_DEPRECATED_FOR(2018-10, "found(keyType::option)")
bool found
(
const word& keyword,
bool recursive,
......@@ -1323,9 +1323,8 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
entry*
FOAM_DEPRECATED_FOR(2018-10, "findEntry(keyType::option)")
lookupEntryPtr
entry* lookupEntryPtr
(
const word& keyword,
bool recursive,
......@@ -1337,9 +1336,8 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
const entry*
FOAM_DEPRECATED_FOR(2018-10, "findEntry(keyType::option)")
lookupEntryPtr
const entry* lookupEntryPtr
(
const word& keyword,
bool recursive,
......@@ -1351,9 +1349,8 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
const entry*
FOAM_DEPRECATED_FOR(2018-10, "findScoped(keyType::option)")
lookupScopedEntryPtr
const entry* lookupScopedEntryPtr
(
const word& keyword,
bool recursive,
......@@ -1369,9 +1366,8 @@ public:
//
// Search type: non-recursive with patterns.
// \deprecated(2018-10) - use findDict() method
const dictionary*
FOAM_DEPRECATED_FOR(2018-10, "findDict() method")
subDictPtr(const word& keyword) const
const dictionary* subDictPtr(const word& keyword) const
{
return findDict(keyword, keyType::REGEX);
}
......@@ -1382,18 +1378,16 @@ public:
//
// Search type: non-recursive with patterns.
// \deprecated(2018-10) - use findDict() method
dictionary*
FOAM_DEPRECATED_FOR(2018-10, "findDict() method")
subDictPtr(const word& keyword)
dictionary* subDictPtr(const word& keyword)
{
return findDict(keyword, keyType::REGEX);
}
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
const entry&
FOAM_DEPRECATED_FOR(2018-10, "lookupEntry(keyType::option)")
lookupEntry
const entry& lookupEntry
(
const word& keyword,
bool recursive,
......@@ -1405,9 +1399,8 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
ITstream&
FOAM_DEPRECATED_FOR(2018-10, "lookup(keyType::option)")
lookup
ITstream& lookup
(
const word& keyword,
bool recursive,
......@@ -1420,8 +1413,8 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
template<class T>
T FOAM_DEPRECATED_FOR(2018-10, "lookupOrDefault(keyType::option)")
lookupOrDefault
FOAM_DEPRECATED_FOR(2018-10, "lookupOrDefault(keyType::option)")
T lookupOrDefault
(
const word& keyword,
const T& deflt,
......@@ -1437,8 +1430,8 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
template<class T>
T FOAM_DEPRECATED_FOR(2018-10, "lookupOrAddDefault(keyType::option)")
lookupOrAddDefault
FOAM_DEPRECATED_FOR(2018-10, "lookupOrAddDefault(keyType::option)")
T lookupOrAddDefault
(
const word& keyword,
const T& deflt,
......@@ -1454,9 +1447,8 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version
template<class T>
bool
FOAM_DEPRECATED_FOR(2018-10, "readIfPresent(keyType::option)")
readIfPresent
bool readIfPresent
(
const word& keyword,
T& val,
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -371,16 +371,16 @@ public:
// \deprecated(2018-11) - should generally use construct from
// dictionary or primitiveEntry instead
// (additional checks on the input stream).
explicit dimensioned(Istream& is)
FOAM_DEPRECATED(2018-11);
FOAM_DEPRECATED(2018-11)
explicit dimensioned(Istream& is);
//- Deprecated(2018-11) Construct from Istream with given name
//- (expects dimensions, value)
// \deprecated(2018-11) - should generally use construct from
// dictionary or primitiveEntry instead
// (additional checks on the input stream).
dimensioned(const word& name, Istream& is)
FOAM_DEPRECATED(2018-11);
FOAM_DEPRECATED(2018-11)
dimensioned(const word& name, Istream& is);
//- Deprecated(2018-11) Construct from Istream with given name
//- and expected dimensions.
......@@ -390,8 +390,8 @@ public:
// \deprecated(2018-11) - should generally use construct from
// dictionary or primitiveEntry instead
// (additional checks on the input stream).
dimensioned(const word& name, const dimensionSet& dims, Istream& is)
FOAM_DEPRECATED(2018-11);
FOAM_DEPRECATED(2018-11)
dimensioned(const word& name, const dimensionSet& dims, Istream& is);
//- Construct dimensioned from dictionary, with default value.
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -698,11 +698,12 @@ public:
//- Deprecated(2019-01) identical to clip()
// \deprecated(2019-01) identical to clip()
FOAM_DEPRECATED_FOR(2019-01, "clip() method")
void maxMin
(
const dimensioned<Type>& minVal,
const dimensioned<Type>& maxVal
) FOAM_DEPRECATED_FOR(2019-01, "clip() method");
);
// Member Operators
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -628,8 +628,8 @@ public:
// Index 1 is the first (non-option) argument.
// \deprecated(2018-08) - use get() method
template<class T>
T FOAM_DEPRECATED_FOR(2018-08, "get() method")
read(const label index) const
FOAM_DEPRECATED_FOR(2018-08, "get() method")
T read(const label index) const
{
return this->get<T>(index);
}
......@@ -638,24 +638,24 @@ public:
// Index 1 is the first (non-option) argument.
// \deprecated(2018-01) - use get() method
template<class T>
T FOAM_DEPRECATED_FOR(2018-01, "get() method")
argRead(const label index) const
FOAM_DEPRECATED_FOR(2018-01, "get() method")
T argRead(const label index) const
{
return this->get<T>(index);
}
//- Deprecated(2018-01) return true if the named option is found
// \deprecated(2018-01) - use found() method
bool FOAM_DEPRECATED_FOR(2018-01, "found() method")
optionFound(const word& optName) const
FOAM_DEPRECATED_FOR(2018-01, "found() method")
bool optionFound(const word& optName) const
{
return found(optName);
}
//- Deprecated(2018-01) return an input stream from the named option
// \deprecated(2018-01) - use lookup() method
ITstream FOAM_DEPRECATED_FOR(2018-01, "lookup() method")
optionLookup(const word& optName) const
FOAM_DEPRECATED_FOR(2018-01, "lookup() method")
ITstream optionLookup(const word& optName) const
{
return lookup(optName);
}
......@@ -663,8 +663,8 @@ public:
//- Deprecated(2018-01) read a value from the named option
// \deprecated(2018-01) - use get() method
template<class T>
T FOAM_DEPRECATED_FOR(2018-01, "get() method")
optionRead(const word& optName) const
FOAM_DEPRECATED_FOR(2018-01, "get() method")
T optionRead(const word& optName) const
{
return get<T>(optName);
}
......@@ -673,8 +673,8 @@ public:
// Return true if the named option was found.
// \deprecated(2018-01) - use readIfPresent() method
template<class T>
bool FOAM_DEPRECATED_FOR(2018-01, "readIfPresent() method")
optionReadIfPresent
FOAM_DEPRECATED_FOR(2018-01, "readIfPresent() method")
bool optionReadIfPresent
(
const word& optName,
T& val
......@@ -688,8 +688,8 @@ public:
// use the supplied default and return false.
// \deprecated(2018-01) - use readIfPresent() method
template<class T>
bool FOAM_DEPRECATED_FOR(2018-01, "readIfPresent() method")
optionReadIfPresent
FOAM_DEPRECATED_FOR(2018-01, "readIfPresent() method")
bool optionReadIfPresent
(
const word& optName,
T& val,
......@@ -703,8 +703,8 @@ public:
// Return supplied default otherwise.
// \deprecated(2018-01) - use getOrDefault() method
template<class T>
T FOAM_DEPRECATED_FOR(2018-01, "getOrDefault() method")
optionLookupOrDefault
FOAM_DEPRECATED_FOR(2018-01, "getOrDefault() method")
T optionLookupOrDefault
(
const word& optName,
const T& deflt
......@@ -716,8 +716,8 @@ public:
//- Deprecated(2018-01) read a List of values from the named option
// \deprecated(2018-01) - use getList() method
template<class T>
List<T> FOAM_DEPRECATED_FOR(2018-01, "getList() method")
optionReadList(const word& optName) const
FOAM_DEPRECATED_FOR(2018-01, "getList() method")
List<T> optionReadList(const word& optName) const
{
return this->getList<T>(optName);
}
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -54,7 +54,7 @@ SeeAlso
// Compile-time warning for use of deprecated methods (compiler-dependent).
// Use within the class declaration.
#if defined(__cplusplus) && (__cplusplus >= 201402L)
#if (__cplusplus >= 201402L)
# define FOAM_DEPRECATED(since) [[deprecated("Since " #since)]]
# define FOAM_DEPRECATED_FOR(since, replacement) [[deprecated("Since " #since "; use " #replacement)]]
#elif defined(__GNUC__)
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -505,22 +505,24 @@ public:
//- Deprecated(2019-04) raw data pointer, const access
// \deprecated(2019-04) - use cdata() method
const Type* FOAM_DEPRECATED_FOR(2019-04, "cdata() method") v() const
FOAM_DEPRECATED_FOR(2019-04, "cdata() method")
const Type* v() const
{
return v_;
}
//- Deprecated(2019-04) raw data pointer, non-const access
// \deprecated(2019-04) - use data() method
Type* FOAM_DEPRECATED_FOR(2019-04, "data() method") v()
FOAM_DEPRECATED_FOR(2019-04, "data() method")
Type* v()
{
return v_;
}
//- Deprecated(2019-04) - use subMatrix()
// \deprecated(2019-04) - use subMatrix()
ConstMatrixBlock<mType>
FOAM_DEPRECATED_FOR(2019-04, "subMatrix() method") block
FOAM_DEPRECATED_FOR(2019-04, "subMatrix() method")
ConstMatrixBlock<mType> block
(
const label m,
const label n,
......@@ -533,8 +535,8 @@ public:
//- Deprecated(2019-04) - use subMatrix()
// \deprecated(2019-04) - use subMatrix()
MatrixBlock<mType>
FOAM_DEPRECATED_FOR(2019-04, "subMatrix() method") block
FOAM_DEPRECATED_FOR(2019-04, "subMatrix() method")
MatrixBlock<mType> block
(
const label m,
const label n,
......@@ -548,8 +550,8 @@ public:
//- Deprecated(2019-04) - use subColumn()
// \deprecated(2019-04) - use subColumn()
ConstMatrixBlock<mType>
FOAM_DEPRECATED_FOR(2019-04, "subColumn() method") col
FOAM_DEPRECATED_FOR(2019-04, "subColumn() method")
ConstMatrixBlock<mType> col
(
const label m,
const label mStart,
......@@ -561,8 +563,8 @@ public:
//- Deprecated(2019-04) - use subColumn()
// \deprecated(2019-04) - use subColumn()
MatrixBlock<mType>
FOAM_DEPRECATED_FOR(2019-04, "subColumn() method") col
FOAM_DEPRECATED_FOR(2019-04, "subColumn() method")
MatrixBlock<mType> col
(
const label m,
const label mStart,
......
......@@ -191,17 +191,18 @@ public:
//- Deprecated(2020-01) Construct from components
// \deprecated(2020-01) - order inconsistent with other identifiers
FOAM_DEPRECATED(2020-01)
geometricSurfacePatch
(
const word& geometricType,
const word& name,
const label index
) FOAM_DEPRECATED(2020-01);
);
//- Deprecated(2020-01) Write dictionary
// \deprecated(2020-01) - Write dictionary
void FOAM_DEPRECATED_FOR(2020-01, "write() or operator<<")
writeDict(Ostream& os) const
FOAM_DEPRECATED_FOR(2020-01, "write() or operator<<")
void writeDict(Ostream& os) const
{
write(os);
}
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -203,8 +203,8 @@ public:
//- Legacy name for areaNormal()
// \deprecated(2018-06) Deprecated for new use
vector FOAM_DEPRECATED_FOR(2018-12, "areaNormal() or unitNormal()")
normal(const UList<point>& p) const
FOAM_DEPRECATED_FOR(2018-12, "areaNormal() or unitNormal()")
vector normal(const UList<point>& p) const
{
return areaNormal(p); // Legacy definition
}
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -134,8 +134,8 @@ public:
//- Legacy name for areaNormal()
// \deprecated(2018-06) Deprecated for new use
vector FOAM_DEPRECATED_FOR(2018-12, "areaNormal() or unitNormal()")
normal(const UList<point>& points) const
FOAM_DEPRECATED_FOR(2018-12, "areaNormal() or unitNormal()")
vector normal(const UList<point>& points) const
{
return areaNormal(points); // Legacy definition
}
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------