[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46849] Shadowing warning on every command for
From: |
Richard |
Subject: |
[Octave-bug-tracker] [bug #46849] Shadowing warning on every command for function in +package directory |
Date: |
Mon, 14 May 2018 09:41:35 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36 |
Follow-up Comment #2, bug #46849 (project octave):
I modified load-path.cc around line 1686 to check for a '+' in the first
character of the directory name when deciding whether the function is shadowed
like this:
symbol_table& symtab
= __get_symbol_table__
("load_path::package_info::add_to_fcn_map");
// check it is not a package directory
std::string last_dir_name;
std::size_t lastDirPos = dir_name.find_last_of("/");
if (lastDirPos == std::string::npos)
{
// make sure there's something to test
last_dir_name = "-";
}
else
{
last_dir_name = dir_name.substr(lastDirPos+1,
dir_name.length()-1);
}
if (last_dir_name[0] != '+')
{
if (symtab.is_built_in_function_name (base))
{
std::string fcn_path = sys::file_ops::concat
(dir_name, fname);
warning_with_id ("Octave:shadowed-function",
"function %s shadows a built-in
function",
fcn_path.c_str ());
}
}
And the warnings went away, no doubt this is not the best way to fix this
though.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46849>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/