comparison libinterp/corefcn/variables.cc @ 20831:35241c4b696c

eliminate return statements after calls to error * Cell.cc, __ichol__.cc, __lin_interpn__.cc, __pchip_deriv__.cc, besselj.cc, cellfun.cc, colloc.cc, debug.cc, dlmread.cc, dynamic-ld.cc, filter.cc, find.cc, gl2ps-renderer.cc, load-path.cc, load-save.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-text.cc, luinc.cc, max.cc, nproc.cc, oct-hist.cc, oct-map.cc, oct-obj.cc, oct-stream.cc, ordschur.cc, pinv.cc, pr-output.cc, profiler.cc, psi.cc, quadcc.cc, qz.cc, rand.cc, strfind.cc, strfns.cc, sysdep.cc, toplev.cc, tril.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc: Eliminate return statements after calls to error.
author John W. Eaton <jwe@octave.org>
date Wed, 09 Dec 2015 14:00:43 -0500
parents f428cbe7576f
children 1142cf6abc0d
comparison
equal deleted inserted replaced
20830:ae0bd73671f3 20831:35241c4b696c
161 if (parse_status == 0) 161 if (parse_status == 0)
162 { 162 {
163 retval = is_valid_function (fname, warn_for, 0); 163 retval = is_valid_function (fname, warn_for, 0);
164 164
165 if (! retval) 165 if (! retval)
166 { 166 error ("%s: '%s' is not valid as a function",
167 error ("%s: '%s' is not valid as a function", 167 warn_for.c_str (), fname.c_str ());
168 warn_for.c_str (), fname.c_str ());
169 return retval;
170 }
171 168
172 warning ("%s: passing function body as a string is obsolete; please use anonymous functions", 169 warning ("%s: passing function body as a string is obsolete; please use anonymous functions",
173 warn_for.c_str ()); 170 warn_for.c_str ());
174 } 171 }
175 else 172 else
330 327
331 if (args.length () != 1) 328 if (args.length () != 1)
332 print_usage (); 329 print_usage ();
333 330
334 if (! args(0).is_string ()) 331 if (! args(0).is_string ())
335 { 332 error ("isglobal: NAME must be a string");
336 error ("isglobal: NAME must be a string");
337 return retval;
338 }
339 333
340 std::string name = args(0).string_value (); 334 std::string name = args(0).string_value ();
341 335
342 return symbol_table::is_global (name); 336 return symbol_table::is_global (name);
343 } 337 }
395 bool search_builtin = type == "builtin"; 389 bool search_builtin = type == "builtin";
396 bool search_class = type == "class"; 390 bool search_class = type == "class";
397 391
398 if (! (search_any || search_var || search_dir || search_file || 392 if (! (search_any || search_var || search_dir || search_file ||
399 search_builtin || search_class)) 393 search_builtin || search_class))
400 { 394 error ("exist: unrecognized type argument \"%s\"", type.c_str ());
401 error ("exist: unrecognized type argument \"%s\"", type.c_str ());
402 return 0;
403 }
404 395
405 if (search_any || search_var) 396 if (search_any || search_var)
406 { 397 {
407 octave_value val = symbol_table::varval (name); 398 octave_value val = symbol_table::varval (name);
408 399
1488 items = sscanf (cmd.c_str (), "%c%c%c:%d:%d:%d;", 1479 items = sscanf (cmd.c_str (), "%c%c%c:%d:%d:%d;",
1489 &garbage, &param.modifier, &param.command, 1480 &garbage, &param.modifier, &param.command,
1490 &a, &b, &balance) - 1; 1481 &a, &b, &balance) - 1;
1491 1482
1492 if (items < 2) 1483 if (items < 2)
1493 { 1484 error ("whos_line_format: parameter structure without command in whos_line_format");
1494 error ("whos_line_format: parameter structure without command in whos_line_format");
1495 error_encountered = true;
1496 }
1497 1485
1498 // Insert data into parameter 1486 // Insert data into parameter
1499 param.first_parameter_length = 0; 1487 param.first_parameter_length = 0;
1500 pos = param_string.find (param.command); 1488 pos = param_string.find (param.command);
1501 if (pos != std::string::npos) 1489 if (pos != std::string::npos)
1508 ? a : param.parameter_length); 1496 ? a : param.parameter_length);
1509 if (param.command == 's' && param.modifier == 'c' && b > 0) 1497 if (param.command == 's' && param.modifier == 'c' && b > 0)
1510 param.first_parameter_length = b; 1498 param.first_parameter_length = b;
1511 } 1499 }
1512 else 1500 else
1513 { 1501 error ("whos_line_format: '%c' is not a command",
1514 error ("whos_line_format: '%c' is not a command", 1502 param.command);
1515 param.command);
1516 error_encountered = true;
1517 }
1518 1503
1519 if (param.command == 's') 1504 if (param.command == 's')
1520 { 1505 {
1521 // Have to calculate space needed for printing 1506 // Have to calculate space needed for printing
1522 // matrix dimensions Space needed for Size column is 1507 // matrix dimensions Space needed for Size column is
1557 param.parameter_length = total; 1542 param.parameter_length = total;
1558 param.first_parameter_length = 0; 1543 param.first_parameter_length = 0;
1559 } 1544 }
1560 } 1545 }
1561 else if (param.modifier == 'c') 1546 else if (param.modifier == 'c')
1562 { 1547 error ("whos_line_format: modifier 'c' not available for command '%c'",
1563 error ("whos_line_format: modifier 'c' not available for command '%c'", 1548 param.command);
1564 param.command);
1565 error_encountered = true;
1566 }
1567 1549
1568 // What happens if whos_line_format contains negative numbers 1550 // What happens if whos_line_format contains negative numbers
1569 // at param_length positions? 1551 // at param_length positions?
1570 param.balance = (b < 0 ? 0 : param.balance); 1552 param.balance = (b < 0 ? 0 : param.balance);
1571 param.first_parameter_length = (b < 0 ? 0 : 1553 param.first_parameter_length = (b < 0 ? 0 :