From ca646e2f4df9b63c14380157d3911a0182149f94 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Sun, 10 Jun 2018 01:48:52 +0300 Subject: [PATCH] Add pragma against -Wconversion (#5) --- build.py | 2 ++ footer.h | 4 ++++ header.h | 10 ++++++++++ jngen.h | 14 ++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 footer.h diff --git a/build.py b/build.py index d20133c..4105796 100755 --- a/build.py +++ b/build.py @@ -81,6 +81,8 @@ def write_file(filename, stream): for h in LIBRARY_HEADERS: headers.update(extract_deps(h)) headers = ['header.h'] + sorted(headers) +deps['footer.h'] = set(headers + ['footer.h']) +headers += ['footer.h'] deps['header.h'] = set(('header.h',)) headers_in_order = [] diff --git a/footer.h b/footer.h new file mode 100644 index 0000000..1a23601 --- /dev/null +++ b/footer.h @@ -0,0 +1,4 @@ +#pragma GCC diagnostic pop // -Wconversion +#if __clang__major >= 5 +#pragma GCC diagnostic pop // -Wunused-lambda-capture +#endif diff --git a/header.h b/header.h index 229dacf..98878c2 100644 --- a/header.h +++ b/header.h @@ -29,3 +29,13 @@ */ #define JNGEN_VERSION 0.1 + +// https://github.com/ifsmirnov/jngen/issues/5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" + +// this warning is buggy in clang >= 5 +#if __clang_major__ >= 5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-lambda-capture" +#endif diff --git a/jngen.h b/jngen.h index c12a729..5cf478a 100644 --- a/jngen.h +++ b/jngen.h @@ -29,6 +29,16 @@ #define JNGEN_VERSION 0.1 +// https://github.com/ifsmirnov/jngen/issues/5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" + +// this warning is buggy in clang >= 5 +#if __clang_major__ >= 5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-lambda-capture" +#endif + #define JNGEN_DEFINE_CHAINING_TRAITS_FIELD(Class, name) \ int _ ## name = 0; \ Class& name(int val = 1) { _ ## name = val; return *this; } @@ -7276,3 +7286,7 @@ JNGEN_EXTERN TestSuites testSuites; } // namespace jngen using jngen::testSuites; +#pragma GCC diagnostic pop // -Wconversion +#if __clang__major >= 5 +#pragma GCC diagnostic pop // -Wunused-lambda-capture +#endif