[PATCHv3 2/5] gdb: make struct output_source_filename_data more C++ like
Tom de Vries
tdevries@suse.de
Mon Jul 5 12:31:22 GMT 2021
On 6/7/21 8:32 PM, Andrew Burgess wrote:
> +bool
> +info_sources_filter::matches (const char *fullname) const
> +{
> + /* Does it match regexp? */
> + if (m_c_regexp.has_value ())
> + {
> + const char *to_match;
> + std::string dirname;
> +
> + switch (m_match_type)
> + {
> + case match_on::DIRNAME:
> + dirname = ldirname (fullname);
> + to_match = dirname.c_str ();
> + break;
> + case match_on::BASENAME:
> + to_match = lbasename (fullname);
> + break;
> + case match_on::FULLNAME:
> + to_match = fullname;
> + break;
> + }
> +
> + if (m_c_regexp->exec (to_match, 0, NULL, 0) != 0)
> + return false;
> + }
> +
> + return true;
> +}
When compiling with -O2, I run into:
...
src/gdb/symtab.c: In member function ‘bool
info_sources_filter::matches(const char*) const’:
src/gdb/symtab.c:4247:28: warning: ‘to_match’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
4247 | if (m_c_regexp->exec (to_match, 0, NULL, 0) != 0)
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
...
Thanks,
- Tom
More information about the Gdb-patches
mailing list