Skip to content

Commit

Permalink
Merge pull request #2021 from nophead/fix_compiler_warnings
Browse files Browse the repository at this point in the history
Fixed a plethora of compiler warnings.
  • Loading branch information
kintel committed May 2, 2017
2 parents 9e47423 + fa724db commit b48b525
Show file tree
Hide file tree
Showing 32 changed files with 52 additions and 86 deletions.
2 changes: 1 addition & 1 deletion src/CGAL_Nef_polyhedron.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CGAL_Nef_polyhedron : public Geometry

virtual size_t memsize() const;
// FIXME: Implement, but we probably want a high-resolution BBox..
virtual BoundingBox getBoundingBox() const { assert(false && "not implemented"); }
virtual BoundingBox getBoundingBox() const { assert(false && "not implemented"); return BoundingBox(); }
virtual std::string dump() const;
virtual unsigned int getDimension() const { return 3; }
// Empty means it is a geometric node which has zero area/volume
Expand Down
2 changes: 1 addition & 1 deletion src/CGAL_OGL_Polyhedron.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class CGAL_OGL_Polyhedron : public CGAL::OGL::Polyhedron
}

// overrides function in OGL_helper.h
CGAL::Color getFacetColor(Halffacet_iterator f, bool is_back_facing) const {
CGAL::Color getFacetColor(Halffacet_iterator f, bool /*is_back_facing*/) const {
PRINTD("getFacetColor");
CGAL::Color c = f->mark() ? colors[CGALColorIndex::UNMARKED_FACET_COLOR] : colors[CGALColorIndex::MARKED_FACET_COLOR];
return c;
Expand Down
11 changes: 6 additions & 5 deletions src/CSGTreeEvaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ shared_ptr<CSGNode> CSGTreeEvaluator::buildCSGTree(const AbstractNode &node)
return this->rootNode = t;
}

void CSGTreeEvaluator::applyBackgroundAndHighlight(State &state, const AbstractNode &node)
void CSGTreeEvaluator::applyBackgroundAndHighlight(State & /*state*/, const AbstractNode &node)
{
for(const auto &chnode : this->visitedchildren[node.index()]) {
shared_ptr<CSGNode> t(this->stored_term[chnode->index()]);
Expand All @@ -56,17 +56,14 @@ void CSGTreeEvaluator::applyBackgroundAndHighlight(State &state, const AbstractN
}
}

void CSGTreeEvaluator::applyToChildren(State &state, const AbstractNode &node, OpenSCADOperator op)
void CSGTreeEvaluator::applyToChildren(State & /*state*/, const AbstractNode &node, OpenSCADOperator op)
{
shared_ptr<CSGNode> t1;
const ModuleInstantiation *t1_modinst;
for(const auto &chnode : this->visitedchildren[node.index()]) {
shared_ptr<CSGNode> t2(this->stored_term[chnode->index()]);
auto t2_modinst = chnode->modinst;
this->stored_term.erase(chnode->index());
if (t2 && !t1) {
t1 = t2;
t1_modinst = t2_modinst;
} else if (t2 && t1) {

shared_ptr<CSGNode> t;
Expand Down Expand Up @@ -127,6 +124,10 @@ void CSGTreeEvaluator::applyToChildren(State &state, const AbstractNode &node, O
t = t1;
}
break;
case OpenSCADOperator::MINKOWSKI:
case OpenSCADOperator::HULL:
case OpenSCADOperator::RESIZE:
break;
}
t1 = t;
}
Expand Down
2 changes: 1 addition & 1 deletion src/FileModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FileModule::~FileModule()
{
}

std::string FileModule::dump(const std::string &indent, const std::string &name) const
std::string FileModule::dump(const std::string &indent, const std::string & /*name*/) const
{
return scope.dump(indent);
}
Expand Down
5 changes: 0 additions & 5 deletions src/FontCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ std::vector<std::string> fontpath;

namespace fs = boost::filesystem;

static bool FontInfoSortPredicate(const FontInfo& fi1, const FontInfo& fi2)
{
return (fi1 < fi2);
}

FontInfo::FontInfo(const std::string &family, const std::string &style, const std::string &file) : family(family), style(style), file(file)
{
}
Expand Down
2 changes: 1 addition & 1 deletion src/GeometryEvaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ Response GeometryEvaluator::visit(State &state, const RotateExtrudeNode &node)
/*!
FIXME: Not in use
*/
Response GeometryEvaluator::visit(State &state, const AbstractPolyNode &node)
Response GeometryEvaluator::visit(State & /*state*/, const AbstractPolyNode & /*node*/)
{
assert(false);
return Response::AbortTraversal;
Expand Down
2 changes: 1 addition & 1 deletion src/OGL_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ namespace OGL {


// Overridden in CGAL_renderer
virtual CGAL::Color getFacetColor(Halffacet_iterator f, bool is_back_facing) const
virtual CGAL::Color getFacetColor(Halffacet_iterator /*f*/, bool /*is_back_facing*/) const
{
PRINTD("getFacetColor");
/*
Expand Down
2 changes: 1 addition & 1 deletion src/OffscreenContextWGL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ string get_os_info()
return out.str();
}

string offscreen_context_getinfo(OffscreenContext *ctx)
string offscreen_context_getinfo(OffscreenContext * /*ctx*/)
{
// should probably get some info from WGL context here?
stringstream out;
Expand Down
1 change: 0 additions & 1 deletion src/OpenCSGRenderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ void OpenCSGRenderer::renderCSGProducts(const CSGProducts &products, GLint *shad
}
if (shaderinfo) glUseProgram(shaderinfo[0]);

const CSGChainObject &parent_obj = product.intersections[0];
for(const auto &csgobj : product.intersections) {
const Color4f &c = csgobj.leaf->color;
csgmode_e csgmode = csgmode_e(
Expand Down
3 changes: 2 additions & 1 deletion src/Preferences.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class SettingsReader : public Settings::SettingsVisitor
return Value(boost::lexical_cast<bool>(trimmed_value));
default:
assert(false && "invalid value type for settings");
return 0; // keep compiler happy
}
} catch (const boost::bad_lexical_cast& e) {
return entry.defaultValue();
Expand Down Expand Up @@ -144,7 +145,7 @@ void Preferences::init() {
QFontDatabase db;
for(auto size : db.standardSizes()) {
this->fontSize->addItem(QString::number(size));
if (size == savedsize) {
if (static_cast<uint>(size) == savedsize) {
this->fontSize->setCurrentIndex(this->fontSize->count()-1);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/cgaladvnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class CgaladvNode : public AbstractNode

ValuePtr path;
std::string subdiv_type;
int convexity, level;
unsigned int convexity;
int level;
Vector3d newsize;
Eigen::Matrix<bool,3,1> autosize;
CgaladvType type;
Expand Down
10 changes: 5 additions & 5 deletions src/cgalutils-polyhedron.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ namespace CGALUtils {
public:
Polyhedron_writer() {}
void write_header(std::ostream &stream,
std::size_t vertices,
std::size_t halfedges,
std::size_t facets,
bool normals = false) {
std::size_t /*vertices*/,
std::size_t /*halfedges*/,
std::size_t /*facets*/
/*bool normals = false*/) {
this->out = &stream;
*out << "polyhedron(points=[";
firstv = true;
Expand All @@ -317,7 +317,7 @@ namespace CGALUtils {
*out << "], faces=[";
firstv = true;
}
void write_facet_begin( std::size_t no) {
void write_facet_begin( std::size_t /*no*/) {
*out << (firstv ? "" : ",") << '[';
indices.clear();
firstv = false;
Expand Down
2 changes: 1 addition & 1 deletion src/comment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ void CommentParser::collectParameters(const char *fulltext, FileModule *root_mod

// Look for the group to which the given assignment belong
int i=0;
for (;i<groupList.size() && groupList[i].lineNo<firstLine;i++);
for (; (unsigned)i < groupList.size() && groupList[i].lineNo<firstLine;i++);
i--;

if (i >= 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/comment_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "printutils.h"
#include "value.h"
#include "comment.h"
void yyerror(char *);
void yyerror(const char *);
int comment_lexerlex(void);
int comment_parserlex(void);
extern void comment_lexer_scan_string ( const char *str );
Expand Down Expand Up @@ -127,7 +127,7 @@ int comment_parserlex(void)
return comment_lexerlex();
}

void yyerror(char *msg) {
void yyerror(const char * /*msg*/) {
PRINTD("ERROR IN PARAMETER: Parser error in comments of file \n ");
params = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/export_amf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static void append_amf(const shared_ptr<const Geometry> &geom, std::ostream &out
if (!N->isEmpty()) append_amf(*N, output);
delete N;
}
else if (const Polygon2d *poly = dynamic_cast<const Polygon2d *>(geom.get())) {
else if (dynamic_cast<const Polygon2d *>(geom.get())) {
assert(false && "Unsupported file format");
} else {
assert(false && "Not implemented");
Expand Down
2 changes: 1 addition & 1 deletion src/export_dxf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void export_dxf(const Polygon2d &poly, std::ostream &output)

void export_dxf(const shared_ptr<const Geometry> &geom, std::ostream &output)
{
if (const PolySet *ps = dynamic_cast<const PolySet *>(geom.get())) {
if (dynamic_cast<const PolySet *>(geom.get())) {
assert(false && "Unsupported file format");
}
else if (const Polygon2d *poly = dynamic_cast<const Polygon2d *>(geom.get())) {
Expand Down
2 changes: 1 addition & 1 deletion src/export_off.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void append_geometry(const shared_ptr<const Geometry> &geom, IndexedMesh &mesh)
else if (const PolySet *ps = dynamic_cast<const PolySet *>(geom.get())) {
append_geometry(*ps, mesh);
}
else if (const Polygon2d *poly = dynamic_cast<const Polygon2d *>(geom.get())) {
else if (dynamic_cast<const Polygon2d *>(geom.get())) {
assert(false && "Unsupported file format");
} else {
assert(false && "Not implemented");
Expand Down
2 changes: 1 addition & 1 deletion src/export_stl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static void append_stl(const shared_ptr<const Geometry> &geom, std::ostream &out
else if (const PolySet *ps = dynamic_cast<const PolySet *>(geom.get())) {
append_stl(*ps, output);
}
else if (const Polygon2d *poly = dynamic_cast<const Polygon2d *>(geom.get())) {
else if (dynamic_cast<const Polygon2d *>(geom.get())) {
assert(false && "Unsupported file format");
} else {
assert(false && "Not implemented");
Expand Down
2 changes: 1 addition & 1 deletion src/export_svg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void append_svg(const Polygon2d &poly, std::ostream &output)

static void append_svg(const shared_ptr<const Geometry> &geom, std::ostream &output)
{
if (const PolySet *ps = dynamic_cast<const PolySet *>(geom.get())) {
if (dynamic_cast<const PolySet *>(geom.get())) {
assert(false && "Unsupported file format");
}
else if (const Polygon2d *poly = dynamic_cast<const Polygon2d *>(geom.get())) {
Expand Down
12 changes: 7 additions & 5 deletions src/import_stl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ union stl_facet {
} data;
};

#ifdef BOOST_BIG_ENDIAN
static void uint32_byte_swap(uint32_t &x)
{
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
# if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
x = __builtin_bswap32( x );
#elif defined(__clang__)
# elif defined(__clang__)
x = __builtin_bswap32( x );
#elif defined(_MSC_VER)
# elif defined(_MSC_VER)
x = _byteswap_ulong( x );
#else
# else
uint32_t b1 = ( 0x000000FF & x ) << 24;
uint32_t b2 = ( 0x0000FF00 & x ) << 8;
uint32_t b3 = ( 0x00FF0000 & x ) >> 8;
uint32_t b4 = ( 0xFF000000 & x ) >> 24;
x = b1 | b2 | b3 | b4;
#endif
# endif
}
#endif

static void read_stl_facet(std::ifstream &f, stl_facet &facet)
{
Expand Down
4 changes: 2 additions & 2 deletions src/legacyeditor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ bool LegacyEditor::findString(const QString & exp, bool findBackwards) const
return this->textedit->find(exp, findBackwards ? QTextDocument::FindBackward : QTextDocument::FindFlags(0));
}

int LegacyEditor::resetFindIndicators(const QString &findText, bool visibility)//incomplete-place-hoder
int LegacyEditor::resetFindIndicators(const QString & /*findText*/, bool /*visibility*/)//incomplete-place-holder
{
int findwordcount = 0;
// blank see scintillaeditor.cpp
return findwordcount;
}

bool LegacyEditor::find(const QString &newText, bool findNext, bool findBackwards)
bool LegacyEditor::find(const QString &newText, bool /*findNext*/, bool findBackwards)
{
bool success = this->findString(newText, findBackwards);
if (!success) { // Implement wrap-around search behavior
Expand Down
2 changes: 1 addition & 1 deletion src/libsvg/shape.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ shape::shape() : parent(NULL), x(0), y(0)
{
}

shape::shape(const shape& orig)
shape::shape(const shape& /*orig*/)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/libsvg/transformation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ transformation::add_arg(const std::string arg)
const std::string
transformation::get_args() {
std::stringstream str;
for (int a = 0;a < args.size();a++) {
for (unsigned int a = 0;a < args.size();a++) {
str << ((a == 0) ? "(" : ", ") << args[a];
}
str << ")";
Expand Down
2 changes: 1 addition & 1 deletion src/libtess2/Source/geom.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ double Interpolate( double a, double x, double b, double y)

#endif

#define Swap(a,b) if (1) { TESSvertex *t = a; a = b; b = t; } else
#define Swap(a,b) do { TESSvertex *t = a; a = b; b = t; } while(0)

void tesedgeIntersect( TESSvertex *o1, TESSvertex *d1,
TESSvertex *o2, TESSvertex *d2,
Expand Down
2 changes: 1 addition & 1 deletion src/libtess2/Source/priorityq.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void pqDeletePriorityQ( TESSalloc* alloc, PriorityQ *pq )

#define LT(x,y) (! LEQ(y,x))
#define GT(x,y) (! LEQ(x,y))
#define Swap(a,b) if(1){PQkey *tmp = *a; *a = *b; *b = tmp;}else
#define Swap(a,b) do {PQkey *tmp = *a; *a = *b; *b = tmp;} while(0)

/* really tessPqSortInit */
int pqInit( TESSalloc* alloc, PriorityQ *pq )
Expand Down
32 changes: 0 additions & 32 deletions src/mainwin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,38 +142,6 @@ static char copyrighttext[] =
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or "
"(at your option) any later version.";

static void
settings_setValueList(const QString &key,const QList<int> &list)
{
QSettings settings;
settings.beginWriteArray(key);
for (int i=0;i<list.size(); ++i) {
settings.setArrayIndex(i);
settings.setValue("entry",list[i]);
}
settings.endArray();
}

QList<int>
settings_valueList(const QString &key, const QList<int> &defaultList = QList<int>())
{
QSettings settings;
QList<int> result;
if (settings.contains(key+"/size")){
auto length = settings.beginReadArray(key);
for (int i = 0; i < length; ++i) {
settings.setArrayIndex(i);
result += settings.value("entry").toInt();
}
settings.endArray();
return result;
} else {
return defaultList;
}

}

bool MainWindow::mdiMode = false;
bool MainWindow::undockMode = false;
bool MainWindow::reorderMode = false;
Expand Down
7 changes: 3 additions & 4 deletions src/openscad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -771,14 +771,13 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
}
}

MainWindow *mainwin;
auto isMdi = settings.value("advanced/mdi", true).toBool();
if (isMdi) {
for(const auto &infile : inputFiles) {
mainwin = new MainWindow(assemblePath(original_path, infile));
new MainWindow(assemblePath(original_path, infile));
}
} else {
mainwin = new MainWindow(assemblePath(original_path, inputFiles[0]));
new MainWindow(assemblePath(original_path, inputFiles[0]));
}

app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
Expand All @@ -798,10 +797,10 @@ int gui(const vector<string> &inputFiles, const fs::path &original_path, int arg
int main(int argc, char **argv)
{
int rc = 0;
bool isGuiLaunched = getenv("GUI_LAUNCHED") != 0;
StackCheck::inst()->init();

#ifdef Q_OS_MAC
bool isGuiLaunched = getenv("GUI_LAUNCHED") != 0;
if (isGuiLaunched) set_output_handler(CocoaUtils::nslog, nullptr);
#else
PlatformUtils::ensureStdIO();
Expand Down
Loading

0 comments on commit b48b525

Please sign in to comment.