Treat deprecation as warning message (fixes #1143).

master
Torsten Paul 2015-01-07 17:05:31 +01:00
parent dda527dabd
commit da657d7543
9 changed files with 12 additions and 11 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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());
}

View File

@ -2614,7 +2614,7 @@ void MainWindow::consoleOutput(const std::string &msg, void *userdata)
// originates in a worker thread.
MainWindow *thisp = static_cast<MainWindow*>(userdata);
QString qmsg = QString::fromUtf8(msg.c_str());
if (qmsg.startsWith("WARNING:")) {
if (qmsg.startsWith("WARNING:") || qmsg.startsWith("DEPRECATED:")) {
thisp->compileWarnings++;
qmsg = "<html><span style=\"color: black; background-color: #ffffb0;\">" + qmsg + "</span></html>";
} else if (qmsg.startsWith("ERROR:")) {

View File

@ -830,12 +830,12 @@ int main(int argc, char **argv)
output_file = vm["o"].as<string>().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<string>().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<string>().c_str();
}

View File

@ -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;

View File

@ -114,8 +114,9 @@ std::set<std::string> 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);
}
}

View File

@ -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());
}

View File

@ -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.");
}
}