Fix compiler warnings.

Switch of compiler warnings for part of the code.
The compiler flag -Weffc++ of the gcc compiler creates many warnings about non virtual destructor of base classes where the
base class is actually a class from boost or from stl. Switch of the compiler flag for the problematic parts of the code
using preprocessor statements. There are also such preprocessor guards for code which creates many warnings when
using clang.

Filter warnings comming from generated files.
When using CTest all warnings comming from generated code (Root Dictionaries, code generated by protoc) will be filtered
before sending the results to the CDash web server.

Remove unused variables or use them.
Initialize all data members in initializer lists.
Use in initializer list the same order of data members as defined in the class declaration.
Declare private copy constructors and assignment operators where needed.

Fix format problems in printf statements.
Correctly cast the variables.
This commit is contained in:
Florian Uhlig 2016-03-17 13:19:49 +01:00
parent fa7040fe65
commit 4ca66e33da
5 changed files with 26 additions and 1 deletions

View File

@ -19,7 +19,7 @@ class FairMQParts
{ {
public: public:
/// Default constructor /// Default constructor
FairMQParts() {}; FairMQParts() : fParts() {};
/// Copy Constructor /// Copy Constructor
FairMQParts(const FairMQParts&) = delete; FairMQParts(const FairMQParts&) = delete;
/// Assignment operator /// Assignment operator

View File

@ -64,6 +64,7 @@ _Pragma("clang diagnostic ignored \"-Wnon-virtual-dtor\"")
#elif defined(__GNUC__) || defined(__GNUG__) #elif defined(__GNUC__) || defined(__GNUG__)
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Wnon-virtual-dtor\"") _Pragma("GCC diagnostic ignored \"-Wnon-virtual-dtor\"")
_Pragma("GCC diagnostic ignored \"-Weffc++\"")
#endif #endif
// defining the boost MSM state machine // defining the boost MSM state machine

View File

@ -14,6 +14,7 @@
#ifndef LOGGER_H #ifndef LOGGER_H
#define LOGGER_H #define LOGGER_H
#define BOOST_LOG_DYN_LINK 1 // necessary when linking the boost_log library dynamically #define BOOST_LOG_DYN_LINK 1 // necessary when linking the boost_log library dynamically
#define FUSION_MAX_VECTOR_SIZE 20 #define FUSION_MAX_VECTOR_SIZE 20
@ -81,12 +82,21 @@ void set_global_log_level( log_op::operation op=log_op::GREATER_EQ_THAN,
custom_severity_level threshold=SEVERITY_THRESHOLD ); custom_severity_level threshold=SEVERITY_THRESHOLD );
void set_global_log_level_operation( log_op::operation op=log_op::GREATER_EQ_THAN, void set_global_log_level_operation( log_op::operation op=log_op::GREATER_EQ_THAN,
custom_severity_level threshold=SEVERITY_THRESHOLD ); custom_severity_level threshold=SEVERITY_THRESHOLD );
#if defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
// register a global logger (declaration) // register a global logger (declaration)
BOOST_LOG_GLOBAL_LOGGER(global_logger, boost::log::sources::severity_logger_mt<custom_severity_level>) BOOST_LOG_GLOBAL_LOGGER(global_logger, boost::log::sources::severity_logger_mt<custom_severity_level>)
BOOST_LOG_ATTRIBUTE_KEYWORD(fairmq_logger_timestamp, "TimeStamp", boost::posix_time::ptime) BOOST_LOG_ATTRIBUTE_KEYWORD(fairmq_logger_timestamp, "TimeStamp", boost::posix_time::ptime)
BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", custom_severity_level) BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", custom_severity_level)
#if defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
template<typename T> template<typename T>
void init_log_formatter(const boost::log::record_view &view, boost::log::formatting_ostream &os) void init_log_formatter(const boost::log::record_view &view, boost::log::formatting_ostream &os)

View File

@ -89,6 +89,10 @@ namespace fairmq
return valueStr; return valueStr;
} }
#if defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
//_____________________________________________________________________________________________________________________________ //_____________________________________________________________________________________________________________________________
// policy to convert boost variable value into string // policy to convert boost variable value into string
struct ToString struct ToString
@ -231,6 +235,9 @@ namespace fairmq
}; };
#if defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
}; };

View File

@ -65,6 +65,10 @@ int getHostIPs(map<string, string>& addressMap)
return 0; return 0;
} }
#if defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
// below are SFINAE template functions to check for function member signatures of class // below are SFINAE template functions to check for function member signatures of class
namespace details namespace details
{ {
@ -111,6 +115,9 @@ struct has_BindGetCurrentIndex
} // end namespace details } // end namespace details
#if defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
// Alias template of the above structs // Alias template of the above structs
template<class T, class Sig> template<class T, class Sig>