From: Viktor Uzlov Date: Fri, 14 Aug 2020 08:27:40 +0000 (+0300) Subject: fix warning "unused variable", "pointer truncation", "unreferenced formal parametr... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f1c1865a37bf26502884524a88d5a8b29ded1c5d;p=modules%2Fkernel.git fix warning "unused variable", "pointer truncation", "unreferenced formal parametr". include "Basics_Utils.hxx for macros SALOME_UNUSED(var)" --- diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 18e6494c2..d31c8c3c3 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -877,6 +877,7 @@ Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Boolean isPublished, CORBA::Boolean isMultiFile, CORBA::Boolean& isValidScript) { + SALOME_UNUSED(isPublished); const char* aScript = isMultiFile ? "def RebuildData(): pass" : ""; char* aBuffer = new char[strlen(aScript)+1]; strcpy(aBuffer, aScript); @@ -1043,6 +1044,7 @@ Engines_Component_i::configureSalome_file(std::string service_name, std::string file_port_name, Salome_file_i * file) { + SALOME_UNUSED(file); // By default this method does nothing } diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 1f25c1bfc..12369b96e 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -1219,6 +1219,7 @@ Engines::EngineComponent_ptr Engines_Container_i::load_impl( const char* genericRegisterName, const char* componentName ) { + SALOME_UNUSED(componentName); char* reason; std::string impl_name = std::string(LIB) + genericRegisterName + ENGINESO; Engines::EngineComponent_var iobject = Engines::EngineComponent::_nil() ; diff --git a/src/Container/Container_init_python.cxx b/src/Container/Container_init_python.cxx index 2f7671096..6e8a913e1 100644 --- a/src/Container/Container_init_python.cxx +++ b/src/Container/Container_init_python.cxx @@ -29,6 +29,7 @@ #include "utilities.h" #include "Container_init_python.hxx" +#include "Basics_Utils.hxx" #if PY_VERSION_HEX < 0x03050000 static char* @@ -75,6 +76,7 @@ ContainerPyStdOut_write(ContainerPyStdOut *self, PyObject *args) static PyObject* ContainerPyStdOut_flush(ContainerPyStdOut *self) { + SALOME_UNUSED(self); Py_INCREF(Py_None); return Py_None; } diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 665ec14c8..c2e1fdf20 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -31,6 +31,7 @@ #include +#include "Basics_Utils.hxx" #include "SALOME_Container.hxx" #include @@ -116,7 +117,7 @@ public: // Object information virtual bool hasObjectInfo() { return false; } - virtual char* getObjectInfo(const char* entry) { return CORBA::string_dup(""); } + virtual char* getObjectInfo(const char* entry) { SALOME_UNUSED(entry); return CORBA::string_dup(""); } // Version information virtual char* getVersion(); diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 1b7467784..68de29edc 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -2013,6 +2013,7 @@ Engines::Container_ptr SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters& params, std::string resource_selected) { + SALOME_UNUSED(params); Engines::Container_ptr ret = Engines::Container::_nil(); INFOS("[StarPaCOPPContainer] is disabled !"); INFOS("[StarPaCOPPContainer] recompile SALOME Kernel to enable PaCO++ parallel extension"); @@ -2024,6 +2025,8 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::C std::string machine_file_name, std::string & proxy_hostname) { + SALOME_UNUSED(params); + SALOME_UNUSED(proxy_hostname); return ""; } @@ -2033,6 +2036,10 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co SALOME_ContainerManager::actual_launch_machine_t & vect_machine, const std::string & proxy_hostname) { + SALOME_UNUSED(params); + SALOME_UNUSED(machine_file_name); + SALOME_UNUSED(vect_machine); + SALOME_UNUSED(proxy_hostname); return ""; } void @@ -2043,6 +2050,12 @@ SALOME_ContainerManager::LogConfiguration(const std::string & log_type, std::string & begin, std::string & end) { + SALOME_UNUSED(log_type); + SALOME_UNUSED(exe_type); + SALOME_UNUSED(container_name); + SALOME_UNUSED(hostname); + SALOME_UNUSED(begin); + SALOME_UNUSED(end); } CORBA::Object_ptr @@ -2050,6 +2063,9 @@ SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, const Engines::ContainerParameters& params, const std::string& hostname) { + SALOME_UNUSED(command); + SALOME_UNUSED(params); + SALOME_UNUSED(hostname); CORBA::Object_ptr ret = CORBA::Object::_nil(); return ret; } @@ -2060,6 +2076,10 @@ SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command, const std::string& name, SALOME_ContainerManager::actual_launch_machine_t & vect_machine) { + SALOME_UNUSED(command); + SALOME_UNUSED(params); + SALOME_UNUSED(name); + SALOME_UNUSED(vect_machine); return false; } #endif diff --git a/src/Container/Salome_file_i.cxx b/src/Container/Salome_file_i.cxx index dc4026224..9e70202aa 100644 --- a/src/Container/Salome_file_i.cxx +++ b/src/Container/Salome_file_i.cxx @@ -23,6 +23,7 @@ // $Header: // #include "Salome_file_i.hxx" +#include "Basics_Utils.hxx" #include "utilities.h" #include #include "HDFOI.hxx" @@ -885,6 +886,7 @@ Salome_file_i::getDistributedFile(std::string file_name) void Salome_file_i::removeFile(const char* file_name) { + SALOME_UNUSED(file_name); MESSAGE("Salome_file_i::removeFile : NOT YET IMPLEMENTED"); } diff --git a/src/DF/DF_Application.cxx b/src/DF/DF_Application.cxx index 3fb265b5a..60f3066a5 100644 --- a/src/DF/DF_Application.cxx +++ b/src/DF/DF_Application.cxx @@ -19,6 +19,7 @@ #include "DF_definitions.hxx" #include "DF_Application.hxx" +#include "Basics_Utils.hxx" //Constructor DF_Application::DF_Application() @@ -85,6 +86,7 @@ int DF_Application::NbDocuments() //pointer to opened document. DF_Document* DF_Application::Open(const std::string& theFileName) { + SALOME_UNUSED(theFileName); //Not implemented return NULL; } @@ -93,5 +95,7 @@ DF_Document* DF_Application::Open(const std::string& theFileName) //Saves a Document in a given file with name theFileName void DF_Application::SaveAs(const DF_Document* theDocument, const std::string& theFileName) { + SALOME_UNUSED(theDocument); + SALOME_UNUSED(theFileName); //Not implemented } diff --git a/src/DF/DF_Document.cxx b/src/DF/DF_Document.cxx index 5447b35cf..3715506eb 100644 --- a/src/DF/DF_Document.cxx +++ b/src/DF/DF_Document.cxx @@ -21,6 +21,7 @@ #include "DF_Document.hxx" #include "DF_Label.hxx" #include "DF_ChildIterator.hxx" +#include "Basics_Utils.hxx" //Class DF_Document is container for user's data stored as a tree of Labels //with assigned Attributes @@ -132,6 +133,7 @@ void DF_Document::SetModified(bool isModified) //Restores a content of the Document from the std::string theData void DF_Document::Load(const std::string& theData) { + SALOME_UNUSED(theData); //Not implemented } diff --git a/src/HDFPersist/HDFascii.cc b/src/HDFPersist/HDFascii.cc index 55ee4e11a..3887d0f4f 100644 --- a/src/HDFPersist/HDFascii.cc +++ b/src/HDFPersist/HDFascii.cc @@ -310,6 +310,7 @@ void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident) //============================================================================ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) { + SALOME_UNUSED(ident); hdf_attribute->OpenOnDisk(); hdf_type type = hdf_attribute->GetType(); diff --git a/src/HDFPersist/HDFcontainerObject.cc b/src/HDFPersist/HDFcontainerObject.cc index bb09a5eff..d3543350a 100644 --- a/src/HDFPersist/HDFcontainerObject.cc +++ b/src/HDFPersist/HDFcontainerObject.cc @@ -27,6 +27,7 @@ #include "hdfi.h" #include "HDFcontainerObject.hxx" #include "HDFexception.hxx" +#include "Basics_Utils.hxx" HDFcontainerObject::HDFcontainerObject(const char *name) : HDFinternalObject(name) @@ -54,6 +55,7 @@ int HDFcontainerObject::nInternalObjects() void HDFcontainerObject::InternalObjectIndentify(int rank, char *object_name) { + SALOME_UNUSED(rank); object_name = NULL; } diff --git a/src/HDFPersist/HDFdataset.cc b/src/HDFPersist/HDFdataset.cc index 576abfb9c..7f9ffd540 100644 --- a/src/HDFPersist/HDFdataset.cc +++ b/src/HDFPersist/HDFdataset.cc @@ -29,11 +29,13 @@ #include "HDFdataset.hxx" #include "HDFcontainerObject.hxx" #include "HDFexception.hxx" +#include "Basics_Utils.hxx" #include herr_t dataset_attr(hid_t loc_id, const char *attr_name, void *operator_data) { + SALOME_UNUSED(loc_id); *(char**)operator_data = new char[strlen(attr_name)+1]; strcpy(*(char**)operator_data, attr_name); return 1; diff --git a/src/HDFPersist/HDFfile.cc b/src/HDFPersist/HDFfile.cc index 9e8391142..398aeb9eb 100644 --- a/src/HDFPersist/HDFfile.cc +++ b/src/HDFPersist/HDFfile.cc @@ -36,9 +36,11 @@ #include #include "HDFfile.hxx" #include "HDFexception.hxx" +#include "Basics_Utils.hxx" herr_t file_attr(hid_t loc_id, const char *attr_name, void *operator_data) { + SALOME_UNUSED(loc_id); *(char**)operator_data = new char[strlen(attr_name)+1]; strcpy(*(char**)operator_data, attr_name); return 1; diff --git a/src/HDFPersist/HDFgroup.cc b/src/HDFPersist/HDFgroup.cc index 1a586f20e..2db76d5ca 100644 --- a/src/HDFPersist/HDFgroup.cc +++ b/src/HDFPersist/HDFgroup.cc @@ -28,9 +28,11 @@ #include #include "HDFgroup.hxx" #include "HDFexception.hxx" +#include "Basics_Utils.hxx" herr_t group_attr(hid_t loc_id, const char *attr_name, void *operator_data) { + SALOME_UNUSED(loc_id); *(char**)operator_data = new char[strlen(attr_name)+1]; strcpy(*(char**)operator_data, attr_name); return 1; diff --git a/src/HDFPersist/HDFnObjects.c b/src/HDFPersist/HDFnObjects.c index 7edecd69b..1b5d20e9b 100644 --- a/src/HDFPersist/HDFnObjects.c +++ b/src/HDFPersist/HDFnObjects.c @@ -28,7 +28,6 @@ SALOME HDFPersist : implementation of HDF persitent ( save/ restore ) #include "hdfi.h" #include - /* * - Name : HDFnObjects * - Description : returns the number of HDF objects in an HDF group @@ -59,7 +58,8 @@ HDFnObjects(hdf_idt fid,const char *path,int *n) hdf_err Num(hdf_idt id,const char *name, void *data) { int *count; - + (void)name; + (void)id; count = (int *) data; (*count)++; diff --git a/src/HDFPersist/HDFobjectIdentify.c b/src/HDFPersist/HDFobjectIdentify.c index ab24a6ca8..7d846a1ef 100644 --- a/src/HDFPersist/HDFobjectIdentify.c +++ b/src/HDFPersist/HDFobjectIdentify.c @@ -59,6 +59,7 @@ hdf_err HDFobjectIdentify(hdf_idt fid,const char *path,int i,char *name) hdf_err RankInfo(hdf_idt id, const char *name, void *data) { + (void)id; if ( data ) strcpy( (char*)data, name ); else diff --git a/src/Logger/SALOME_Logger_Server.hxx b/src/Logger/SALOME_Logger_Server.hxx index c4a5182a2..b74ac45be 100644 --- a/src/Logger/SALOME_Logger_Server.hxx +++ b/src/Logger/SALOME_Logger_Server.hxx @@ -48,7 +48,7 @@ #endif #ifdef WIN32 -#pragma warning(disable:4275) // Disable warning interface non dll +//#pragma warning(disable:4275) // Disable warning interface non dll #endif class LOGGER_EXPORT Logger : diff --git a/src/Logger/SALOME_Trace.cxx b/src/Logger/SALOME_Trace.cxx index 0ec93bb17..6f4731375 100644 --- a/src/Logger/SALOME_Trace.cxx +++ b/src/Logger/SALOME_Trace.cxx @@ -26,6 +26,7 @@ // Module : SALOME // #include "SALOME_Trace.hxx" +#include "Basics_Utils.hxx" #include #include //#include @@ -136,6 +137,7 @@ int SALOME_Trace::Initialize(CORBA::ORB_ptr theOrb) { void SALOME_Trace::putMessage(std::ostream& msg) { + SALOME_UNUSED(msg); //if (!isInitialized) std::cout<<"!!! SALOME_Trace is used without initialising !!!"<_status=TERMINATED; - _reg[id]->_ts_end = time(NULL) ; + _reg[id]->_ts_end = (long)time(NULL) ; //!< TODO: conversation from time_t to long _fin[id]=_reg[id]; _reg.erase(id); @@ -132,7 +132,7 @@ void RegistryService::hello( CORBA::ULong id ) ASSERT(strlen(_SessionName)>0) ; ASSERT(_reg.find(id)!=_reg.end()) - _reg[id]->_ts_hello = time(NULL) ; + _reg[id]->_ts_hello = (long)time(NULL) ; //!< TODO: conversation from time_t to long END_OF("RegistryService::hello") ; return ; @@ -207,7 +207,7 @@ RegistryService::client_infos::client_infos( const Registry::Infos &infos ):\ _adip(duplicate(infos.adip)),\ _uid(infos.uid),\ _pwname(duplicate(infos.pwname)),\ - _ts_start(time(NULL)),\ + _ts_start((long)time(NULL)),\ _difftime(infos.tc_start - _ts_start),\ _cdir(duplicate(infos.cdir)),\ _ts_hello(_ts_start),\ diff --git a/src/ResourcesManager/SALOME_LoadRateManager.cxx b/src/ResourcesManager/SALOME_LoadRateManager.cxx index a77780273..4d45ba5fa 100644 --- a/src/ResourcesManager/SALOME_LoadRateManager.cxx +++ b/src/ResourcesManager/SALOME_LoadRateManager.cxx @@ -27,6 +27,7 @@ std::string LoadRateManagerFirst::Find(const std::vector& hosts, const MapOfParserResourcesType& resList) { + SALOME_UNUSED(resList); if (hosts.size() == 0) return std::string(""); @@ -66,6 +67,7 @@ std::string LoadRateManagerCycl::Find(const std::vector& hosts, std::string LoadRateManagerAltCycl::Find(const std::vector& hosts, const MapOfParserResourcesType& resList) { + SALOME_UNUSED(resList); if (hosts.size() == 0) return std::string(""); diff --git a/src/ResourcesManager/SALOME_LoadRateManager.hxx b/src/ResourcesManager/SALOME_LoadRateManager.hxx index e56999ad7..8a7d244e2 100644 --- a/src/ResourcesManager/SALOME_LoadRateManager.hxx +++ b/src/ResourcesManager/SALOME_LoadRateManager.hxx @@ -27,6 +27,7 @@ #include #include #include "SALOME_ResourcesCatalog_Parser.hxx" +#include "Basics_Utils.hxx" class RESOURCESMANAGER_EXPORT LoadRateManager { diff --git a/src/SALOMELocalTrace/FileTraceCollector.cxx b/src/SALOMELocalTrace/FileTraceCollector.cxx index 932b20f7f..c282e6645 100644 --- a/src/SALOMELocalTrace/FileTraceCollector.cxx +++ b/src/SALOMELocalTrace/FileTraceCollector.cxx @@ -32,6 +32,7 @@ //#define _DEVDEBUG_ #include "FileTraceCollector.hxx" +#include "Basics_Utils.hxx" // Class attributes initialisation, for class method FileTraceCollector::run @@ -88,6 +89,7 @@ BaseTraceCollector* FileTraceCollector::instance(const char *fileName) void* FileTraceCollector::run(void *bid) { + SALOME_UNUSED(bid); //DEVTRACE("init run"); _threadId = new pthread_t; *_threadId = pthread_self(); diff --git a/src/SALOMELocalTrace/LocalTraceCollector.cxx b/src/SALOMELocalTrace/LocalTraceCollector.cxx index cd8864163..8b2ffa43b 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.cxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.cxx @@ -30,6 +30,7 @@ #include #include +#include "Basics_Utils.hxx" #include "LocalTraceCollector.hxx" // ============================================================================ @@ -78,6 +79,7 @@ BaseTraceCollector* LocalTraceCollector::instance() void* LocalTraceCollector::run(void *bid) { + SALOME_UNUSED(bid); _threadId = new pthread_t; *_threadId = pthread_self(); sem_post(&_sem); // unlock instance diff --git a/src/SALOMESDS/CMakeLists.txt b/src/SALOMESDS/CMakeLists.txt index 737f21eec..8ae23bba3 100644 --- a/src/SALOMESDS/CMakeLists.txt +++ b/src/SALOMESDS/CMakeLists.txt @@ -24,6 +24,7 @@ INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_DIRS} ${PROJECT_BINARY_DIR}/idl ${PROJECT_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics ${CMAKE_CURRENT_SOURCE_DIR}/../Utils ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService ${CMAKE_CURRENT_SOURCE_DIR}/../Launcher diff --git a/src/SALOMESDS/SALOMESDS_RefCountServ.cxx b/src/SALOMESDS/SALOMESDS_RefCountServ.cxx index d95e282d8..7a7c72186 100644 --- a/src/SALOMESDS/SALOMESDS_RefCountServ.cxx +++ b/src/SALOMESDS/SALOMESDS_RefCountServ.cxx @@ -19,6 +19,7 @@ // Author : Anthony GEAY (EDF R&D) #include "SALOMESDS_RefCountServ.hxx" +#include "Basics_Utils.hxx" using namespace SALOMESDS; diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.cxx b/src/SALOMETraceCollector/SALOMETraceCollector.cxx index 4c556288a..684084838 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.cxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.cxx @@ -26,6 +26,7 @@ // $Header$ // #include +#include "Basics_Utils.hxx" #include #include @@ -92,6 +93,7 @@ BaseTraceCollector* SALOMETraceCollector::instance() void* SALOMETraceCollector::run(void *bid) { + SALOME_UNUSED(bid); _threadId = new pthread_t; *_threadId = pthread_self(); sem_post(&_sem); // unlock instance