Skip to content

Fix maybe-uninitialized warning#245

Merged
sloretz merged 1 commit intomasterfrom
suppress_maybe_uninitialized
May 30, 2018
Merged

Fix maybe-uninitialized warning#245
sloretz merged 1 commit intomasterfrom
suppress_maybe_uninitialized

Conversation

@sloretz
Copy link
Copy Markdown
Contributor

@sloretz sloretz commented May 30, 2018

This suppresses an occurrance of a maybe-uninitialized warning on gcc 4.x. I don't see a warning using gcc 5.4

It seems to be a false positive. Searching for false positive maybe-uninitialized gcc bugs returns too many to reasonably search for a match. It's strange to me that the warning is not also present on lines 941, 921, 883, etc.

Build Status

In progress while CI runs

@sloretz sloretz added the in progress Actively being worked on (Kanban column) label May 30, 2018
@sloretz sloretz self-assigned this May 30, 2018
}
} else {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikaelarguedas
Copy link
Copy Markdown
Member

This suppresses an occurrance of a maybe-uninitialized warning on gcc 4.x

We target only platforms using gcc 5.4 at the moment.
I can reproduce the warning locally when building with the build type RelWithDebInfo, the same warning appears with gcc7.3.

It's strange to me that the warning is not also present on lines 941, 921, 883, etc.

Actually it seem to show up only on the last comparison of seq_data_type. When commenting out the case DATA_TYPE_STRING bloc, the warning then appears line 941. so it may be more robust to ignore the warning in the multiple places this comparison happen or to spend more time investigating how to fix it without ignoring it.

Regarding the patch, this should be applied only if _WIN32 is not defined like we do in other places

CI without and with this patch:

Without: Build Status
With: Build Status

@sloretz
Copy link
Copy Markdown
Contributor Author

sloretz commented May 30, 2018

We target only platforms using gcc 5.4 at the moment.

Ah. The console output of the aarch64 job has the line [WARNINGS] Parsing warnings in console log with parser GNU C Compiler 4 (gcc). Maybe that is the jenkins parser version instead of the gcc version?

@sloretz sloretz force-pushed the suppress_maybe_uninitialized branch from ec55617 to e4d68e4 Compare May 30, 2018 15:44
@sloretz
Copy link
Copy Markdown
Contributor Author

sloretz commented May 30, 2018

Thanks for the build type @mikaelarguedas. Fixed warning rather than suppressed it in e4d68e4

New CI (build up to and test only rcl_yaml_param_parser since this is a leaf package)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Cancelled macOS Build Status
  • Windows Build Status

@sloretz sloretz added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels May 30, 2018
@sloretz sloretz mentioned this pull request May 30, 2018
@sloretz sloretz changed the title Suppress maybe-uninitialized warning Fix maybe-uninitialized warning May 30, 2018
@mikaelarguedas
Copy link
Copy Markdown
Member

thanks @sloretz, this is a better resolution indeed 👍

Can you please run CI using the RelWithDebInfo build type instead of None?

@sloretz
Copy link
Copy Markdown
Contributor Author

sloretz commented May 30, 2018

Ooops. CI RelWithDebInfo

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Copy Markdown
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sloretz sloretz merged commit 95b4147 into master May 30, 2018
@sloretz sloretz deleted the suppress_maybe_uninitialized branch May 30, 2018 16:41
Karsten1987 pushed a commit that referenced this pull request Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review Waiting for review (Kanban column)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants