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

VLOG and gcc with -pedantic #31

Closed
GoogleCodeExporter opened this issue Jan 28, 2016 · 2 comments
Closed

VLOG and gcc with -pedantic #31

GoogleCodeExporter opened this issue Jan 28, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

I'm trying to write code that is as compliant as possible. That's why I
always compile with -ansi and -pedantic.
But the attached program won't compile. Since LOG works as expected I'm
rather confused that it does not work with VLOG.

What steps will reproduce the problem?
1. Try compiling the attached program

I used
g++ -ansi -Wno-long-long -pedantic -I<path to glog include> -L<path to glog
lib> -lglog vlog.cc

What is the expected output? What do you see instead?
It should compile it. Bit instead you get the error
vlog.cc:11: error: ISO C++ forbids braced-groups within expressions
from g++.

What version of the product are you using? On what operating system?
I'm using version 0.3.0 on Debian Linux.
$ g++ --version
g++ (Debian 4.3.2-1.1) 4.3.2

As a workaround one can remove -pedantic.

Regards

Original issue reported on code.google.com by jens.k.mueller@gmail.com on 22 Jan 2010 at 11:05

Attachments:

@GoogleCodeExporter
Copy link
Author

The macro VLOG* uses the macro VLOG_IS_ON which has a braced-group within 
expression
(http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Statement-Exprs.html#Statement-Expr
s). I
I don't know whether it is possible to write this macro without braced-group. 
That
would fix the problem. At the moment instead of not using -pedantic one can do
__extension__ VLOG_IF(10, (0 == 1))
              << "test";
to disable pedantic warnings for the following expression.
I haven't found a gcc option to disable those warnings in general.

Original comment by jens.k.mueller@gmail.com on 25 Mar 2010 at 12:54

@GoogleCodeExporter
Copy link
Author

Fixed in http://code.google.com/p/google-glog/source/detail?r=82

Thanks for your report and suggesting __extension__ !

Original comment by shinichi...@gmail.com on 28 May 2010 at 3:36

  • Changed state: Fixed

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

1 participant