Gmock doesn't build with -pedantic under gcc

432 views
Skip to first unread message

Vladimír Třebický

unread,
Oct 7, 2010, 4:06:47 AM10/7/10
to googl...@googlegroups.com
Hi guys,

thanks for such a great library! I'm really suprised to be the first
one reporting this (or just don't know how to google). Anyway, it
seems that gmock generates lots of warnings when built with gcc
-pedantic. Depending on the standard used:

cc1plus: warnings being treated as errors
/home/spunt/svn/gmock/src/gtest/include/gtest/gtest-typed-test.h:239:46:
error: anonymous variadic macros were introduced in C99
In file included from /home/spunt/svn/gmock/src/include/gmock/gmock.h:58,
from src/test/be795.cpp:4:
/home/spunt/svn/gmock/src/include/gmock/gmock-actions.h:116:52: error:
invoking macro GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ a gument
2: empty macro arguments are undefined in ISO C90 and ISO C++98
In file included from /home/spunt/svn/gmock/src/include/gmock/gmock.h:60,
from src/test/be795.cpp:4:
/home/spunt/svn/gmock/src/include/gmock/gmock-generated-actions.h:2267:1:
error: invoking macro GMOCK_CONCAT_TOKEN_IMPL_ argument 2: empty macro
arguments are undefined in ISO C90 and ISO C++98
...

Or eg. with -std=c++0x:

cc1plus: warnings being treated as errors
In file included from
/home/spunt/svn/gmock/src/include/gmock/gmock-printers.h:103,
from
/home/spunt/svn/gmock/src/include/gmock/gmock-actions.h:46,
from /home/spunt/svn/gmock/src/include/gmock/gmock.h:58,
from src/test/be795.cpp:4:
/home/spunt/svn/gmock/src/include/gmock/internal/gmock-internal-utils.h:465:
error: comma at end of enumerator list

gmock version used: 1.5.0

Ofc it's not critical but it'd be nice to have it fixed.

Thanks,
Vladimir.

Vlad Losev

unread,
Oct 22, 2010, 12:40:39 AM10/22/10
to Vladimír Třebický, googl...@googlegroups.com
Hi Vladimír,

2010/10/7 Vladimír Třebický <vladimir...@gmail.com>
I have fixed the last warning in r503, but I don't think we can do much about variadic macros. They are essential for typed tests, and you can only get rid of the warning if you disable them.


Thanks,
Vladimir.

Regards,
Vlad

teich...@gmail.com

unread,
May 7, 2014, 8:17:39 AM5/7/14
to googl...@googlegroups.com, Vladimír Třebický
Hi @all,

can you please give me a hint on how to compile with gcc -pedantic -std=c++98 anyway? (I work in a big project and it would be a mayor drawback to remove global compilation settings.)


I have fixed the last warning in r503, but I don't think we can do much about variadic macros. They are essential for typed tests, and you can only get rid of the warning if you disable them.

So far, I found out that I can suppress some warnings with -Wno-variadic-macros, however, I can't seem to find out how to suppress the other warning mentioned above: 'empty macro arguments are undefined in ISO C90 and ISO C++98'

I have studied the gcc warning options and the change that introduced the warning.

Some help would be highly appretiated.

Kind regards,
Timm
Reply all
Reply to author
Forward
0 new messages