1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-07-10 09:08:37 +00:00
Files
UXP/security/nss/coreconf/werror.py
T
wolfbeast d36d4eb674 Update NSS to 3.38
- Added HACL*Poly1305 32-bit (INRIA/Microsoft)
- Updated to final TLS 1.3 draft version (28)
- Removed TLS 1.3 prerelease draft limit check
- Removed NPN code
- Enabled dev/urandom-only RNG on Linux with NSS_SEED_ONLY_DEV_URANDOM for non-standard environments
- Fixed several bugs with TLS 1.3 negotiation
- Updated internal certificate store
- Added support for the TLS Record Size Limit Extension.
- Fixed CVE-2018-0495
- Various security fixes in the ASN.1 code.
2019-02-16 00:11:10 +08:00

61 lines
1.8 KiB
Python

#!/usr/bin/env python
import os
import subprocess
def main():
cc = os.environ.get('CC', 'cc')
sink = open(os.devnull, 'wb')
try:
cc_is_clang = 'clang' in subprocess.check_output(
[cc, '--version'], universal_newlines=True, stderr=sink)
except OSError:
# We probably just don't have CC/cc.
return
def warning_supported(warning):
return subprocess.call([cc, '-x', 'c', '-E', '-Werror',
'-W%s' % warning, os.devnull], stdout=sink, stderr=sink) == 0
def can_enable():
# This would be a problem
if not warning_supported('all'):
return False
# If we aren't clang, make sure we have gcc 4.8 at least
if not cc_is_clang:
try:
v = subprocess.check_output([cc, '-dumpversion'], stderr=sink).decode("utf-8")
v = v.strip(' \r\n').split('.')
v = list(map(int, v))
if v[0] < 4 or (v[0] == 4 and v[1] < 8):
# gcc 4.8 minimum
return False
except OSError:
return False
return True
if not can_enable():
print('-DNSS_NO_GCC48')
return
print('-Werror')
print('-Wall')
def set_warning(warning, contra=''):
if warning_supported(warning):
print('-W%s%s' % (contra, warning))
if cc_is_clang:
# clang is unable to handle glib's expansion of strcmp and similar for
# optimized builds, so disable the resulting errors.
# See https://llvm.org/bugs/show_bug.cgi?id=20144
for w in ['array-bounds', 'unevaluated-expression',
'parentheses-equality']:
set_warning(w, 'no-')
print('-Qunused-arguments')
set_warning('shadow')
if __name__ == '__main__':
main()