Skip to content
Snippets Groups Projects
Commit a0a2c3ff authored by Blake Nelson's avatar Blake Nelson
Browse files

Fixed compiler warnings.

git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@1052 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent 3d925e17
No related branches found
No related tags found
No related merge requests found
///////////////////////////////////////////////////////////////////////////////
//
// File ErrorUtil.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// 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.
//
// Description: error related utilities
//
///////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
namespace ErrorUtil
{
#ifdef ENABLE_NEKTAR_EXCEPTIONS
void Error(ErrType type, const char *routine, int lineNumber, const char *msg, unsigned int level)
{
std::string errorMessage = std::string(routine) + "[" +
boost::lexical_cast<std::string>(lineNumber) + "]:" +
std::string(msg);
//std::cerr << errorMessage << std::endl;
throw NekError(errorMessage);
}
#else // ENABLE_NEKTAR_EXCEPTION
void Error(ErrType type, const char *routine, int lineNumber, const char *msg, unsigned int level)
{
switch(type)
{
case efatal:
std::cerr << "Fatal: Level " << level << " assertion violation\n" << routine << "[" << lineNumber << "]:" << msg << std::endl;
exit(1);
break;
case ewarning:
std::cerr << "Warning: Level " << level << " assertion violation\n" << routine << ": " << msg << std::endl;
break;
default:
std::cerr << "Unknown warning type" << std::endl;
}
}
#endif // ENABLE_NEKTAR_EXCEPTION
void Error(ErrType type, const char *routine, int lineNumber, const std::string& msg, unsigned int level)
{
Error(type, routine, lineNumber, msg.c_str(), level);
}
void Error(ErrType type, const char *routine, int lineNumber, const char *msg)
{
Error(type, routine, lineNumber, msg, 0);
}
}
\ No newline at end of file
......@@ -54,44 +54,10 @@ namespace ErrorUtil
NekError(const std::string& message) : std::runtime_error(message) {}
};
#ifdef ENABLE_NEKTAR_EXCEPTIONS
static void Error(ErrType type, const char *routine, int lineNumber, const char *msg, unsigned int level)
{
std::string errorMessage = std::string(routine) + "[" +
boost::lexical_cast<std::string>(lineNumber) + "]:" +
std::string(msg);
//std::cerr << errorMessage << std::endl;
throw NekError(errorMessage);
}
#else // ENABLE_NEKTAR_EXCEPTION
static void Error(ErrType type, const char *routine, int lineNumber, const char *msg, unsigned int level)
{
switch(type)
{
case efatal:
std::cerr << "Fatal: Level " << level << " assertion violation\n" << routine << "[" << lineNumber << "]:" << msg << std::endl;
exit(1);
break;
case ewarning:
std::cerr << "Warning: Level " << level << " assertion violation\n" << routine << ": " << msg << std::endl;
break;
default:
std::cerr << "Unknown warning type" << std::endl;
}
}
static void Error(ErrType type, const char *routine, int lineNumber, const char *msg)
{
Error(type, routine, lineNumber, msg, 0);
}
#endif // ENABLE_NEKTAR_EXCEPTION
void Error(ErrType type, const char *routine, int lineNumber, const char *msg, unsigned int level);
void Error(ErrType type, const char *routine, int lineNumber, const std::string& msg, unsigned int level);
void Error(ErrType type, const char *routine, int lineNumber, const char *msg);
// This method is necessary for ASSERTLX when the message is passed in as a std::string object.
static void Error(ErrType type, const char *routine, int lineNumber, const std::string& msg, unsigned int level)
{
Error(type, routine, lineNumber, msg.c_str(), level);
}
} // end of namespace
......@@ -146,6 +112,9 @@ namespace ErrorUtil
/***
$Log: ErrorUtil.hpp,v $
Revision 1.8 2007/07/10 22:22:19 jfrazier
Added an additional indicator of the error severity (fatal or warning).
Revision 1.7 2007/06/10 23:36:59 bnelson
A previous change to ErrorUtil::Error added an additional level parameter, breaking code which called it directly outside of ErrorUtil. A new method without this parameter was added.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment