Enable -Wall -Wextra -Wno-unused-parameter on GCC/Clang.

This is good practice and helps to catch bugs. Several changes
were made to accomodate the newly enabled warnings:
  * -Wunused-function:
    * in exposed/, static functions that were supposed to be inlined
      were explicitly marked as inline;
    * some actually unused functions were removed;
  * -Wsign-compare: explicit conversions were added, and in
    the future we should find a nicer way than aux* fields;
  * -Wmissing-field-initializers: added initializers;
  * -Wreorder: reordered properly;
  * -Wunused-but-set-variable: remove variable.

-Wunused-parameter was turned off as enabling it would result in
massive amount of churn in UI code. Despite that, we should enable
it at some point as it has a fairly high SNR otherwise.
This commit is contained in:
whitequark 2016-05-07 23:34:21 +00:00
parent ee30fa2b0d
commit e969bc94ad
15 changed files with 74 additions and 97 deletions

View File

@ -46,7 +46,7 @@ if(WIN32)
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(WARNING_FLAGS "-Wunused-variable") set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-parameter")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${WARNING_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${WARNING_FLAGS}")
endif() endif()

View File

@ -36,7 +36,7 @@ static void *CheckMalloc(size_t n)
* An example of a constraint in 3d. We create a single group, with some * An example of a constraint in 3d. We create a single group, with some
* entities and constraints. * entities and constraints.
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
static void Example3d(void) void Example3d(void)
{ {
/* This will contain a single group, which will arbitrarily number 1. */ /* This will contain a single group, which will arbitrarily number 1. */
Slvs_hGroup g = 1; Slvs_hGroup g = 1;
@ -88,7 +88,7 @@ static void Example3d(void)
* along the reference frame's xy plane. In a second group, we create some * along the reference frame's xy plane. In a second group, we create some
* entities in that group and dimension them. * entities in that group and dimension them.
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
static void Example2d(void) void Example2d(void)
{ {
Slvs_hGroup g; Slvs_hGroup g;
double qw, qx, qy, qz; double qw, qx, qy, qz;

@ -1 +1 @@
Subproject commit a05d16eaa85c69d662d3b596ca82cbae56443295 Subproject commit 62e4a3cd8b19b2406af5a01c0bc45e77c9294068

View File

@ -219,7 +219,7 @@ DLL void Slvs_MakeQuaternion(double ux, double uy, double uz,
* out the structures by hand. The code is included in the header file to * out the structures by hand. The code is included in the header file to
* let the compiler inline them if possible. */ * let the compiler inline them if possible. */
static Slvs_Param Slvs_MakeParam(Slvs_hParam h, Slvs_hGroup group, double val) static inline Slvs_Param Slvs_MakeParam(Slvs_hParam h, Slvs_hGroup group, double val)
{ {
Slvs_Param r; Slvs_Param r;
r.h = h; r.h = h;
@ -227,9 +227,9 @@ static Slvs_Param Slvs_MakeParam(Slvs_hParam h, Slvs_hGroup group, double val)
r.val = val; r.val = val;
return r; return r;
} }
static Slvs_Entity Slvs_MakePoint2d(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakePoint2d(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl, Slvs_hEntity wrkpl,
Slvs_hParam u, Slvs_hParam v) Slvs_hParam u, Slvs_hParam v)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -241,8 +241,8 @@ static Slvs_Entity Slvs_MakePoint2d(Slvs_hEntity h, Slvs_hGroup group,
r.param[1] = v; r.param[1] = v;
return r; return r;
} }
static Slvs_Entity Slvs_MakePoint3d(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakePoint3d(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hParam x, Slvs_hParam y, Slvs_hParam z) Slvs_hParam x, Slvs_hParam y, Slvs_hParam z)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -255,8 +255,9 @@ static Slvs_Entity Slvs_MakePoint3d(Slvs_hEntity h, Slvs_hGroup group,
r.param[2] = z; r.param[2] = z;
return r; return r;
} }
static Slvs_Entity Slvs_MakeNormal3d(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakeNormal3d(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hParam qw, Slvs_hParam qx, Slvs_hParam qy, Slvs_hParam qz) Slvs_hParam qw, Slvs_hParam qx,
Slvs_hParam qy, Slvs_hParam qz)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -270,8 +271,8 @@ static Slvs_Entity Slvs_MakeNormal3d(Slvs_hEntity h, Slvs_hGroup group,
r.param[3] = qz; r.param[3] = qz;
return r; return r;
} }
static Slvs_Entity Slvs_MakeNormal2d(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakeNormal2d(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl) Slvs_hEntity wrkpl)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -281,8 +282,8 @@ static Slvs_Entity Slvs_MakeNormal2d(Slvs_hEntity h, Slvs_hGroup group,
r.wrkpl = wrkpl; r.wrkpl = wrkpl;
return r; return r;
} }
static Slvs_Entity Slvs_MakeDistance(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakeDistance(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl, Slvs_hParam d) Slvs_hEntity wrkpl, Slvs_hParam d)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -293,9 +294,9 @@ static Slvs_Entity Slvs_MakeDistance(Slvs_hEntity h, Slvs_hGroup group,
r.param[0] = d; r.param[0] = d;
return r; return r;
} }
static Slvs_Entity Slvs_MakeLineSegment(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakeLineSegment(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl, Slvs_hEntity wrkpl,
Slvs_hEntity ptA, Slvs_hEntity ptB) Slvs_hEntity ptA, Slvs_hEntity ptB)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -307,10 +308,10 @@ static Slvs_Entity Slvs_MakeLineSegment(Slvs_hEntity h, Slvs_hGroup group,
r.point[1] = ptB; r.point[1] = ptB;
return r; return r;
} }
static Slvs_Entity Slvs_MakeCubic(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakeCubic(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl, Slvs_hEntity wrkpl,
Slvs_hEntity pt0, Slvs_hEntity pt1, Slvs_hEntity pt0, Slvs_hEntity pt1,
Slvs_hEntity pt2, Slvs_hEntity pt3) Slvs_hEntity pt2, Slvs_hEntity pt3)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -324,11 +325,11 @@ static Slvs_Entity Slvs_MakeCubic(Slvs_hEntity h, Slvs_hGroup group,
r.point[3] = pt3; r.point[3] = pt3;
return r; return r;
} }
static Slvs_Entity Slvs_MakeArcOfCircle(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakeArcOfCircle(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl, Slvs_hEntity wrkpl,
Slvs_hEntity normal, Slvs_hEntity normal,
Slvs_hEntity center, Slvs_hEntity center,
Slvs_hEntity start, Slvs_hEntity end) Slvs_hEntity start, Slvs_hEntity end)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -342,10 +343,10 @@ static Slvs_Entity Slvs_MakeArcOfCircle(Slvs_hEntity h, Slvs_hGroup group,
r.point[2] = end; r.point[2] = end;
return r; return r;
} }
static Slvs_Entity Slvs_MakeCircle(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakeCircle(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl, Slvs_hEntity wrkpl,
Slvs_hEntity center, Slvs_hEntity center,
Slvs_hEntity normal, Slvs_hEntity radius) Slvs_hEntity normal, Slvs_hEntity radius)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -358,8 +359,8 @@ static Slvs_Entity Slvs_MakeCircle(Slvs_hEntity h, Slvs_hGroup group,
r.distance = radius; r.distance = radius;
return r; return r;
} }
static Slvs_Entity Slvs_MakeWorkplane(Slvs_hEntity h, Slvs_hGroup group, static inline Slvs_Entity Slvs_MakeWorkplane(Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity origin, Slvs_hEntity normal) Slvs_hEntity origin, Slvs_hEntity normal)
{ {
Slvs_Entity r; Slvs_Entity r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
@ -372,15 +373,15 @@ static Slvs_Entity Slvs_MakeWorkplane(Slvs_hEntity h, Slvs_hGroup group,
return r; return r;
} }
static Slvs_Constraint Slvs_MakeConstraint(Slvs_hConstraint h, static inline Slvs_Constraint Slvs_MakeConstraint(Slvs_hConstraint h,
Slvs_hGroup group, Slvs_hGroup group,
int type, int type,
Slvs_hEntity wrkpl, Slvs_hEntity wrkpl,
double valA, double valA,
Slvs_hEntity ptA, Slvs_hEntity ptA,
Slvs_hEntity ptB, Slvs_hEntity ptB,
Slvs_hEntity entityA, Slvs_hEntity entityA,
Slvs_hEntity entityB) Slvs_hEntity entityB)
{ {
Slvs_Constraint r; Slvs_Constraint r;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));

View File

@ -182,7 +182,7 @@ public:
bool used = false; bool used = false;
for(DxfFileWriter::BezierPath &path : writer->paths) { for(DxfFileWriter::BezierPath &path : writer->paths) {
for(SBezier *sb : path.beziers) { for(SBezier *sb : path.beziers) {
if(sb->auxA != s->h.v) continue; if((uint32_t)sb->auxA != s->h.v) continue;
used = true; used = true;
break; break;
} }

View File

@ -191,7 +191,7 @@ void ssglWriteText(const std::string &str, double h, Vector t, Vector u, Vector
bool gridFit = !SS.exportMode && u.Equals(SS.GW.projRight) && v.Equals(SS.GW.projUp); bool gridFit = !SS.exportMode && u.Equals(SS.GW.projRight) && v.Equals(SS.GW.projUp);
double scale = FONT_SCALE(h) / SS.GW.scale; double scale = FONT_SCALE(h) / SS.GW.scale;
Vector o = { 3840.0, 3840.0 }; Vector o = { 3840.0, 3840.0, 0.0 };
for(char32_t chr : ReadUTF8(str)) { for(char32_t chr : ReadUTF8(str)) {
const VectorGlyph &glyph = GetVectorGlyph(chr); const VectorGlyph &glyph = GetVectorGlyph(chr);
o.x += ssglDrawCharacter(glyph, t, o, u, v, scale, fn, fndata, gridFit); o.x += ssglDrawCharacter(glyph, t, o, u, v, scale, fn, fndata, gridFit);

View File

@ -349,7 +349,7 @@ protected:
} }
#ifdef HAVE_GTK2 #ifdef HAVE_GTK2
virtual bool on_expose_event(GdkEventExpose *event) { virtual bool on_expose_event(GdkEventExpose *) {
return on_draw(get_window()->create_cairo_context()); return on_draw(get_window()->create_cairo_context());
} }
#endif #endif
@ -590,7 +590,7 @@ protected:
return true; return true;
} }
virtual bool on_leave_notify_event (GdkEventCrossing*event) { virtual bool on_leave_notify_event (GdkEventCrossing *) {
SS.GW.MouseLeave(); SS.GW.MouseLeave();
return true; return true;
@ -688,7 +688,7 @@ protected:
Gtk::Window::on_hide(); Gtk::Window::on_hide();
} }
virtual bool on_delete_event(GdkEventAny *event) { virtual bool on_delete_event(GdkEventAny *) {
SS.Exit(); SS.Exit();
return true; return true;
@ -884,7 +884,7 @@ public:
MainMenuItem(const GraphicsWindow::MenuEntry &entry) : MainMenuItem(const GraphicsWindow::MenuEntry &entry) :
MenuItem(), _entry(entry), _synthetic(false) { MenuItem(), _entry(entry), _synthetic(false) {
Glib::ustring label(_entry.label); Glib::ustring label(_entry.label);
for(int i = 0; i < label.length(); i++) { for(size_t i = 0; i < label.length(); i++) {
if(label[i] == '&') if(label[i] == '&')
label.replace(i, 1, "_"); label.replace(i, 1, "_");
} }
@ -956,7 +956,7 @@ static void InitMainMenu(Gtk::MenuShell *menu_shell) {
Gtk::Menu *menu = new Gtk::Menu; Gtk::Menu *menu = new Gtk::Menu;
menu_item->set_submenu(*menu); menu_item->set_submenu(*menu);
if(entry->level >= sizeof(levels) / sizeof(levels[0])) if((unsigned)entry->level >= sizeof(levels) / sizeof(levels[0]))
oops(); oops();
levels[entry->level] = menu; levels[entry->level] = menu;
@ -997,10 +997,6 @@ void EnableMenuById(int id, bool enabled) {
main_menu_items[id]->set_sensitive(enabled); main_menu_items[id]->set_sensitive(enabled);
} }
static void ActivateMenuById(int id) {
main_menu_items[id]->activate();
}
void CheckMenuById(int id, bool checked) { void CheckMenuById(int id, bool checked) {
((MainMenuItem<Gtk::CheckMenuItem>*)main_menu_items[id])->set_active(checked); ((MainMenuItem<Gtk::CheckMenuItem>*)main_menu_items[id])->set_active(checked);
} }
@ -1301,7 +1297,7 @@ protected:
return true; return true;
} }
virtual bool on_leave_notify_event (GdkEventCrossing*event) { virtual bool on_leave_notify_event (GdkEventCrossing *) {
SS.TW.MouseLeave(); SS.TW.MouseLeave();
return true; return true;
@ -1367,7 +1363,7 @@ protected:
Gtk::Window::on_hide(); Gtk::Window::on_hide();
} }
virtual bool on_delete_event(GdkEventAny *event) { virtual bool on_delete_event(GdkEventAny *) {
/* trigger the action and ignore the request */ /* trigger the action and ignore the request */
GraphicsWindow::MenuView(GraphicsWindow::MNU_SHOW_TEXT_WND); GraphicsWindow::MenuView(GraphicsWindow::MNU_SHOW_TEXT_WND);
@ -1477,7 +1473,7 @@ std::vector<std::string> GetFontFiles() {
/* Space Navigator support */ /* Space Navigator support */
#ifdef HAVE_SPACEWARE #ifdef HAVE_SPACEWARE
static GdkFilterReturn GdkSpnavFilter(GdkXEvent *gxevent, GdkEvent *event, gpointer data) { static GdkFilterReturn GdkSpnavFilter(GdkXEvent *gxevent, GdkEvent *, gpointer) {
XEvent *xevent = (XEvent*) gxevent; XEvent *xevent = (XEvent*) gxevent;
spnav_event sev; spnav_event sev;

View File

@ -340,10 +340,6 @@ public:
} }
hStyle styleFor(const DRW_Entity *e) { hStyle styleFor(const DRW_Entity *e) {
DRW_Layer *layer = NULL;
auto bi = layers.find(e->layer);
if(bi != layers.end()) layer = &bi->second;
// Color. // Color.
// TODO: which color to choose: index or RGB one? // TODO: which color to choose: index or RGB one?
int col = getColor(e); int col = getColor(e);

View File

@ -13,22 +13,22 @@ static System SYS;
static int IsInit = 0; static int IsInit = 0;
void Group::GenerateEquations(IdList<Equation,hEquation> *l) { void Group::GenerateEquations(IdList<Equation,hEquation> *) {
// Nothing to do for now. // Nothing to do for now.
} }
void SolveSpace::CnfFreezeInt(uint32_t v, const std::string &name) void SolveSpace::CnfFreezeInt(uint32_t, const std::string &)
{ {
abort(); abort();
} }
uint32_t SolveSpace::CnfThawInt(uint32_t v, const std::string &name) uint32_t SolveSpace::CnfThawInt(uint32_t, const std::string &)
{ {
abort(); abort();
return 0; return 0;
} }
void SolveSpace::DoMessageBox(const char *str, int rows, int cols, bool error) void SolveSpace::DoMessageBox(const char *, int, int, bool)
{ {
abort(); abort();
} }

View File

@ -67,7 +67,6 @@ bool SEdge::EdgeCrosses(Vector ea, Vector eb, Vector *ppi, SPointList *spl) {
Vector d = eb.Minus(ea); Vector d = eb.Minus(ea);
double t_eps = LENGTH_EPS/d.Magnitude(); double t_eps = LENGTH_EPS/d.Magnitude();
double dist_a, dist_b;
double t, tthis; double t, tthis;
bool skew; bool skew;
Vector pi; Vector pi;
@ -84,15 +83,12 @@ bool SEdge::EdgeCrosses(Vector ea, Vector eb, Vector *ppi, SPointList *spl) {
return true; return true;
} }
dist_a = a.DistanceToLine(ea, d), // Can't just test if distance between d and a equals distance between d and b;
dist_b = b.DistanceToLine(ea, d); // they could be on opposite sides, since we don't have the sign.
// Can't just test if dist_a equals dist_b; they could be on opposite
// sides, since it's unsigned.
double m = sqrt(d.Magnitude()*dthis.Magnitude()); double m = sqrt(d.Magnitude()*dthis.Magnitude());
if(sqrt(fabs(d.Dot(dthis))) > (m - LENGTH_EPS)) { if(sqrt(fabs(d.Dot(dthis))) > (m - LENGTH_EPS)) {
// The edges are parallel. // The edges are parallel.
if(fabs(dist_a) > LENGTH_EPS) { if(fabs(a.DistanceToLine(ea, d)) > LENGTH_EPS) {
// and not coincident, so can't be interesecting // and not coincident, so can't be interesecting
return false; return false;
} }

View File

@ -461,8 +461,8 @@ public:
// POD members with indeterminate value. // POD members with indeterminate value.
Entity() : EntityBase({}), forceHidden(), actPoint(), actNormal(), Entity() : EntityBase({}), forceHidden(), actPoint(), actNormal(),
actDistance(), actVisible(), style(), construction(), actDistance(), actVisible(), style(), construction(),
dogd(), beziers(), edges(), edgesChordTol(), screenBBox(), beziers(), edges(), edgesChordTol(), screenBBox(), screenBBoxValid(),
screenBBoxValid() {}; dogd() {};
// A linked entity that was hidden in the source file ends up hidden // A linked entity that was hidden in the source file ends up hidden
// here too. // here too.

View File

@ -159,12 +159,12 @@ struct FileFilter {
// SolveSpace native file format // SolveSpace native file format
const FileFilter SlvsFileFilter[] = { const FileFilter SlvsFileFilter[] = {
{ "SolveSpace models", { "slvs" } }, { "SolveSpace models", { "slvs" } },
{ NULL } { NULL, {} }
}; };
// PNG format bitmap // PNG format bitmap
const FileFilter PngFileFilter[] = { const FileFilter PngFileFilter[] = {
{ "PNG", { "png" } }, { "PNG", { "png" } },
{ NULL } { NULL, {} }
}; };
// Triangle mesh // Triangle mesh
const FileFilter MeshFileFilter[] = { const FileFilter MeshFileFilter[] = {
@ -172,12 +172,12 @@ const FileFilter MeshFileFilter[] = {
{ "Wavefront OBJ mesh", { "obj" } }, { "Wavefront OBJ mesh", { "obj" } },
{ "Three.js-compatible mesh, with viewer", { "html" } }, { "Three.js-compatible mesh, with viewer", { "html" } },
{ "Three.js-compatible mesh, mesh only", { "js" } }, { "Three.js-compatible mesh, mesh only", { "js" } },
{ NULL } { NULL, {} }
}; };
// NURBS surfaces // NURBS surfaces
const FileFilter SurfaceFileFilter[] = { const FileFilter SurfaceFileFilter[] = {
{ "STEP file", { "step", "stp" } }, { "STEP file", { "step", "stp" } },
{ NULL } { NULL, {} }
}; };
// 2d vector (lines and curves) format // 2d vector (lines and curves) format
const FileFilter VectorFileFilter[] = { const FileFilter VectorFileFilter[] = {
@ -188,23 +188,23 @@ const FileFilter VectorFileFilter[] = {
{ "DXF file (AutoCAD 2007)", { "dxf" } }, { "DXF file (AutoCAD 2007)", { "dxf" } },
{ "HPGL file", { "plt", "hpgl" } }, { "HPGL file", { "plt", "hpgl" } },
{ "G Code", { "ngc", "txt" } }, { "G Code", { "ngc", "txt" } },
{ NULL } { NULL, {} }
}; };
// 3d vector (wireframe lines and curves) format // 3d vector (wireframe lines and curves) format
const FileFilter Vector3dFileFilter[] = { const FileFilter Vector3dFileFilter[] = {
{ "STEP file", { "step", "stp" } }, { "STEP file", { "step", "stp" } },
{ "DXF file (AutoCAD 2007)", { "dxf" } }, { "DXF file (AutoCAD 2007)", { "dxf" } },
{ NULL } { NULL, {} }
}; };
// All Importable formats // All Importable formats
const FileFilter ImportableFileFilter[] = { const FileFilter ImportableFileFilter[] = {
{ "AutoCAD DXF and DWG files", { "dxf", "dwg" } }, { "AutoCAD DXF and DWG files", { "dxf", "dwg" } },
{ NULL } { NULL, {} }
}; };
// Comma-separated value, like a spreadsheet would use // Comma-separated value, like a spreadsheet would use
const FileFilter CsvFileFilter[] = { const FileFilter CsvFileFilter[] = {
{ "CSV", { "csv" } }, { "CSV", { "csv" } },
{ NULL } { NULL, {} }
}; };
bool GetSaveFile(std::string *filename, const std::string &defExtension, bool GetSaveFile(std::string *filename, const std::string &defExtension,
@ -506,7 +506,7 @@ public:
void BezierAsPwl(SBezier *sb); void BezierAsPwl(SBezier *sb);
void BezierAsNonrationalCubic(SBezier *sb, int depth=0); void BezierAsNonrationalCubic(SBezier *sb, int depth=0);
virtual bool OutputConstraints(IdList<Constraint,hConstraint> *constraint) { return false; } virtual bool OutputConstraints(IdList<Constraint,hConstraint> *) { return false; }
virtual bool CanOutputMesh() const { return false; } virtual bool CanOutputMesh() const { return false; }
virtual void StartPath( RgbaColor strokeRgb, double lineWidth, virtual void StartPath( RgbaColor strokeRgb, double lineWidth,

View File

@ -286,17 +286,6 @@ static void DEBUGEDGELIST(SEdgeList *sel, SSurface *surf) {
} }
} }
static const char *REGION(int d) {
switch(d) {
case SShell::INSIDE: return "inside";
case SShell::OUTSIDE: return "outside";
case SShell::COINC_SAME: return "same";
case SShell::COINC_OPP: return "opp";
default: return "xxx";
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// We are given src, with at least one edge, and avoid, a list of points to // We are given src, with at least one edge, and avoid, a list of points to
// avoid. We return a chain of edges (that share endpoints), such that no // avoid. We return a chain of edges (that share endpoints), such that no

View File

@ -636,7 +636,7 @@ void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
// Now we actually build and trim the surfaces. // Now we actually build and trim the surfaces.
for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) {
int i, j; int i, j;
SBezier *sb, *prev; SBezier *sb;
List<Revolved> hsl = {}; List<Revolved> hsl = {};
for(sb = sbl->l.First(); sb; sb = sbl->l.NextAfter(sb)) { for(sb = sbl->l.First(); sb; sb = sbl->l.NextAfter(sb)) {
@ -673,7 +673,6 @@ void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
revsp = hsl.elem[WRAP(i-1, sbl->l.n)]; revsp = hsl.elem[WRAP(i-1, sbl->l.n)];
sb = &(sbl->l.elem[i]); sb = &(sbl->l.elem[i]);
prev = &(sbl->l.elem[WRAP(i-1, sbl->l.n)]);
for(j = 0; j < 4; j++) { for(j = 0; j < 4; j++) {
SCurve sc; SCurve sc;

View File

@ -195,7 +195,7 @@ void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) {
// When an extrude group is first created, it's positioned for a union // When an extrude group is first created, it's positioned for a union
// extrusion. If no constraints were added, flip it when we switch between // extrusion. If no constraints were added, flip it when we switch between
// union and difference modes to avoid manual work doing the smae. // union and difference modes to avoid manual work doing the smae.
if(g->meshCombine != v && g->GetNumConstraints() == 0 && if(g->meshCombine != (int)v && g->GetNumConstraints() == 0 &&
(v == Group::COMBINE_AS_DIFFERENCE || (v == Group::COMBINE_AS_DIFFERENCE ||
g->meshCombine == Group::COMBINE_AS_DIFFERENCE)) { g->meshCombine == Group::COMBINE_AS_DIFFERENCE)) {
g->ExtrusionForceVectorTo(g->ExtrusionGetVector().Negated()); g->ExtrusionForceVectorTo(g->ExtrusionGetVector().Negated());