Skip to content

Commit

Permalink
Add pragma against -Wconversion (ifsmirnov#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ifsmirnov committed Jun 9, 2018
1 parent 9963428 commit ca646e2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
4 changes: 4 additions & 0 deletions footer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma GCC diagnostic pop // -Wconversion
#if __clang__major >= 5
#pragma GCC diagnostic pop // -Wunused-lambda-capture
#endif
10 changes: 10 additions & 0 deletions header.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 14 additions & 0 deletions jngen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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

0 comments on commit ca646e2

Please sign in to comment.