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

warning: ignoring #pragma gcc diagnostic #600

Closed
DavidEGrayson opened this issue Mar 1, 2016 · 12 comments
Closed

warning: ignoring #pragma gcc diagnostic #600

DavidEGrayson opened this issue Mar 1, 2016 · 12 comments

Comments

@DavidEGrayson
Copy link
Contributor

Hi. I don't have time to look into this right now, but I just updated to Catch 1.3.5 and started getting this warning on every line of my test suite with CHECK or REQUIRE:

test.cpp:19:0: warning: ignoring #pragma gcc diagnostic [-Wunknown-pragmas]
             REQUIRE(1);

My GCC version is 5.3.0:

$ gcc -v
Using built-in specs.
COLLECT_GCC=D:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-5.3.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --with-gxx-include-dir=/mingw64/include/c++/5.3.0 --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 5.3.0 (Rev2, Built by MSYS2 project)

I am compiling with -Wall and -Wextra. I guess #pragma gcc diagnostic was removed from later versions of GCC and it would be nice if catch detected that and didn't use it.

@nabijaczleweli
Copy link
Contributor

Cannot reproduce on v1.3.5 with GCC 5.3.0

@DavidEGrayson
Copy link
Contributor Author

@nabijaczleweli Did you compile with -Wall -Wextra? Maybe try adding -pedantic as well. Sorry that I didn't post a minimal example. I can do that later.

@nabijaczleweli
Copy link
Contributor

Yes, I used all of those flags

@nabijaczleweli
Copy link
Contributor

d:\Catch>git log -1
commit ae5ee2cf63d6d67bd1369b512d2a7b60b571c907
Author: Phil Nash <[email protected]>
Date:   Mon Feb 29 08:17:18 2016 +0000

    v1.3.5

d:\Catch>cat a.cpp
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

TEST_CASE("blerb", "[blurb]") {
        REQUIRE( 1 );
}

d:\Catch>g++ -Wall -Wextra -pedantic a.cpp -Iinclude

d:\Catch>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=d:/Programy/Programowanie/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-5.3.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --with-gxx-include-dir=/mingw64/include/c++/5.3.0 --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 5.3.0 (Rev1, Built by MSYS2 project)

@sQu1rr
Copy link

sQu1rr commented Mar 1, 2016

Same here, error: ignoring #pragma gcc diagnostic [-Werror=unknown-pragmas]. v1.3.4 doesn't have it

@GatoRat
Copy link

GatoRat commented Mar 2, 2016

I just ran into this as well. I put on -Wno-unknown-pragmas to shut it up for now. (I tried to track it down to no avail.)

@DavidEGrayson
Copy link
Contributor Author

You need to use --std=gnu++11 and -Wall to reproduce the issue.

Here is my code:

#include "Catch-1.3.5/single_include/catch.hpp"

void foo()
{
    REQUIRE(1 == 2);
}

Here is the shell session reproducing the issue:

$ g++ -v
Using built-in specs.
COLLECT_GCC=D:\msys64\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-5.3.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --with-gxx-include-dir=/mingw64/include/c++/5.3.0 --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 5.3.0 (Rev2, Built by MSYS2 project)

$ g++ -c --std=gnu++11 -Wall test.cpp
test.cpp:5:0: warning: ignoring #pragma gcc diagnostic [-Wunknown-pragmas]
     REQUIRE(1 == 2);

DavidEGrayson added a commit to DavidEGrayson/Catch that referenced this issue Mar 5, 2016
@philsquared
Copy link
Collaborator

Thanks David,

I've merged that PR locally and will get it pushed soon.
However I don't have the ability here to verify it. Obviously it's working for you. But has anyone else on this thread been able to try it?

@f-koehler
Copy link

I do have the problem locally (Arch Linux, GCC 5.3.0) and in Travis CI (using GCC 5.2.1). However @DavidEGrayson's patch resolves the issue. So @philsquared, I think it should be merged.

@philsquared
Copy link
Collaborator

Thanks @f-koelher.
I think that's all I need, really.

@philsquared
Copy link
Collaborator

Pushed. I forgot to mention this issue number.

@horenmar
Copy link
Member

horenmar commented Jan 6, 2017

Closing as resolved.

@horenmar horenmar closed this as completed Jan 6, 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

No branches or pull requests

7 participants