[dpdk-dev] buildtools: zero elf info variable in pmdinfogen

Message ID 1504616613-46803-1-git-send-email-harry.van.haaren@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Van Haaren, Harry Sept. 5, 2017, 1:03 p.m. UTC
  This commit zeros out the elf_info struct at startup of the
pmdinfogen code. If it is not zeroed, later in the code gcc
produces "may be unused" prints. Clang does not report any
issue.

This commit enables a simplification in the meson build
system, removing the requirement for "-Wno-maybe-uninitialized".

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---

 buildtools/pmdinfogen/pmdinfogen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Bruce Richardson Sept. 5, 2017, 1:18 p.m. UTC | #1
On Tue, Sep 05, 2017 at 02:03:33PM +0100, Harry van Haaren wrote:
> This commit zeros out the elf_info struct at startup of the
> pmdinfogen code. If it is not zeroed, later in the code gcc
> produces "may be unused" prints. Clang does not report any
> issue.
> 
> This commit enables a simplification in the meson build
> system, removing the requirement for "-Wno-maybe-uninitialized".
> 
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

It's worth adding to the commit message that this error only shows up in
optimized builds, which is why the warning is not disabled by default in
the existing makefile.

> ---
> 
>  buildtools/pmdinfogen/pmdinfogen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c
> index ba1a12e..e73fc76 100644
> --- a/buildtools/pmdinfogen/pmdinfogen.c
> +++ b/buildtools/pmdinfogen/pmdinfogen.c
> @@ -397,7 +397,7 @@ static void output_pmd_info_string(struct elf_info *info, char *outfile)
>  
>  int main(int argc, char **argv)
>  {
> -	struct elf_info info;
> +	struct elf_info info = {0};
>  	int rc = 1;
>  
>  	if (argc < 3) {
> -- 
> 2.7.4
>
  

Patch

diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c
index ba1a12e..e73fc76 100644
--- a/buildtools/pmdinfogen/pmdinfogen.c
+++ b/buildtools/pmdinfogen/pmdinfogen.c
@@ -397,7 +397,7 @@  static void output_pmd_info_string(struct elf_info *info, char *outfile)
 
 int main(int argc, char **argv)
 {
-	struct elf_info info;
+	struct elf_info info = {0};
 	int rc = 1;
 
 	if (argc < 3) {