From da657d75435d1880023503bd74e638577844c433 Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Wed, 7 Jan 2015 17:05:31 +0100 Subject: [PATCH] Treat deprecation as warning message (fixes #1143). --- src/control.cc | 2 +- src/import.cc | 4 ++-- src/linearextrude.cc | 2 +- src/mainwin.cc | 2 +- src/openscad.cc | 4 ++-- src/primitives.cc | 2 +- src/printutils.cc | 3 ++- src/rotateextrude.cc | 2 +- src/value.cc | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/control.cc b/src/control.cc index bcbae4a5..21a2fe4b 100644 --- a/src/control.cc +++ b/src/control.cc @@ -169,7 +169,7 @@ AbstractNode *ControlModule::instantiate(const Context* /*ctx*/, const ModuleIns switch (this->type) { case CHILD: { - printDeprecation("DEPRECATED: child() will be removed in future releases. Use children() instead."); + printDeprecation("child() will be removed in future releases. Use children() instead."); int n = 0; if (evalctx->numArgs() > 0) { double v; diff --git a/src/import.cc b/src/import.cc index ddc4a950..1f1686d2 100644 --- a/src/import.cc +++ b/src/import.cc @@ -95,7 +95,7 @@ AbstractNode *ImportModule::instantiate(const Context *ctx, const ModuleInstanti if (v->isUndefined()) { v = c.lookup_variable("filename"); if (!v->isUndefined()) { - printDeprecation("DEPRECATED: filename= is deprecated. Please use file="); + printDeprecation("filename= is deprecated. Please use file="); } } std::string filename = lookup_file(v->isUndefined() ? "" : v->toString(), inst->path(), ctx->documentPath()); @@ -119,7 +119,7 @@ AbstractNode *ImportModule::instantiate(const Context *ctx, const ModuleInstanti if (layerval.isUndefined()) { layerval = *c.lookup_variable("layername"); if (!layerval.isUndefined()) { - printDeprecation("DEPRECATED: layername= is deprecated. Please use layer="); + printDeprecation("layername= is deprecated. Please use layer="); } } node->layername = layerval.isUndefined() ? "" : layerval.toString(); diff --git a/src/linearextrude.cc b/src/linearextrude.cc index e535c28d..cddbc314 100644 --- a/src/linearextrude.cc +++ b/src/linearextrude.cc @@ -75,7 +75,7 @@ AbstractNode *LinearExtrudeModule::instantiate(const Context *ctx, const ModuleI ValuePtr slices = c.lookup_variable("slices", true); if (!file->isUndefined() && file->type() == Value::STRING) { - printDeprecation("DEPRECATED: Support for reading files in linear_extrude will be removed in future releases. Use a child import() instead."); + printDeprecation("Support for reading files in linear_extrude will be removed in future releases. Use a child import() instead."); node->filename = lookup_file(file->toString(), inst->path(), c.documentPath()); } diff --git a/src/mainwin.cc b/src/mainwin.cc index 2011a433..e19ebaee 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -2614,7 +2614,7 @@ void MainWindow::consoleOutput(const std::string &msg, void *userdata) // originates in a worker thread. MainWindow *thisp = static_cast(userdata); QString qmsg = QString::fromUtf8(msg.c_str()); - if (qmsg.startsWith("WARNING:")) { + if (qmsg.startsWith("WARNING:") || qmsg.startsWith("DEPRECATED:")) { thisp->compileWarnings++; qmsg = "" + qmsg + ""; } else if (qmsg.startsWith("ERROR:")) { diff --git a/src/openscad.cc b/src/openscad.cc index ab7e3acf..9f28ea9e 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -830,12 +830,12 @@ int main(int argc, char **argv) output_file = vm["o"].as().c_str(); } if (vm.count("s")) { - printDeprecation("DEPRECATED: The -s option is deprecated. Use -o instead.\n"); + printDeprecation("The -s option is deprecated. Use -o instead.\n"); if (output_file) help(argv[0], true); output_file = vm["s"].as().c_str(); } if (vm.count("x")) { - printDeprecation("DEPRECATED: The -x option is deprecated. Use -o instead.\n"); + printDeprecation("The -x option is deprecated. Use -o instead.\n"); if (output_file) help(argv[0], true); output_file = vm["x"].as().c_str(); } diff --git a/src/primitives.cc b/src/primitives.cc index 5381db8c..0727c7aa 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -245,7 +245,7 @@ AbstractNode *PrimitiveModule::instantiate(const Context *ctx, const ModuleInsta // backwards compatible node->faces = c.lookup_variable("triangles", true); if (node->faces->type() != Value::UNDEFINED) { - printDeprecation("DEPRECATED: polyhedron(triangles=[]) will be removed in future releases. Use polyhedron(faces=[]) instead."); + printDeprecation("polyhedron(triangles=[]) will be removed in future releases. Use polyhedron(faces=[]) instead."); } } break; diff --git a/src/printutils.cc b/src/printutils.cc index 4e400ccb..7098fd1a 100644 --- a/src/printutils.cc +++ b/src/printutils.cc @@ -114,8 +114,9 @@ std::set printedDeprecations; void printDeprecation(const std::string &str) { if (printedDeprecations.find(str) == printedDeprecations.end()) { - PRINT(str); printedDeprecations.insert(str); + std::string msg = "DEPRECATED: " + str; + PRINT(msg); } } diff --git a/src/rotateextrude.cc b/src/rotateextrude.cc index 700fb7c9..48b029a6 100644 --- a/src/rotateextrude.cc +++ b/src/rotateextrude.cc @@ -69,7 +69,7 @@ AbstractNode *RotateExtrudeModule::instantiate(const Context *ctx, const ModuleI ValuePtr scale = c.lookup_variable("scale", true); if (!file->isUndefined()) { - printDeprecation("DEPRECATED: Support for reading files in rotate_extrude will be removed in future releases. Use a child import() instead."); + printDeprecation("Support for reading files in rotate_extrude will be removed in future releases. Use a child import() instead."); node->filename = lookup_file(file->toString(), inst->path(), c.documentPath()); } diff --git a/src/value.cc b/src/value.cc index 4723b611..f519948c 100644 --- a/src/value.cc +++ b/src/value.cc @@ -707,7 +707,7 @@ Value Value::operator[](const Value &v) const void Value::RangeType::normalize() { if ((step_val>0) && (end_val < begin_val)) { std::swap(begin_val,end_val); - printDeprecation("DEPRECATED: Using ranges of the form [begin:end] with begin value greater than the end value is deprecated."); + printDeprecation("Using ranges of the form [begin:end] with begin value greater than the end value is deprecated."); } }