aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Felt <aixtools@users.noreply.github.com>2019-11-24 17:17:09 +0100
committerAlex Gaynor <alex.gaynor@gmail.com>2019-11-24 11:17:09 -0500
commite45fd8040f4352ff97431cffc8d1da9f19ea6d8e (patch)
tree115165fa30923f6e1f105d0f32014b269dcb7141 /src
parent7247665f76cf849fb5b3020a28cfc86c400374cc (diff)
downloadcryptography-e45fd8040f4352ff97431cffc8d1da9f19ea6d8e.tar.gz
cryptography-e45fd8040f4352ff97431cffc8d1da9f19ea6d8e.tar.bz2
cryptography-e45fd8040f4352ff97431cffc8d1da9f19ea6d8e.zip
issue-5041: do not add extra flags when compiler or platform does not support them (#5042)
* check for suitable compiler (platform) before adding special flags * pep8 corrections * later pep8 messages * add clang to auto accepted compilers * modify syntax so multi-line is accepted
Diffstat (limited to 'src')
-rw-r--r--src/_cffi_src/build_openssl.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py
index d3d27df6..1740cc59 100644
--- a/src/_cffi_src/build_openssl.py
+++ b/src/_cffi_src/build_openssl.py
@@ -6,6 +6,9 @@ from __future__ import absolute_import, division, print_function
import os
import sys
+from distutils import dist
+from distutils.ccompiler import get_default_compiler
+from distutils.command.config import config
from _cffi_src.utils import (
build_ffi_for_binding, compiler_type, extra_link_args
@@ -47,7 +50,16 @@ def _extra_compile_args(platform):
When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can
revisit this.
"""
- if platform not in ["win32", "hp-ux11", "sunos5"]:
+ # make sure the compiler used supports the flags to be added
+ is_gcc = False
+ if get_default_compiler() == "unix":
+ d = dist.Distribution()
+ cmd = config(d)
+ cmd._check_compiler()
+ is_gcc = ("gcc" in cmd.compiler.compiler[0] or
+ "clang" in cmd.compiler.compiler[0])
+ if is_gcc or not (platform in ["win32", "hp-ux11", "sunos5"] or
+ platform.startswith("aix")):
return ["-Wconversion", "-Wno-error=sign-conversion"]
else:
return []