diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-06-26 15:07:48 -1000 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2017-06-26 21:07:48 -0400 |
commit | 62c3421a73053af5cf09d110f927632dd19f00aa (patch) | |
tree | b7160115209be11da6a113bea1e46bdc245f82e4 /src/_cffi_src/build_openssl.py | |
parent | caad666d34835265b9ebf9bb57d0ef53691c6388 (diff) | |
download | cryptography-62c3421a73053af5cf09d110f927632dd19f00aa.tar.gz cryptography-62c3421a73053af5cf09d110f927632dd19f00aa.tar.bz2 cryptography-62c3421a73053af5cf09d110f927632dd19f00aa.zip |
enable wconversion and finish fixes (#3728)
* enable wconversion and finish fixes
* don't pass -Wconversion if it's win32
Diffstat (limited to 'src/_cffi_src/build_openssl.py')
-rw-r--r-- | src/_cffi_src/build_openssl.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py index 853f4488..86ee5007 100644 --- a/src/_cffi_src/build_openssl.py +++ b/src/_cffi_src/build_openssl.py @@ -36,6 +36,22 @@ def _get_openssl_libraries(platform): return ["ssl", "crypto"] +def _extra_compile_args(platform): + """ + We set -Wconversion args here so that we only do Wconversion checks on the + code we're compiling and not on cffi itself (as passing -Wconversion in + CFLAGS would do). We set no error on sign conversion because some + function signatures in OpenSSL have changed from long -> unsigned long + in the past. Since that isn't a precision issue we don't care. + When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can + revisit this. + """ + if platform != "win32": + return ["-Wconversion", "-Wno-error=sign-conversion"] + else: + return [] + + ffi = build_ffi_for_binding( module_name="_openssl", module_prefix="_cffi_src.openssl.", @@ -79,5 +95,13 @@ ffi = build_ffi_for_binding( "callbacks", ], libraries=_get_openssl_libraries(sys.platform), + # These args are passed here so that we only do Wconversion checks on the + # code we're compiling and not on cffi itself (as passing -Wconversion in + # CFLAGS would do). We set no error on sign convesrion because some + # function signatures in OpenSSL have changed from long -> unsigned long + # in the past. Since that isn't a precision issue we don't care. + # When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can + # revisit this. + extra_compile_args=_extra_compile_args(sys.platform), extra_link_args=extra_link_args(compiler_type()), ) |