Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove gcc 6 misleading indentations warnings #913

Conversation

Romain-Geissler
Copy link
Contributor

This removes some simple warnings that I hit when using Gmock with gcc6 and -Wall -Wextra -Werror.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@Romain-Geissler
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@Romain-Geissler Romain-Geissler force-pushed the fix-gcc-misleading-indentation-warning branch 2 times, most recently from f47d0bf to 4cadaf8 Compare October 21, 2016 21:08
@Romain-Geissler Romain-Geissler changed the title Remove gcc 6 misleading indentations. Remove gcc 6 misleading indentations warnings Oct 21, 2016
@Romain-Geissler-1A
Copy link
Contributor

Ping

@gennadiycivil
Copy link
Contributor

Thank you very much for this contribution. Please provide testing output that clearly demonstrates before/after.

@ghost ghost mentioned this pull request Sep 1, 2017
@Romain-Geissler-1A
Copy link
Contributor

Huh I am not sure to understand. Gcc emits indentation warnings, this is a stylish fix for something that gcc considers is error prone. The patch itself can be debated if you want, but I doubt any unittest will change anything in that matter, since this is a pure stylish fix.

@gennadiycivil
Copy link
Contributor

Hello. Just show the run before / after that's all, the warnings before and no warnings after, very simple

@Romain-Geissler-1A
Copy link
Contributor

I could find an old unpatched gtest library where we had the issue. When I build with gcc 6 -Wall -Werror -Wextra, I get:

/data3/mwrep/res/osp/Gmock/16-0-0-3/include/gmock/gmock-more-matchers.h: In member function ‘testing::internal::string testing::IsEmptyMatcher::gmock_Impl<arg_type>::FormatDescription(bool) const’:
/data3/mwrep/res/osp/Gmock/16-0-0-3/include/gmock/gmock-more-matchers.h:48:1: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
^~~~~~~
/data3/mwrep/res/osp/Gmock/16-0-0-3/include/gmock/gmock-more-matchers.h:48:1: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’

with the patch, this warning disappears.

@gennadiycivil
Copy link
Contributor

Thank you and sorry for the delay.
Could you please take a look at the style guide for conditionals.

@gennadiycivil
Copy link
Contributor

gennadiycivil commented Oct 25, 2017

@Romain-Geissler Romain-Geissler force-pushed the fix-gcc-misleading-indentation-warning branch from 501aa32 to 20e2de7 Compare October 25, 2017 15:53
@Romain-Geissler
Copy link
Contributor Author

Yep sorry for the delay.

I fixed the coding style, and regenerated the generated file with pump.py + rebased on top of current master.

@gennadiycivil gennadiycivil merged commit e93a15c into google:master Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants