[PATCH v1 3/3] rld-dwarf.cpp: Initialize member variables

Ryan Long ryan.long at oarcorp.com
Thu Sep 2 14:08:15 UTC 2021


I remember prototyped_ being one that the issue was complaining about, but I can't remember the others. I just went ahead and added the rest of the member variables because Coverity doesn't always identify all the subsequent issues.

-----Original Message-----
From: Chris Johns <chrisj at rtems.org> 
Sent: Wednesday, September 1, 2021 10:01 PM
To: Ryan Long <ryan.long at oarcorp.com>; devel at rtems.org
Subject: Re: [PATCH v1 3/3] rld-dwarf.cpp: Initialize member variables

On 25/8/21 3:12 am, Ryan Long wrote:
> Initialize member variables not listed.
> 
> CID 1503019: Uninitialized scalar field.
> 
> Closes #4500
> ---
>  rtemstoolkit/rld-dwarf.cpp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/rtemstoolkit/rld-dwarf.cpp b/rtemstoolkit/rld-dwarf.cpp 
> index 1eae50c..2d6f306 100644
> --- a/rtemstoolkit/rld-dwarf.cpp
> +++ b/rtemstoolkit/rld-dwarf.cpp
> @@ -679,12 +679,18 @@ namespace rld
>          machine_code_ (false),
>          external_ (false),
>          declaration_ (false),
> +        prototyped_ (false),
>          inline_ (DW_INL_not_inlined),
>          entry_pc_ (0),
>          has_entry_pc_ (false),
>          pc_low_ (0),
>          pc_high_ (0),
>          ranges_ (debug),
> +        name_ (),
> +        linkage_name_ (),

Did coverity ask for this to be added? Why do default constructors need to be added?

Chris

> +        decl_file_ (),
> +        decl_line_ (0),
> +        call_file_ (),
>          call_line_ (0)
>      {
>        dwarf_bool db;
> @@ -819,6 +825,7 @@ namespace rld
>          machine_code_ (orig.machine_code_),
>          external_ (orig.external_),
>          declaration_ (orig.declaration_),
> +        prototyped_ (orig.prototyped_),
>          inline_ (orig.inline_),
>          entry_pc_ (orig.entry_pc_),
>          has_entry_pc_ (orig.has_entry_pc_), @@ -827,6 +834,8 @@ 
> namespace rld
>          ranges_ (orig.ranges_),
>          name_ (orig.name_),
>          linkage_name_ (orig.linkage_name_),
> +        decl_file_ (orig.decl_file_),
> +        decl_line_ (orig.decl_line_),
>          call_file_ (orig.call_file_),
>          call_line_ (orig.call_line_)
>      {
> @@ -986,7 +995,10 @@ namespace rld
>          ranges_ = rhs.ranges_;
>          name_ = rhs.name_;
>          linkage_name_ = rhs.linkage_name_;
> +        decl_file_ = rhs.decl_file_;
> +        decl_line_ = rhs.decl_line_;
>          call_file_ = rhs.call_file_;
> +        call_line_ = rhs.call_line_;
>        }
>        return *this;
>      }
> 


More information about the devel mailing list