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

Compiling with -ansi -pedantic on Linux fails #334

Closed
GoogleCodeExporter opened this issue Jul 28, 2015 · 5 comments
Closed

Compiling with -ansi -pedantic on Linux fails #334

GoogleCodeExporter opened this issue Jul 28, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link
Contributor

Compiling gtest and using it with -ansi -pedantic won't compile on Linux.

What steps will reproduce the problem?
1. CXXFLAGS="-ansi -pedantic" ./configure
2. make
3.

What is the expected output? What do you see instead?
It fails with:
g++ -DHAVE_CONFIG_H -I. -I./build-aux -I. -I./include -pthread 
-DGTEST_HAS_PTHREAD=1 -ansi -pedantic -MT src/gtest-all.lo -MD -MP -MF 
src/.deps/gtest-all.Tpo -c src/gtest-all.cc  -fPIC -DPIC -o 
src/.libs/gtest-all.o
In file included from ./include/gtest/gtest.h:64,
                 from src/gtest-all.cc:39:
./include/gtest/gtest-typed-test.h:239:46: warning: anonymous variadic macros 
were introduced in C99
In file included from ./include/gtest/internal/gtest-internal.h:40,
                 from ./include/gtest/gtest.h:57,
                 from src/gtest-all.cc:39:
./include/gtest/internal/gtest-port.h:1260: error: ISO C++ 1998 does not 
support ‘long long’
./include/gtest/internal/gtest-port.h:1448: error: ISO C++ 1998 does not 
support ‘long long’
./include/gtest/internal/gtest-port.h:1449: error: ISO C++ 1998 does not 
support ‘long long’
In file included from ./src/gtest.cc:128,
                 from src/gtest-all.cc:42:
./src/gtest-internal-inl.h: In function ‘bool 
testing::internal::ParseNaturalNumber(const std::string&, Integer*)’:
./src/gtest-internal-inl.h:1030: error: ISO C++ 1998 does not support ‘long 
long’
make: *** [src/gtest-all.lo] Error 1


What version of Google Test are you using? On what operating system?
gtest1.5 on Linux

$ g++ --version
g++ (Debian 4.3.2-1.1) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.

The attached simple patch fixes the problem.

Original issue reported on code.google.com by jens.k.mueller@gmail.com on 22 Nov 2010 at 1:22

Attachments:

@marlowa
Copy link

marlowa commented Oct 1, 2018

I am also seeing this issue. It is because when -pedantic is used the C++98 compiler is not allowed to use preprocessor features from C99. That includes the feature of anonymous variadic macros.

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

No branches or pull requests

3 participants