/*
** implementation of SourceLocation
+ *
+ * Failed to really make this no-throw. Even in this form, class attributes File and FunctionName need to have
+ * some value which takes up memory space, so PCLINT rightly complains that exception '...' thrown from string
+ * construction is not on throw-list.
+ *
+ * To really guarantee a no-throw constructor, would have to only have pointers that can be set to NULL if
+ * something fails.
*/
SourceLocation::SourceLocation() throw ()
-: Line ( 0 )
{
+ try
+ {
+ File = "";
+ Line = 0;
+ FunctionName = "";
+ LocationTag = "";
+ }
+ catch(...)
+ {
+ ; // do nothing
+ }
} // eo SourceLocation::SourceLocation()
SourceLocation::SourceLocation (
const std::string& file,
- long line,
+ const long& line,
const std::string& funcname
) throw ()
-: File( file )
-, Line( line )
-, FunctionName( funcname )
{
+ try
+ {
+ File = file;
+ Line = line;
+ FunctionName = funcname;
+ LocationTag = "";
+ }
+ catch(...)
+ {
+ ; // do nothing
+ }
} // eo SourceLocation::SourceLocation(const std::string&,long,const std::string&)
SourceLocation(
const std::string& file,
- long line,
+ const long& line,
const std::string& funcname) throw ();
- operator bool() const throw ()
+ operator bool() const
{
return Line>0 and not File.empty() and not FunctionName.empty();
} // eo operator bool
- std::string get_function_name() const throw () { return FunctionName; }
- std::string get_filename() const throw () { return File; }
- long get_line_number() const throw () { return Line; }
+ std::string get_function_name() const { return FunctionName; }
+ std::string get_filename() const { return File; }
+ long get_line_number() const { return Line; }
std::string get_location_tag() const;
* basically: emits a ENTER message on construction and a LEAVE message on destruction.
* And indent these messages acoording to the nesting depth.
*
- * If something goes wrong nothing is thrown from constructor/destructor. Will try to
- * log only that some problem occurred.
+ * Tried to avoid any throw from constructor/destructor but failed
*/
class ScopeTracker
{
/**
* @brief constructs a scope tracker.
+ *
+ * Would have like to make this guaranteed no-throw, but failed.
*/
#define SCOPETRACKER() ::I2n::Tracer::ScopeTracker __scope_tracker(HERE)