From 2dc5cd44b7bb74ff760b0f2953c4b2e4a0329491 Mon Sep 17 00:00:00 2001 From: Stinkfist0 Date: Mon, 23 Nov 2015 15:52:12 +0200 Subject: [PATCH] Enable warning C4100 ("'identifier' : unreferenced formal parameter") and fix warnings. --- cmake/CMakeLists.txt | 15 +++++++------ src/examples/IfcOpenHouse.cpp | 2 +- src/ifcconvert/ColladaSerializer.h | 2 +- src/ifcconvert/IfcConvert.cpp | 2 ++ src/ifcconvert/IgesSerializer.h | 3 +-- src/ifcconvert/OpenCascadeBasedSerializer.h | 3 +-- src/ifcconvert/StepSerializer.h | 3 +-- src/ifcconvert/SvgSerializer.h | 6 ++---- src/ifcconvert/WavefrontObjSerializer.h | 4 ++-- src/ifcgeomserver/IfcGeomServer.cpp | 20 ++++++++--------- src/ifcparse/IfcParse.cpp | 6 ++++-- src/ifcparse/IfcSpfHeader.h | 4 ++-- src/ifcparse/IfcUtil.h | 2 +- src/ifcparse/IfcWrite.cpp | 24 ++++++++++----------- 14 files changed, 48 insertions(+), 48 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 190c5c3e87..67ccc975d7 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -25,7 +25,7 @@ OPTION(UNICODE_SUPPORT "Build IfcOpenShell with Unicode support (requires ICU)." OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON) OPTION(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF) #TODO OPTION(IFCCONVERT_DOUBLE_PRECISION "IfcConvert: Use double precision floating-point numbers." OFF) -OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3" OFF) +OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3 (full rebuild recommended when switching this)" OFF) OPTION(BUILD_IFCPYTHON "Build IfcPython." ON) OPTION(BUILD_EXAMPLES "Build example applications." ON) # TODO QtViewer is deprecated ATM as it uses the 0.4 API @@ -217,14 +217,15 @@ if(ENABLE_BUILD_OPTIMIZATIONS) endif() IF(MSVC) + # Enforce Unicode for CRT and Win32 API calls + ADD_DEFINITIONS(-D_UNICODE -DUNICODE) # Disable warnings about unsafe C functions; we could use the safe C99 & C11 versions if we have no need for supporting old compilers. - ADD_DEFINITIONS(-D_UNICODE -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) + ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) ADD_DEFINITIONS(-bigobj) # required for building the big ifcXXX.objs, https://msdn.microsoft.com/en-us/library/ms173499.aspx - # Bump up the warning level from the default 3 to 4. Disable warning C4100 ("'identifier' : unreferenced formal parameter") - # (too much spam) - ADD_DEFINITIONS(-W4 -wd4100) - # and on VS > 2013 C4458 ("declaration of 'indentifier' hides class member") (overeager and false positives), at least for now. - IF(MSVC_VERSION GREATER 1800) + # Bump up the warning level from the default 3 to 4. + ADD_DEFINITIONS(-W4) + IF(MSVC_VERSION GREATER 1800) # > 2013 + # Disable overeager and false positives causing C4458 ("declaration of 'indentifier' hides class member"), at least for now. ADD_DEFINITIONS(-wd4458) ENDIF() # Link against the static VC runtime diff --git a/src/examples/IfcOpenHouse.cpp b/src/examples/IfcOpenHouse.cpp index 9f4887c5f9..997ef8b58c 100644 --- a/src/examples/IfcOpenHouse.cpp +++ b/src/examples/IfcOpenHouse.cpp @@ -50,7 +50,7 @@ boost::none_t const null = boost::none; // The creation of Nurbs-surface for the IfcSite mesh, to be implemented lateron void createGroundShape(TopoDS_Shape& shape); -int main(int argc, char** argv) { +int main() { // The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several // convenience functions for working with geometry in IFC files. diff --git a/src/ifcconvert/ColladaSerializer.h b/src/ifcconvert/ColladaSerializer.h index 350a3e58b5..cf3a35e733 100644 --- a/src/ifcconvert/ColladaSerializer.h +++ b/src/ifcconvert/ColladaSerializer.h @@ -165,7 +165,7 @@ public: bool ready(); void writeHeader(); void write(const IfcGeom::TriangulationElement* o); - void write(const IfcGeom::BRepElement* o) {} + void write(const IfcGeom::BRepElement* /*o*/) {} void finalize(); bool isTesselated() const { return true; } void setUnitNameAndMagnitude(const std::string& name, float magnitude) { diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 88225a47fe..6cc649bad2 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -42,6 +42,8 @@ #include "../ifcconvert/XmlSerializer.h" #include "../ifcconvert/SvgSerializer.h" +#include + static std::string DEFAULT_EXTENSION = "obj"; void printVersion() { diff --git a/src/ifcconvert/IgesSerializer.h b/src/ifcconvert/IgesSerializer.h index 8591af9902..7536008d44 100644 --- a/src/ifcconvert/IgesSerializer.h +++ b/src/ifcconvert/IgesSerializer.h @@ -20,7 +20,6 @@ #ifndef IGESSERIALIZER_H #define IGESSERIALIZER_H -#include #include #include @@ -43,7 +42,7 @@ public: void finalize() { writer.Write(out_filename.c_str()); } - void setUnitNameAndMagnitude(const std::string& name, float magnitude) { + void setUnitNameAndMagnitude(const std::string& /*name*/, float magnitude) { const char* symbol = getSymbolForUnitMagnitude(magnitude); if (symbol) { Interface_Static::SetCVal("write.iges.unit", symbol); diff --git a/src/ifcconvert/OpenCascadeBasedSerializer.h b/src/ifcconvert/OpenCascadeBasedSerializer.h index f6fd39fb82..6ee69635a4 100644 --- a/src/ifcconvert/OpenCascadeBasedSerializer.h +++ b/src/ifcconvert/OpenCascadeBasedSerializer.h @@ -37,10 +37,9 @@ public: {} virtual ~OpenCascadeBasedSerializer() {} void writeHeader() {} - void writeMaterial(const IfcGeom::SurfaceStyle& style) {} bool ready(); virtual void writeShape(const TopoDS_Shape& shape) = 0; - void write(const IfcGeom::TriangulationElement* o) {} + void write(const IfcGeom::TriangulationElement* /*o*/) {} void write(const IfcGeom::BRepElement* o); bool isTesselated() const { return false; } void setFile(IfcParse::IfcFile*) {} diff --git a/src/ifcconvert/StepSerializer.h b/src/ifcconvert/StepSerializer.h index 4667104a38..5e1493a020 100644 --- a/src/ifcconvert/StepSerializer.h +++ b/src/ifcconvert/StepSerializer.h @@ -20,7 +20,6 @@ #ifndef STEPSERIALIZER_H #define STEPSERIALIZER_H -#include #include #include @@ -49,7 +48,7 @@ public: writer.Write(out_filename.c_str()); std::cout.rdbuf(sb); } - void setUnitNameAndMagnitude(const std::string& name, float magnitude) { + void setUnitNameAndMagnitude(const std::string& /*name*/, float magnitude) { const char* symbol = getSymbolForUnitMagnitude(magnitude); if (symbol) { Interface_Static::SetCVal("write.step.unit", symbol); diff --git a/src/ifcconvert/SvgSerializer.h b/src/ifcconvert/SvgSerializer.h index 2efb632b6d..1c553e451d 100644 --- a/src/ifcconvert/SvgSerializer.h +++ b/src/ifcconvert/SvgSerializer.h @@ -35,7 +35,6 @@ class SvgSerializer : public GeometrySerializer { public: typedef std::pair > path_object; protected: - const char* getSymbolForUnitMagnitude(float mag); std::ofstream svg_file; double xmin, ymin, xmax, ymax, width, height; boost::optional section_height; @@ -62,15 +61,14 @@ public: virtual void growBoundingBox(double x, double y) { if (x < xmin) xmin = x; if (x > xmax) xmax = x; if (y < ymin) ymin = y; if (y > ymax) ymax = y; } virtual ~SvgSerializer() {} virtual void writeHeader(); - virtual void writeMaterial(const IfcGeom::SurfaceStyle& style) {} virtual bool ready(); - virtual void write(const IfcGeom::TriangulationElement* o) {} + virtual void write(const IfcGeom::TriangulationElement* /*o*/) {} virtual void write(const IfcGeom::BRepElement* o); virtual void write(path_object& p, const TopoDS_Wire& wire); virtual path_object& start_path(IfcSchema::IfcBuildingStorey* storey, const std::string& id); virtual bool isTesselated() const { return false; } virtual void finalize(); - virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) {} + virtual void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {} virtual void setFile(IfcParse::IfcFile* f) { file = f; } virtual void setBoundingRectangle(double width, double height); virtual void setSectionHeight(double h) { section_height = h; } diff --git a/src/ifcconvert/WavefrontObjSerializer.h b/src/ifcconvert/WavefrontObjSerializer.h index 7cb67909d2..1b1ae7d69d 100644 --- a/src/ifcconvert/WavefrontObjSerializer.h +++ b/src/ifcconvert/WavefrontObjSerializer.h @@ -46,10 +46,10 @@ public: void writeHeader(); void writeMaterial(const IfcGeom::Material& style); void write(const IfcGeom::TriangulationElement* o); - void write(const IfcGeom::BRepElement* o) {} + void write(const IfcGeom::BRepElement* /*o*/) {} void finalize() {} bool isTesselated() const { return true; } - void setUnitNameAndMagnitude(const std::string& name, float magnitude) {} + void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {} void setFile(IfcParse::IfcFile*) {} }; diff --git a/src/ifcgeomserver/IfcGeomServer.cpp b/src/ifcgeomserver/IfcGeomServer.cpp index ec8bf075b6..fa3a356b4d 100644 --- a/src/ifcgeomserver/IfcGeomServer.cpp +++ b/src/ifcgeomserver/IfcGeomServer.cpp @@ -156,16 +156,16 @@ public: class Get : public Command { protected: - void read_content(std::istream& s) {} - void write_content(std::ostream& s) {} + void read_content(std::istream& /*s*/) {} + void write_content(std::ostream& /*s*/) {} public: Get() : Command(GET) {}; }; class GetLog : public Command { protected: - void read_content(std::istream& s) {} - void write_content(std::ostream& s) {} + void read_content(std::istream& /*s*/) {} + void write_content(std::ostream& /*s*/) {} public: GetLog() : Command(GET_LOG) {}; }; @@ -189,7 +189,7 @@ private: const IfcGeom::TriangulationElement* geom; bool append_line_data; protected: - void read_content(std::istream& s) {} + void read_content(std::istream& /*s*/) {} void write_content(std::ostream& s) { swrite(s, geom->id()); swrite(s, geom->guid()); @@ -268,21 +268,21 @@ public: class Next : public Command { protected: - void read_content(std::istream& s) {} - void write_content(std::ostream& s) {} + void read_content(std::istream& /*s*/) {} + void write_content(std::ostream& /*s*/) {} public: Next() : Command(NEXT) {}; }; class Bye : public Command { protected: - void read_content(std::istream& s) {} - void write_content(std::ostream& s) {} + void read_content(std::istream& /*s*/) {} + void write_content(std::ostream& /*s*/) {} public: Bye() : Command(BYE) {}; }; -int main (int argc, char** argv) { +int main () { // Redirect stdout to this stream, so that involuntary // writes to stdout do not interfere with our protocol. std::ostringstream oss; diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 3a313b7603..f5bcb67237 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -143,6 +143,8 @@ void IfcSpfStream::ReadBuffer(bool inc) { offset += len; fseek(stream, offset, SEEK_SET); } +#else + (void)inc; #endif eof = feof(stream) != 0; if ( eof ) return; @@ -731,7 +733,7 @@ TokenArgument::operator std::vector< std::vector >() const { throw IfcExcep TokenArgument::operator std::vector< std::vector >() const { throw IfcException("Argument is not a list of list of floats"); } TokenArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); } unsigned int TokenArgument::size() const { return 1; } -Argument* TokenArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of attributes"); } +Argument* TokenArgument::operator [] (unsigned int /*i*/) const { throw IfcException("Argument is not a list of attributes"); } std::string TokenArgument::toString(bool upper) const { if ( upper && TokenFunc::isString(token) ) { return IfcWrite::IfcCharacterEncoder(TokenFunc::asString(token)); @@ -763,7 +765,7 @@ EntityArgument::operator std::vector< std::vector >() const { throw IfcExce EntityArgument::operator std::vector< std::vector >() const { throw IfcException("Argument is not a list of list of floats"); } EntityArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); } unsigned int EntityArgument::size() const { return 1; } -Argument* EntityArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of arguments"); } +Argument* EntityArgument::operator [] (unsigned int /*i*/) const { throw IfcException("Argument is not a list of arguments"); } std::string EntityArgument::toString(bool upper) const { return entity->entity->toString(upper); } diff --git a/src/ifcparse/IfcSpfHeader.h b/src/ifcparse/IfcSpfHeader.h index 0fca7678be..0b349003f5 100644 --- a/src/ifcparse/IfcSpfHeader.h +++ b/src/ifcparse/IfcSpfHeader.h @@ -68,7 +68,7 @@ public: return (*_list)[i]; } - IfcEntityList::ptr getInverse(IfcSchema::Type::Enum type, int attribute_index) { + IfcEntityList::ptr getInverse(IfcSchema::Type::Enum /*type*/, int /*attribute_index*/) { return IfcEntityList::ptr(new IfcEntityList); } @@ -84,7 +84,7 @@ public: return (IfcSchema::Type::Enum) -1; } - bool is(IfcSchema::Type::Enum v) const { + bool is(IfcSchema::Type::Enum /*v*/) const { return false; } diff --git a/src/ifcparse/IfcUtil.h b/src/ifcparse/IfcUtil.h index cbf18333e0..cc0548d149 100644 --- a/src/ifcparse/IfcUtil.h +++ b/src/ifcparse/IfcUtil.h @@ -100,7 +100,7 @@ namespace IfcUtil { unsigned int getArgumentCount() const; Argument* getArgument(unsigned int i) const; const char* getArgumentName(unsigned int i) const; - IfcSchema::Type::Enum getArgumentEntity(unsigned int i) const { return IfcSchema::Type::UNDEFINED; } + IfcSchema::Type::Enum getArgumentEntity(unsigned int /*i*/) const { return IfcSchema::Type::UNDEFINED; } }; bool valid_binary_string(const std::string& s); diff --git a/src/ifcparse/IfcWrite.cpp b/src/ifcparse/IfcWrite.cpp index 74628b7432..fd7739ebed 100644 --- a/src/ifcparse/IfcWrite.cpp +++ b/src/ifcparse/IfcWrite.cpp @@ -289,21 +289,21 @@ void IfcWritableEntity::setArgument(int i,const std::vector< boost::dynamic_bits class SizeVisitor : public boost::static_visitor { public: - int operator()(const boost::none_t& i) const { return -1; } - int operator()(const IfcWriteArgument::Derived& i) const { return -1; } - int operator()(const int& i) const { return -1; } - int operator()(const bool& i) const { return -1; } - int operator()(const double& i) const { return -1; } - int operator()(const std::string& i) const { return -1; } - int operator()(const boost::dynamic_bitset<>& i) const { return -1; } + int operator()(const boost::none_t& /*i*/) const { return -1; } + int operator()(const IfcWriteArgument::Derived& /*i*/) const { return -1; } + int operator()(const int& /*i*/) const { return -1; } + int operator()(const bool& /*i*/) const { return -1; } + int operator()(const double& /*i*/) const { return -1; } + int operator()(const std::string& /*i*/) const { return -1; } + int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; } int operator()(const std::vector& i) const { return (int)i.size(); } int operator()(const std::vector& i) const { return (int)i.size(); } int operator()(const std::vector< std::vector >& i) const { return (int)i.size(); } int operator()(const std::vector< std::vector >& i) const { return (int)i.size(); } int operator()(const std::vector& i) const { return (int)i.size(); } int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return (int)i.size(); } - int operator()(const IfcWriteArgument::EnumerationReference& i) const { return -1; } - int operator()(const IfcUtil::IfcBaseClass* const& i) const { return -1; } + int operator()(const IfcWriteArgument::EnumerationReference& /*i*/) const { return -1; } + int operator()(const IfcUtil::IfcBaseClass* const& /*i*/) const { return -1; } int operator()(const IfcEntityList::ptr& i) const { return i->size(); } int operator()(const IfcEntityListList::ptr& i) const { return i->size(); } }; @@ -371,8 +371,8 @@ private: public: StringBuilderVisitor(std::ostringstream& stream, bool upper = false) : data(stream), upper(upper) {} - void operator()(const boost::none_t& i) { data << "$"; } - void operator()(const IfcWriteArgument::Derived& i) { data << "*"; } + void operator()(const boost::none_t& /*i*/) { data << "$"; } + void operator()(const IfcWriteArgument::Derived& /*i*/) { data << "*"; } void operator()(const int& i) { data << i; } void operator()(const bool& i) { data << (i ? ".T." : ".F."); } void operator()(const double& i) { data << format_double(i); } @@ -502,7 +502,7 @@ IfcWriteArgument::operator std::vector< std::vector >() const { return as >() const { return as > >(); } IfcWriteArgument::operator IfcEntityListList::ptr() const { throw; } bool IfcWriteArgument::isNull() const { return type() == IfcUtil::Argument_NULL; } -Argument* IfcWriteArgument::operator [] (unsigned int i) const { throw IfcParse::IfcException("Invalid cast"); } +Argument* IfcWriteArgument::operator [] (unsigned int /*i*/) const { throw IfcParse::IfcException("Invalid cast"); } std::string IfcWriteArgument::toString(bool upper) const { std::ostringstream str; str.imbue(std::locale::classic());