Mercurial > octave
changeset 25342:416856765a55
be more careful with using auto in place of explicit const iterator decls
* dialog.cc, m-editor/file-editor.cc, octave-qt-link.cc,
call-stack.cc, debug.cc, genprops.awk, graphics.cc, gtk-manager.cc,
gtk-manager.h, load-path.cc, oct-map.cc, oct-stream.cc, regexp.cc,
symscope.h, symtab.h, variables.cc, ov-class.cc, ov-classdef.cc,
ov-fcn-handle.cc, ov-struct.cc, bp-table.cc, jit-ir.cc,
jit-typeinfo.cc, pt-jit.cc, lo-regexp.cc: Only replace explicit const
iterator decls with auto keyword if corresponding object is const.
Otherwise, tag with a fixme comment.
* lo-regexp.h (regexp::match_data::named_patterns): Now const.
line wrap: on
line diff
--- a/libgui/src/dialog.cc Wed May 02 14:33:52 2018 -0700 +++ b/libgui/src/dialog.cc Thu May 03 00:39:14 2018 -0400 @@ -230,8 +230,7 @@ selector = view->selectionModel (); int i = 0; - for (auto it = initial.begin (); - it != initial.end (); it++) + for (auto it = initial.begin (); it != initial.end (); it++) { QModelIndex idx = m_model->index (initial.value (i++) - 1, 0, QModelIndex ());
--- a/libgui/src/m-editor/file-editor.cc Wed May 02 14:33:52 2018 -0700 +++ b/libgui/src/m-editor/file-editor.cc Thu May 03 00:39:14 2018 -0400 @@ -321,7 +321,7 @@ // focus of the editor void file_editor::enable_menu_shortcuts (bool enable) { - auto i = m_hash_menu_text.constBegin (); + QHash<QMenu*, QStringList>::const_iterator i = m_hash_menu_text.constBegin (); while (i != m_hash_menu_text.constEnd ()) { @@ -377,7 +377,9 @@ QStringList fet_index; // save all open tabs before they are definitely closed - for (auto p = m_editor_tab_map.begin (); p != m_editor_tab_map.end (); p++) + // FIXME: use cbegin and auto decl here when available. + for (editor_tab_map_const_iterator p = m_editor_tab_map.begin (); + p != m_editor_tab_map.end (); p++) { QString file_name = p->first; // get file name of tab if (! file_name.isEmpty ()) // do not append unnamed files @@ -948,7 +950,8 @@ m_tmp_closed_files << ""; // no new name, just removing this file // Get and store the related encoding - for (auto p = m_editor_tab_map.begin (); + // FIXME: use cbegin and auto decl here when available. + for (editor_tab_map_const_iterator p = m_editor_tab_map.begin (); p != m_editor_tab_map.end (); p++) { if (editor_tab == p->second.fet_ID) @@ -2315,7 +2318,8 @@ emit fetab_file_name_query (nullptr); // Loop over all open files and pick those within old_dir - for (auto p = m_editor_tab_map.begin (); + // FIXME: use cbegin and auto decl here when available. + for (editor_tab_map_const_iterator p = m_editor_tab_map.begin (); p != m_editor_tab_map.end (); p++) { QString rel_path_to_file = old_dir.relativeFilePath (p->first); @@ -2366,7 +2370,8 @@ // Check all tabs for the given file name QWidget *retval = nullptr; - for (auto p = m_editor_tab_map.begin (); + // FIXME: use cbegin and auto decl here when available. + for (editor_tab_map_const_iterator p = m_editor_tab_map.begin (); p != m_editor_tab_map.end (); p++) { QString tab_file = p->first;
--- a/libgui/src/octave-qt-link.cc Wed May 02 14:33:52 2018 -0700 +++ b/libgui/src/octave-qt-link.cc Thu May 03 00:39:14 2018 -0400 @@ -332,7 +332,8 @@ retval.push_back (it->toStdString ()); retval.push_back (uiwidget_creator.get_dialog_path ()->toStdString ()); - retval.push_back ((QString ("%1").arg (uiwidget_creator.get_dialog_result ())).toStdString ()); + retval.push_back ((QString ("%1").arg ( + uiwidget_creator.get_dialog_result ())).toStdString ()); uiwidget_creator.unlock ();
--- a/libinterp/corefcn/call-stack.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/call-stack.cc Thu May 03 00:39:14 2018 -0400 @@ -137,7 +137,8 @@ size_t k = cs.size (); - for (auto p = cs.rbegin (); p != cs.rend (); p++) + // FIXME: use crend and auto decl here when available. + for (const_reverse_iterator p = cs.rbegin (); p != cs.rend (); p++) { octave_function *f = (*p).m_fcn; @@ -165,7 +166,8 @@ { octave_user_code *retval = nullptr; - auto p = cs.end (); + // FIXME: use cend and auto decl here when available. + const_iterator p = cs.end (); while (p != cs.begin ()) { @@ -193,7 +195,8 @@ { int retval = -1; - auto p = cs.end (); + // FIXME: use cend and auto decl here when available. + const_iterator p = cs.end (); while (p != cs.begin ()) { @@ -219,7 +222,8 @@ { int retval = -1; - auto p = cs.end (); + // FIXME: use cend and auto decl here when available. + const_iterator p = cs.end (); while (p != cs.begin ()) { @@ -335,7 +339,8 @@ { bool retval = true; - auto p = cs.end (); + // FIXME: use cend and auto decl here when available. + const_iterator p = cs.end (); while (p != cs.begin ()) { @@ -550,7 +555,8 @@ if (nframes > 0) { - for (auto p = cs.rbegin (); p != cs.rend (); p++) + // FIXME: use crbegin and auto decl here when available. + for (const_reverse_iterator p = cs.rbegin (); p != cs.rend (); p++) { const stack_frame& elt = *p;
--- a/libinterp/corefcn/debug.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/debug.cc Thu May 03 00:39:14 2018 -0400 @@ -66,7 +66,7 @@ for (size_t i = 0; i < line.size (); i++) { - auto p = line.find (i); + octave::bp_table::const_intmap_iterator p = line.find (i); if (p != line.end ()) { @@ -495,7 +495,7 @@ retmap.assign ("line", line); retmap.assign ("cond", cond); - octave_map ew = bptab.stop_on_err_warn_status (false); + const octave_map ew = bptab.stop_on_err_warn_status (false); if (ew.isempty ()) { retval = octave_value (retmap);
--- a/libinterp/corefcn/genprops.awk Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/genprops.awk Thu May 03 00:39:14 2018 -0400 @@ -677,7 +677,7 @@ printf ("%s::properties", class_name); printf ("::all_property_names (void) const\n{\n static std::set<std::string> all_pnames = core_property_names ();\n\n"); if (base) - printf (" std::set<std::string> retval = all_pnames;\n std::set<std::string> dyn_props = dynamic_property_names ();\n retval.insert (dyn_props.begin (), dyn_props.end ());\n for (auto p = all_props.begin ();\n p != all_props.end (); p++)\n retval.insert (p->first);\n\n return retval;\n}\n\n"); + printf (" std::set<std::string> retval = all_pnames;\n std::set<std::string> dyn_props = dynamic_property_names ();\n retval.insert (dyn_props.begin (), dyn_props.end ());\n for (std::map<caseless_str, property, cmp_caseless_str>::const_iterator p = all_props.begin ();\n p != all_props.end (); p++)\n retval.insert (p->first);\n\n return retval;\n}\n\n"); else printf (" std::set<std::string> retval = all_pnames;\n std::set<std::string> base_props = base_properties::all_property_names ();\n retval.insert (base_props.begin (), base_props.end ());\n\n return retval;\n}\n\n");
--- a/libinterp/corefcn/graphics.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/graphics.cc Thu May 03 00:39:14 2018 -0400 @@ -1915,7 +1915,8 @@ graphics_object go; - auto it = dprop_obj_map.find (go_name); + std::map<caseless_str, graphics_object>::const_iterator it = + dprop_obj_map.find (go_name); if (it == dprop_obj_map.end ()) { @@ -2295,13 +2296,13 @@ std::transform (pname.begin (), pname.end (), pname.begin (), tolower); - auto p = find (pfx); + plist_map_const_iterator p = find (pfx); if (p != end ()) { const pval_map_type& pval_map = p->second; - auto q = pval_map.find (pname); + pval_map_const_iterator q = pval_map.find (pname); if (q != pval_map.end ()) retval = q->second; @@ -3049,7 +3050,7 @@ { std::string go_name = graphics_object_name (); - auto plist = defaults.find (go_name); + property_list::plist_map_const_iterator plist = defaults.find (go_name); if (plist != defaults.end ()) { @@ -3090,7 +3091,8 @@ octave_value base_properties::get_dynamic (const caseless_str& pname) const { - auto it = all_props.find (pname); + std::map<caseless_str, property, cmp_caseless_str>::const_iterator it = + all_props.find (pname); if (it == all_props.end ()) error (R"(get: unknown property "%s")", pname.c_str ()); @@ -3103,7 +3105,8 @@ { octave_scalar_map m; - for (auto it = all_props.begin (); it != all_props.end (); ++it) + for (std::map<caseless_str, property, cmp_caseless_str>::const_iterator + it = all_props.begin (); it != all_props.end (); ++it) if (all || ! it->second.is_hidden ()) m.assign (it->second.get_name (), it->second.get ()); @@ -3146,7 +3149,8 @@ property base_properties::get_property_dynamic (const caseless_str& pname) { - auto it = all_props.find (pname); + std::map<caseless_str, property, cmp_caseless_str>::const_iterator it = + all_props.find (pname); if (it == all_props.end ()) error (R"(get_property: unknown property "%s")", pname.c_str ());
--- a/libinterp/corefcn/gtk-manager.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/gtk-manager.cc Thu May 03 00:39:14 2018 -0400 @@ -40,11 +40,11 @@ if (dtk.empty ()) error ("no graphics toolkits are available!"); - auto pl = loaded_toolkits.find (dtk); + const_loaded_toolkits_iterator pl = loaded_toolkits.find (dtk); if (pl == loaded_toolkits.end ()) { - auto pa = available_toolkits.find (dtk); + const_available_toolkits_iterator pa = available_toolkits.find (dtk); if (pa == available_toolkits.end ()) error ("default graphics toolkit '%s' is not available!", @@ -89,7 +89,8 @@ dtk.clear (); else { - auto pa = available_toolkits.begin (); + // FIXME: use cbegin and auto decl here when available. + const_available_toolkits_iterator pa = available_toolkits.begin (); dtk = *pa++;
--- a/libinterp/corefcn/gtk-manager.h Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/gtk-manager.h Thu May 03 00:39:14 2018 -0400 @@ -63,7 +63,7 @@ graphics_toolkit find_toolkit (const std::string& name) const { - auto p = loaded_toolkits.find (name); + const_loaded_toolkits_iterator p = loaded_toolkits.find (name); if (p != loaded_toolkits.end ()) return p->second;
--- a/libinterp/corefcn/load-path.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/load-path.cc Thu May 03 00:39:14 2018 -0400 @@ -747,7 +747,7 @@ { string_vector retval; - auto p = find_dir_info (dir); + const_dir_info_list_iterator p = find_dir_info (dir); if (p != dir_info_list.end ()) retval = p->fcn_files; @@ -852,7 +852,8 @@ { std::string dir = sys::file_ops::tilde_expand (dir_arg); - auto retval = dir_info_list.begin (); + // FIXME: use cbegin and auto decl here when available. + const_dir_info_list_iterator retval = dir_info_list.begin (); while (retval != dir_info_list.end ()) { @@ -1131,7 +1132,7 @@ { std::string abs_name = sys::env::make_absolute (dir_name); - auto p = abs_dir_cache.find (abs_name); + const_abs_dir_cache_iterator p = abs_dir_cache.find (abs_name); if (p != abs_dir_cache.end ()) { @@ -1190,7 +1191,7 @@ std::string name_head = name.substr (0, pos); std::string name_tail = name.substr (pos + 1); - auto it = package_dir_map.find (name_head); + const_package_dir_map_iterator it = package_dir_map.find (name_head); if (it != package_dir_map.end ()) return it->second.is_package (name_tail); @@ -1471,7 +1472,7 @@ { dir_name = ""; - auto p = fcn_map.find (fcn); + const_fcn_map_iterator p = fcn_map.find (fcn); if (p != fcn_map.end ()) { @@ -1505,13 +1506,13 @@ // update (); - auto q = private_fcn_map.find (dir); + const_private_fcn_map_iterator q = private_fcn_map.find (dir); if (q != private_fcn_map.end ()) { const dir_info::fcn_file_map_type& m = q->second; - auto p = m.find (fcn); + dir_info::const_fcn_file_map_iterator p = m.find (fcn); if (p != m.end ()) { @@ -1539,13 +1540,13 @@ dir_name = ""; - auto q = method_map.find (class_name); + const_method_map_iterator q = method_map.find (class_name); if (q != method_map.end ()) { const fcn_map_type& m = q->second; - auto p = m.find (meth); + const_fcn_map_iterator p = m.find (meth); if (p != m.end ()) { @@ -1579,7 +1580,7 @@ // update (); - auto mtd_map_it = method_map.find (class_name); + const_method_map_iterator mtd_map_it = method_map.find (class_name); if (mtd_map_it != method_map.end ()) {
--- a/libinterp/corefcn/oct-map.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/oct-map.cc Thu May 03 00:39:14 2018 -0400 @@ -1322,9 +1322,11 @@ { if (nfields () == rb.nfields ()) { - for (auto pa = begin (); pa != end (); pa++) + // FIXME: use cbegin and auto decl here when available. + for (const_iterator pa = begin (); pa != end (); pa++) { - auto pb = rb.seek (key (pa)); + // FIXME: use cbegin and auto decl here when available. + const_iterator pb = rb.seek (key (pa)); if (pb == rb.end ()) error ("field name mismatch in structure concatenation");
--- a/libinterp/corefcn/oct-stream.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/oct-stream.cc Thu May 03 00:39:14 2018 -0400 @@ -6312,7 +6312,9 @@ octave_idx_type j = 0; - for (auto it = input_buf_list.begin (); it != input_buf_list.end (); it++) + // FIXME: use cbegin and auto decl here when available. + for (std::list<void *>::const_iterator it = input_buf_list.begin (); + it != input_buf_list.end (); it++) { SRC_T *data = static_cast<SRC_T *> (*it); @@ -7357,7 +7359,7 @@ retval = lookup_cache->second; else { - auto iter = list.find (fid); + ostrl_map::const_iterator iter = list.find (fid); if (iter == list.end ()) err_invalid_file_id (fid, who); @@ -7474,7 +7476,7 @@ os = lookup_cache->second; else { - auto iter = list.find (fid); + ostrl_map::const_iterator iter = list.find (fid); if (iter == list.end ()) return retval;
--- a/libinterp/corefcn/regexp.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/regexp.cc Thu May 03 00:39:14 2018 -0400 @@ -374,7 +374,7 @@ bool extra_options = false; parse_options (options, args, who, 2, extra_options); - octave::regexp::match_data rx_lst + const octave::regexp::match_data rx_lst = octave::regexp::match (pattern, buffer, options, who); string_vector named_pats = rx_lst.named_patterns ();
--- a/libinterp/corefcn/symscope.h Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/symscope.h Thu May 03 00:39:14 2018 -0400 @@ -230,7 +230,7 @@ octave_value varval (const std::string& name) const { - auto p = m_symbols.find (name); + table_const_iterator p = m_symbols.find (name); return (p != m_symbols.end () ? p->second.varval (m_context) : octave_value ()); @@ -240,7 +240,7 @@ { bool retval = false; - auto p = m_symbols.find (name); + table_const_iterator p = m_symbols.find (name); if (p != m_symbols.end ()) { @@ -462,7 +462,7 @@ bool is_local_variable (const std::string& name) const { - auto p = m_symbols.find (name); + table_const_iterator p = m_symbols.find (name); return (p != m_symbols.end () && ! p->second.is_global () @@ -471,7 +471,7 @@ bool is_global (const std::string& name) const { - auto p = m_symbols.find (name); + table_const_iterator p = m_symbols.find (name); return p != m_symbols.end () && p->second.is_global (); }
--- a/libinterp/corefcn/symtab.h Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/symtab.h Thu May 03 00:39:14 2018 -0400 @@ -199,7 +199,7 @@ octave_value find_method (const std::string& name, const std::string& dispatch_type) { - auto p = m_fcn_table.find (name); + fcn_table_const_iterator p = m_fcn_table.find (name); if (p != m_fcn_table.end ()) { @@ -232,7 +232,7 @@ octave_value find_built_in_function (const std::string& name) { - auto p = m_fcn_table.find (name); + fcn_table_const_iterator p = m_fcn_table.find (name); return (p != m_fcn_table.end () ? p->second.find_built_in_function () : octave_value ()); @@ -640,7 +640,7 @@ { std::list<std::string> retval; - auto it = m_parent_map.find (dispatch_type); + const_parent_map_iterator it = m_parent_map.find (dispatch_type); if (it != m_parent_map.end ()) retval = it->second;
--- a/libinterp/corefcn/variables.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/corefcn/variables.cc Thu May 03 00:39:14 2018 -0400 @@ -1330,7 +1330,8 @@ Cell nesting_info (len, 1); Cell persistent_info (len, 1); - auto p = lst.begin (); + // FIXME: use cbegin and auto decl here when available. + std::list<symbol_info>::const_iterator p = lst.begin (); for (size_t j = 0; j < len; j++) {
--- a/libinterp/octave-value/ov-class.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/octave-value/ov-class.cc Thu May 03 00:39:14 2018 -0400 @@ -282,7 +282,7 @@ std::string nm = idx(0).xstring_value ("invalid index for class"); - auto p = my_map.seek (nm); + octave_map::const_iterator p = my_map.seek (nm); if (p == my_map.end ()) error ("class has no member '%s'", nm.c_str ()); @@ -846,7 +846,8 @@ size_t retval = 0; - for (auto it = map.begin (); it != map.end (); it++) + // FIXME: use cbegin and auto decl here when available. + for (octave_map::const_iterator it = map.begin (); it != map.end (); it++) { std::string key = map.key (it); @@ -896,7 +897,7 @@ { for (auto& par : parent_list) { - auto smap = map.seek (par); + octave_map::const_iterator smap = map.seek (par); const Cell& tmp = map.contents (smap); @@ -961,7 +962,7 @@ { for (auto& par : parent_list) { - auto smap = map.seek (par); + octave_map::const_iterator smap = map.seek (par); const Cell& tmp = map.contents (smap); @@ -1043,7 +1044,8 @@ { bool retval = false; - auto it = octave_class::exemplar_map.find (c_name); + octave_class::exemplar_const_iterator it + = octave_class::exemplar_map.find (c_name); if (it != octave_class::exemplar_map.end ()) retval = true; @@ -1123,7 +1125,8 @@ std::string dbgstr = "dork"; // First, check to see if there might be an issue with inheritance. - for (auto it = map.begin (); it != map.end (); it++) + // FIXME: use cbegin and auto decl here when available. + for (octave_map::const_iterator it = map.begin (); it != map.end (); it++) { std::string key = map.key (it); Cell val = map.contents (it); @@ -1141,7 +1144,8 @@ if (might_have_inheritance) { - auto it = octave_class::exemplar_map.find (c_name); + octave_class::exemplar_const_iterator it + = octave_class::exemplar_map.find (c_name); if (it == octave_class::exemplar_map.end ()) retval = false; @@ -1703,9 +1707,9 @@ if (nparents () != obj.nparents ()) error ("mismatch in number of parent classes"); - std::list<std::string> obj_parents + const std::list<std::string> obj_parents = obj.parent_class_name_list (); - std::list<std::string> pnames = parents (); + const std::list<std::string> pnames = parents (); auto p = obj_parents.begin (); auto q = pnames.begin (); @@ -1770,7 +1774,8 @@ retval = octave_value (new octave_class (m, id, parents)); } - auto it = octave_class::exemplar_map.find (id); + octave_class::exemplar_const_iterator it + = octave_class::exemplar_map.find (id); if (it == octave_class::exemplar_map.end ()) octave_class::exemplar_map[id] = octave_class::exemplar_info (retval);
--- a/libinterp/octave-value/ov-classdef.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/octave-value/ov-classdef.cc Thu May 03 00:39:14 2018 -0400 @@ -3339,9 +3339,7 @@ int i = 0; for (auto it = m.begin (); it != m.end (); ++it, ++i) - { - retval(i) = to_ov (it->second); - } + retval(i) = to_ov (it->second); return retval; } @@ -3841,7 +3839,8 @@ { cdef_package retval; - auto it = m_all_packages.find (name); + std::map<std::string, cdef_package>::const_iterator it + = m_all_packages.find (name); if (it != m_all_packages.end ()) {
--- a/libinterp/octave-value/ov-fcn-handle.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/octave-value/ov-fcn-handle.cc Thu May 03 00:39:14 2018 -0400 @@ -169,7 +169,7 @@ octave::symbol_table& symtab = octave::__get_symbol_table__ ("octave_fcn_handle::call"); - std::list<std::string> plist + const std::list<std::string> plist = symtab.parent_classes (dispatch_type); auto pit = plist.begin (); @@ -240,8 +240,9 @@ for (int i = 0; i < btyp_num_types && retval; i++) retval = builtin_overloads[i].is_copy_of (h.builtin_overloads[i]); - auto iter = overloads.begin (); - auto hiter = h.overloads.begin (); + // FIXME: use cbegin and auto decl here when available. + str_ov_map::const_iterator iter = overloads.begin (); + str_ov_map::const_iterator hiter = h.overloads.begin (); for (; iter != overloads.end () && retval; iter++, hiter++) retval = (iter->first == hiter->first) && (iter->second.is_copy_of (hiter->second));
--- a/libinterp/octave-value/ov-struct.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/octave-value/ov-struct.cc Thu May 03 00:39:14 2018 -0400 @@ -79,7 +79,7 @@ std::string nm = idx(0).string_value (); - auto p = map.seek (nm); + octave_map::const_iterator p = map.seek (nm); if (p != map.end ()) retval = map.contents (p); @@ -550,7 +550,8 @@ size_t retval = 0; - for (auto p = map.begin (); p != map.end (); p++) + // FIXME: use cbegin and auto decl here when available. + for (octave_map::const_iterator p = map.begin (); p != map.end (); p++) { std::string key = map.key (p); @@ -1264,7 +1265,8 @@ size_t retval = 0; - for (auto p = map.begin (); p != map.end (); p++) + // FIXME: use cbegin and auto decl here when available. + for (octave_map::const_iterator p = map.begin (); p != map.end (); p++) { std::string key = map.key (p);
--- a/libinterp/parse-tree/bp-table.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/parse-tree/bp-table.cc Thu May 03 00:39:14 2018 -0400 @@ -572,7 +572,7 @@ for (int i = 0; i < len; i++) { - auto m = line.find (i); + const_intmap_iterator m = line.find (i); if (m != line.end ()) { @@ -617,7 +617,7 @@ for (int i = 0; i < len; i++) { - auto p = line.find (i); + const_intmap_iterator p = line.find (i); if (p != line.end ()) { @@ -727,9 +727,12 @@ void bp_table::remove_all_breakpoints (void) { - // Odd loop structure required because delete will invalidate m_bp_set iterators - for (auto it = m_bp_set.begin (), it_next = it; - it != m_bp_set.end (); it = it_next) + // Odd loop structure required because delete will invalidate + // m_bp_set iterators. + // FIXME: use cbegin and auto decl here when available. + for (const_bp_set_iterator it = m_bp_set.begin (), it_next = it; + it != m_bp_set.end (); + it = it_next) { ++it_next; remove_all_breakpoints_in_file (*it);
--- a/libinterp/parse-tree/jit-ir.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/parse-tree/jit-ir.cc Thu May 03 00:39:14 2018 -0400 @@ -791,8 +791,8 @@ resize_arguments (m_contexts.size ()); size_t i; - for (auto iter = m_contexts.begin (), i = 0; - iter != m_contexts.end (); ++iter, ++i) + std::vector<context>::const_iterator iter; + for (iter = m_contexts.begin (), i = 0; iter != m_contexts.end (); ++iter, ++i) stash_argument (i, iter->m_value); }
--- a/libinterp/parse-tree/jit-typeinfo.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/parse-tree/jit-typeinfo.cc Thu May 03 00:39:14 2018 -0400 @@ -586,7 +586,9 @@ } } - for (auto iter = m_args.begin (); iter != m_args.end (); ++iter) + // FIXME: use cbegin and auto decl here when available. + for (std::vector<jit_type *>::const_iterator iter = m_args.begin (); + iter != m_args.end (); ++iter) { jit_type *ty = *iter; assert (ty); @@ -899,7 +901,7 @@ jit_operation::do_generate (const signature_vec& types) const { static jit_function null_overload; - auto find = m_generated.find (&types); + generated_map::const_iterator find = m_generated.find (&types); if (find != m_generated.end ()) { if (find->second) @@ -2033,7 +2035,7 @@ jit_type* jit_typeinfo::do_get_intN (size_t nbits) const { - auto iter = m_ints.find (nbits); + std::map<size_t, jit_type *>::const_iterator iter = m_ints.find (nbits); if (iter != m_ints.end ()) return iter->second;
--- a/libinterp/parse-tree/pt-jit.cc Wed May 02 14:33:52 2018 -0700 +++ b/libinterp/parse-tree/pt-jit.cc Thu May 03 00:39:14 2018 -0400 @@ -1755,7 +1755,10 @@ entry_block ().create_dom_tree (); // insert phi nodes where needed, this is done on a per variable basis - for (auto iter = m_vmap.begin (); iter != m_vmap.end (); ++iter) + // FIXME: use cbegin and auto decl here when available. + for (variable_map::const_iterator iter = m_vmap.begin (); + iter != m_vmap.end (); + ++iter) { jit_block::df_set visited, added_phi; std::list<jit_block *> ssa_worklist; @@ -1990,7 +1993,10 @@ jit_block *split = ablock.maybe_split (m_factory, m_blocks, final_block ()); jit_terminator *term = split->terminator (); - for (auto iter = temp.begin (); iter != temp.end (); ++iter) + // FIXME: use cbegin and auto decl here when available. + for (std::set<jit_value *>::const_iterator iter = temp.begin (); + iter != temp.end (); + ++iter) { jit_value *value = *iter; jit_call *release @@ -2822,7 +2828,7 @@ octave_value jit_info::find (const vmap& extra_vars, const std::string& vname) const { - auto iter = extra_vars.find (vname); + vmap::const_iterator iter = extra_vars.find (vname); if (iter == extra_vars.end ()) {
--- a/liboctave/util/lo-regexp.cc Wed May 02 14:33:52 2018 -0700 +++ b/liboctave/util/lo-regexp.cc Thu May 03 00:39:14 2018 -0400 @@ -459,7 +459,7 @@ { std::string retval; - regexp::match_data rx_lst = match (buffer); + const regexp::match_data rx_lst = match (buffer); size_t num_matches = rx_lst.size ();
--- a/liboctave/util/lo-regexp.h Wed May 02 14:33:52 2018 -0700 +++ b/liboctave/util/lo-regexp.h Thu May 03 00:39:14 2018 -0400 @@ -258,7 +258,7 @@ ~match_data (void) = default; - string_vector named_patterns (void) { return named_pats; } + string_vector named_patterns (void) const { return named_pats; } private: