Commit c4d5f65a authored by Henry Weller's avatar Henry Weller
Browse files

Completed update ...ErrorIn -> ...ErrorInFunction

Avoids the clutter and maintenance effort associated with providing the
function signature string.
parent dc43311e
......@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
dictionary dict;
IOWarningIn("main", dict) << "warning 3" << endl;
IOWarningInFunction(dict) << "warning 3" << endl;
FatalErrorInFunction << "error 1" << endl;
FatalErrorInFunction << "error 2" << exit(FatalError);
......
......@@ -28,12 +28,12 @@
#+END_SRC
so
#+BEGIN_SRC C++
WarningIn("className::functionName()")
WarningInFunction
<< "Warning message"
#+END_SRC
*not*
#+BEGIN_SRC C++
WarningIn("className::functionName()")
WarningInFunction
<< "Warning message"
#+END_SRC
......
......@@ -87,7 +87,7 @@ void Foam::CLASSNAME::operator=(const CLASSNAME& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("Foam::CLASSNAME::operator=(const Foam::CLASSNAME&)")
FatalErrorInFunction
<< "Attempted assignment to self"
<< abort(FatalError);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -103,11 +103,8 @@ void Foam::CLASSNAME<TemplateArgument>::operator=
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn
(
"Foam::CLASSNAME<TemplateArgument>::operator="
"(const Foam::CLASSNAME<TemplateArgument>&)"
) << "Attempted assignment to self"
FatalErrorInFunction
<< "Attempted assignment to self"
<< abort(FatalError);
}
}
......
......@@ -145,12 +145,8 @@ void Foam::ODESolver::solve
}
}
FatalErrorIn
(
"ODESolver::solve"
"(const scalar xStart, const scalar xEnd,"
"scalarField& y, scalar& dxTry) const"
) << "Integration steps greater than maximum " << maxSteps_
FatalErrorInFunction
<< "Integration steps greater than maximum " << maxSteps_
<< "xStart = " << xStart << ", xEnd = " << xEnd
<< ", x = " << x << ", dxDid = " << step.dxDid
<< exit(FatalError);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -41,11 +41,8 @@ Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"ODESolver::New"
"(const dictionary& dict, const ODESystem& odes)"
) << "Unknown ODESolver type "
FatalErrorInFunction
<< "Unknown ODESolver type "
<< ODESolverTypeName << nl << nl
<< "Valid ODESolvers are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
......
......@@ -145,7 +145,7 @@ void Foam::SIBS::solve
if (xNew_ == x)
{
FatalErrorIn("ODES::SIBS")
FatalErrorInFunction
<< "step size underflow"
<< exit(FatalError);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -74,7 +74,7 @@ void Foam::adaptiveSolver::solve
if (dx < VSMALL)
{
FatalErrorIn("adaptiveSolver::solve")
FatalErrorInFunction
<< "stepsize underflow"
<< exit(FatalError);
}
......
......@@ -252,7 +252,7 @@ void Foam::seulex::solve
if (mag(dx) <= mag(x)*sqr(SMALL))
{
WarningIn("seulex::solve(scalar& x, scalarField& y, stepState&")
WarningInFunction
<< "step size underflow :" << dx << endl;
}
......
......@@ -253,7 +253,7 @@ Foam::fileName Foam::cwd()
}
else
{
FatalErrorIn("Foam::cwd()")
FatalErrorInFunction
<< "Couldn't get the current working directory"
<< exit(FatalError);
......@@ -437,7 +437,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
{
case EPERM:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "The filesystem containing " << pathName
<< " does not support the creation of directories."
<< exit(FatalError);
......@@ -453,7 +453,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
case EFAULT:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "" << pathName
<< " points outside your accessible address space."
<< exit(FatalError);
......@@ -463,7 +463,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
case EACCES:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "The parent directory does not allow write "
"permission to the process,"<< nl
<< "or one of the directories in " << pathName
......@@ -475,7 +475,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
case ENAMETOOLONG:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "" << pathName << " is too long."
<< exit(FatalError);
......@@ -491,7 +491,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
}
else
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "Couldn't create directory " << pathName
<< exit(FatalError);
......@@ -501,7 +501,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
case ENOTDIR:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "A component used as a directory in " << pathName
<< " is not, in fact, a directory."
<< exit(FatalError);
......@@ -511,7 +511,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
case ENOMEM:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "Insufficient kernel memory was available to make "
"directory " << pathName << '.'
<< exit(FatalError);
......@@ -521,7 +521,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
case EROFS:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "" << pathName
<< " refers to a file on a read-only filesystem."
<< exit(FatalError);
......@@ -531,7 +531,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
case ELOOP:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "Too many symbolic links were encountered in resolving "
<< pathName << '.'
<< exit(FatalError);
......@@ -541,7 +541,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
case ENOSPC:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "The device containing " << pathName
<< " has no room for the new directory or "
<< "the user's disk quota is exhausted."
......@@ -552,7 +552,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
default:
{
FatalErrorIn("Foam::mkDir(const fileName&, mode_t)")
FatalErrorInFunction
<< "Couldn't create directory " << pathName
<< exit(FatalError);
......@@ -862,7 +862,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
if (exists(dst))
{
WarningIn("ln(const fileName&, const fileName&)")
WarningInFunction
<< "destination " << dst << " already exists. Not linking."
<< endl;
return false;
......@@ -870,7 +870,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
if (src.isAbsolute() && !exists(src))
{
WarningIn("ln(const fileName&, const fileName&)")
WarningInFunction
<< "source " << src << " does not exist." << endl;
return false;
}
......@@ -881,7 +881,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
}
else
{
WarningIn("ln(const fileName&, const fileName&)")
WarningInFunction
<< "symlink from " << src << " to " << dst << " failed." << endl;
return false;
}
......@@ -987,7 +987,7 @@ bool Foam::rmDir(const fileName& directory)
// Attempt to open directory and set the structure pointer
if ((source = ::opendir(directory.c_str())) == NULL)
{
WarningIn("rmDir(const fileName&)")
WarningInFunction
<< "cannot open directory " << directory << endl;
return false;
......@@ -1007,7 +1007,7 @@ bool Foam::rmDir(const fileName& directory)
{
if (!rmDir(path))
{
WarningIn("rmDir(const fileName&)")
WarningInFunction
<< "failed to remove directory " << fName
<< " while removing directory " << directory
<< endl;
......@@ -1021,7 +1021,7 @@ bool Foam::rmDir(const fileName& directory)
{
if (!rm(path))
{
WarningIn("rmDir(const fileName&)")
WarningInFunction
<< "failed to remove file " << fName
<< " while removing directory " << directory
<< endl;
......@@ -1037,7 +1037,7 @@ bool Foam::rmDir(const fileName& directory)
if (!rm(directory))
{
WarningIn("rmDir(const fileName&)")
WarningInFunction
<< "failed to remove directory " << directory << endl;
::closedir(source);
......@@ -1062,10 +1062,8 @@ void Foam::fdClose(const int fd)
{
if (close(fd) != 0)
{
FatalErrorIn
(
"fdClose(const int fd)"
) << "close error on " << fd << endl
FatalErrorInFunction
<< "close error on " << fd << endl
<< abort(FatalError);
}
}
......@@ -1085,10 +1083,8 @@ bool Foam::ping
if ((hostPtr = ::gethostbyname(destName.c_str())) == NULL)
{
FatalErrorIn
(
"Foam::ping(const string&, ...)"
) << "gethostbyname error " << h_errno << " for host " << destName
FatalErrorInFunction
<< "gethostbyname error " << h_errno << " for host " << destName
<< abort(FatalError);
}
......@@ -1099,10 +1095,8 @@ bool Foam::ping
sockfd = ::socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
{
FatalErrorIn
(
"Foam::ping(const string&, const label)"
) << "socket error"
FatalErrorInFunction
<< "socket error"
<< abort(FatalError);
}
......@@ -1176,7 +1170,7 @@ void* Foam::dlOpen(const fileName& lib, const bool check)
if (!handle && check)
{
WarningIn("dlOpen(const fileName&, const bool)")
WarningInFunction
<< "dlopen error : " << ::dlerror()
<< endl;
}
......@@ -1224,7 +1218,7 @@ void* Foam::dlSym(void* handle, const std::string& symbol)
if (error)
{
WarningIn("dlSym(void*, const std::string&)")
WarningInFunction
<< "Cannot lookup symbol " << symbol << " : " << error
<< endl;
}
......
......@@ -149,7 +149,7 @@ namespace Foam
if (!hasWarned)
{
hasWarned = true;
WarningIn("fileMonitorWatcher(const bool, const label)")
WarningInFunction
<< "Failed allocating an inotify descriptor : "
<< string(strerror(errno)) << endl
<< " Please increase the number of allowable "
......@@ -166,7 +166,7 @@ namespace Foam
}
}
#else
FatalErrorIn("fileMonitorWatcher(const bool, const label)")
FatalErrorInFunction
<< "You selected inotify but this file was compiled"
<< " without FOAM_USE_INOTIFY"
<< " Please select another fileModification test method"
......@@ -191,7 +191,7 @@ namespace Foam
{
if (inotify_rm_watch(inotifyFd_, int(dirWatches_[i])))
{
WarningIn("fileMonitor::~fileMonitor()")
WarningInFunction
<< "Failed deleting directory watch "
<< dirWatches_[i] << endl;
}
......@@ -229,7 +229,7 @@ namespace Foam
if (dirWatchID < 0)
{
FatalErrorIn("addWatch(const label, const fileName&)")
FatalErrorInFunction
<< "Failed adding watch " << watchFd
<< " to directory " << fName << " due to "
<< string(strerror(errno))
......@@ -240,7 +240,7 @@ namespace Foam
if (watchFd < dirWatches_.size() && dirWatches_[watchFd] != -1)
{
// Reuse of watchFd : should have dir watchID set to -1.
FatalErrorIn("addWatch(const label, const fileName&)")
FatalErrorInFunction
<< "Problem adding watch " << watchFd
<< " to file " << fName
<< abort(FatalError);
......@@ -255,7 +255,7 @@ namespace Foam
if (watchFd < lastMod_.size() && lastMod_[watchFd] != 0)
{
// Reuse of watchFd : should have lastMod set to 0.
FatalErrorIn("addWatch(const label, const fileName&)")
FatalErrorInFunction
<< "Problem adding watch " << watchFd
<< " to file " << fName
<< abort(FatalError);
......@@ -320,7 +320,7 @@ void Foam::fileMonitor::checkFiles() const
if (ready < 0)
{
FatalErrorIn("fileMonitor::checkFiles()")
FatalErrorInFunction
<< "Problem in issuing select."
<< abort(FatalError);
}
......@@ -336,7 +336,7 @@ void Foam::fileMonitor::checkFiles() const
if (nBytes < 0)
{
FatalErrorIn("fileMonitor::checkFiles()")
FatalErrorInFunction
<< "read of " << watcher_->inotifyFd_
<< " failed with " << label(nBytes)
<< abort(FatalError);
......@@ -473,7 +473,7 @@ Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
if (watchFd < 0)
{
WarningIn("fileMonitor::addWatch(const fileName&)")
WarningInFunction
<< "could not add watch for file " << fName << endl;
}
else
......@@ -593,11 +593,8 @@ void Foam::fileMonitor::updateStates
<< endl;
}
WarningIn
(
"fileMonitor::updateStates"
"(const bool, const bool) const"
) << "Delaying reading " << watchFile_[watchFd]
WarningInFunction
<< "Delaying reading " << watchFile_[watchFd]
<< " due to inconsistent "
"file time-stamps between processors" << endl;
}
......
......@@ -151,10 +151,8 @@ void Foam::regExp::set(const char* pattern, const bool ignoreCase) const
char errbuf[200];
regerror(err, preg_, errbuf, sizeof(errbuf));
FatalErrorIn
(
"regExp::set(const char*, const bool ignoreCase)"
) << "Failed to compile regular expression '" << pattern << "'"
FatalErrorInFunction
<< "Failed to compile regular expression '" << pattern << "'"
<< nl << errbuf
<< exit(FatalError);
}
......
......@@ -92,10 +92,8 @@ void Foam::sigFpe::sigHandler(int)
// Reset old handling
if (sigaction(SIGFPE, &oldAction_, NULL) < 0)
{
FatalErrorIn
(
"Foam::sigSegv::sigHandler()"
) << "Cannot reset SIGFPE trapping"
FatalErrorInFunction
<< "Cannot reset SIGFPE trapping"
<< abort(FatalError);
}
......@@ -128,10 +126,8 @@ Foam::sigFpe::~sigFpe()
// Reset signal
if (oldAction_.sa_handler && sigaction(SIGFPE, &oldAction_, NULL) < 0)
{
FatalErrorIn
(
"Foam::sigFpe::~sigFpe()"
) << "Cannot reset SIGFPE trapping"
FatalErrorInFunction
<< "Cannot reset SIGFPE trapping"
<< abort(FatalError);
}
#endif
......@@ -153,10 +149,8 @@ void Foam::sigFpe::set(const bool verbose)
{
if (oldAction_.sa_handler)
{
FatalErrorIn
(
"Foam::sigFpe::set()"
) << "Cannot call sigFpe::set() more than once"
FatalErrorInFunction
<< "Cannot call sigFpe::set() more than once"
<< abort(FatalError);
}
......@@ -180,10 +174,8 @@ void Foam::sigFpe::set(const bool verbose)
sigemptyset(&newAction.sa_mask);
if (sigaction(SIGFPE, &newAction, &oldAction_) < 0)
{
FatalErrorIn
(
"Foam::sigFpe::set()"
) << "Cannot set SIGFPE trapping"
FatalErrorInFunction
<< "Cannot set SIGFPE trapping"
<< abort(FatalError);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -40,10 +40,8 @@ void Foam::sigInt::sigHandler(int)
// Reset old handling
if (sigaction(SIGINT, &oldAction_, NULL) < 0)
{
FatalErrorIn
(
"Foam::sigInt::sigHandler()"
) << "Cannot reset SIGINT trapping"
FatalErrorInFunction
<< "Cannot reset SIGINT trapping"
<< abort(FatalError);
}
......@@ -70,10 +68,8 @@ Foam::sigInt::~sigInt()
// Reset old handling
if (sigaction(SIGINT, &oldAction_, NULL) < 0)
{
FatalErrorIn
(
"Foam::sigInt::~sigInt()"
) << "Cannot reset SIGINT trapping"
FatalErrorInFunction
<< "Cannot reset SIGINT trapping"
<< abort(FatalError);
}
}
......@@ -85,10 +81,8 @@ void Foam::sigInt::set(const bool)
{
if (oldAction_.sa_handler)
{
FatalErrorIn
(
"Foam::sigInt::set()"
) << "Cannot call sigInt::set() more than once"
FatalErrorInFunction
<< "Cannot call sigInt::set() more than once"
<< abort(FatalError);
}
......@@ -98,10 +92,8 @@ void Foam::sigInt::set(const bool)
sigemptyset(&newAction.sa_mask);
if (sigaction(SIGINT, &newAction, &oldAction_) < 0)
{
FatalErrorIn
(
"Foam::sigInt::set()"
) << "Cannot set SIGINT trapping"
FatalErrorInFunction
<< "Cannot set SIGINT trapping"
<< abort(FatalError);
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -40,10 +40,8 @@ void Foam::sigQuit::sigHandler(int)
// Reset old handling
if (sigaction(SIGQUIT, &oldAction_, NULL) < 0)
{
FatalErrorIn
(
"Foam::sigQuit::sigHandler()"
) << "Cannot reset SIGQUIT trapping"
FatalErrorInFunction
<< "Cannot reset SIGQUIT trapping"
<< abort(FatalError);
}
......@@ -72,10 +70,8 @@ Foam::sigQuit::~sigQuit()
// Reset old handling
if (oldAction_.sa_handler && sigaction(SIGQUIT, &oldAction_, NULL) < 0)
{
FatalErrorIn
(
"Foam::sigQuit::~sigQuit()"
) << "Cannot reset SIGQUIT trapping"
FatalErrorInFunction
<< "Cannot reset SIGQUIT trapping"
<< abort(FatalError);
}
}
......@@ -87,10 +83,8 @@ void Foam::sigQuit::set(const bool verbose)
{
if (oldAction_.sa_handler)
{
FatalErrorIn
(
"Foam::sigQuit::set()"
) << "Cannot call sigQuit::set() more than once"
FatalErrorInFunction
<< "Cannot call sigQuit::set() more than once"
<< abort(FatalError);
}
......@@ -100,10 +94,8 @@ void Foam::sigQuit::set(const bool verbose)
sigemptyset(&newAction.sa_mask);
if (sigaction(SIGQUIT, &newAction, &oldAction_) < 0)
{
FatalErrorIn
(
"Foam::sigQuit::set()"
) << "Cannot set SIGQUIT trapping"
FatalErrorInFunction
<< "Cannot set SIGQUIT trapping"
<< abort(FatalError);
}
}
......