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

g++ error with -Wextra when compiling protobuf #2425

Closed
LevIserovich opened this issue Nov 29, 2016 · 2 comments
Closed

g++ error with -Wextra when compiling protobuf #2425

LevIserovich opened this issue Nov 29, 2016 · 2 comments
Assignees

Comments

@LevIserovich
Copy link

LevIserovich commented Nov 29, 2016

When turning on extra warnings (-Wextra) and enabling warnings as errors (-Werror) protobuf3 map implementation hits a G++ (version 5.2.0, on Linux) error on the following line

include/google/protobuf/map.h|677 col 31| error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
|| value_type* const value() const { return v_; }
|| ^
|| cc1plus: all warnings being treated as errors

The problem with that line is that it's making the pointer itself const, not the value pointed to.
That's what G++ complains about.

Example to reproduce:

#include <include/protobuf/map.h>
int main () { return 0; }

And compile with
g++ -Wextra -Werror file.cpp

The fix should be to either remove that 'const' keyword, as it does nothing, or if const-ness of the pointed value is desired, change it to:

const value_type * value() const { return v_; }

@freitass
Copy link

👍

@CHRISANDROID00
Copy link

0
down vote
you can try this gcc command utility on github , it basically expand the debugg info for c++ debugging . Here is the link its a executable file called TESTZ.CPP

works with many parameters

https://github.com/CHRISANDROID00/virtual-coder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants