android_kernel_xiaomi_sm7250/scripts/gcc-wrapper.py
spakkkk 496d723f58 mass revert: clean
Revert "drivers: staging: Include qcacld-3.0 source"
Revert "qcacld: nuke Kconfig-based configuration entirely"
Revert "qcacld-3.0: Always force user build."
Revert "qcacld: drop -Werror"
Revert "qcacld-3.0: Fix MAC address fallback when generation fails"
Revert "qcacld-3.0: Discard wlan_boot sysfs code on !CONFIG_MODULES"
Revert "qcacld: nuke rx_wakelock code entirely"
Revert "qcacld-3.0: Defer HDD initialization and rely on userspace writing to /dev/wlan"
Revert "qcacld: disable debugging bloat as much as possible"
Revert "qcacld-3.0: Only call hdd_debugfs_process_mib_stats if debugfs is enabled."
Revert "qcacld-3.0: Fallback to default WCNSS config path for MIUI"
Revert "Revert "scripts: gcc-wrapper: Use wrapper to check compiler warnings""
Revert "build-dtbo: Support base dtbs which located in foreign folder"
Revert "dtbo.img: build device tree overlay partition image"
Revert "scripts: Makefile: suppress DTC compiler warnings"
Revert "scripts: use aosp python mkdtboimg for cmd_mkdtimg"
Revert ".gitignore: Exclude qcom devicetree from gitignore"
Revert "BACKPORT: scripts/dtc: Add yamltree.c to dtc sources"
Revert "BACKPORT: scripts/dtc: Update to upstream version v1.4.7-14-gc86da84d30e4"
Revert "BACKPORT: kbuild: consolidate Devicetree dtb build rules"
Revert "BACKPORT: scripts/dtc: Update to upstream version v1.4.7-57-gf267e674d145"
Revert "BACKPORT: of: add dtc annotations functionality to dtx_diff"
Revert "BACKPORT: treewide: prefix header search paths with $(srctree)/"
Revert "BACKPORT: scripts/dtc: Update to upstream version v1.5.0-23-g87963ee20693"
Revert "BACKPORT: scripts/dtc: Update to upstream version v1.5.0-30-g702c1b6c0e73"
Revert "BACKPORT: dtc: Use pkg-config to locate libyaml"
Revert "BACKPORT: scripts/dtc: only append to HOST_EXTRACFLAGS instead of overwriting"
2022-11-12 11:18:57 +00:00

76 lines
1.9 KiB
Python
Executable File

#! /usr/bin/env python2
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2011-2017, 2018 The Linux Foundation. All rights reserved.
# -*- coding: utf-8 -*-
# Invoke gcc, looking for warnings, and causing a failure if there are
# non-whitelisted warnings.
import errno
import re
import os
import sys
import subprocess
# Note that gcc uses unicode, which may depend on the locale. TODO:
# force LANG to be set to en_US.UTF-8 to get consistent warnings.
allowed_warnings = set([
"umid.c:138",
"umid.c:213",
"umid.c:388",
])
# Capture the name of the object file, can find it.
ofile = None
warning_re = re.compile(r'''(.*/|)([^/]+\.[a-z]+:\d+):(\d+:)? warning:''')
def interpret_warning(line):
"""Decode the message from gcc. The messages we care about have a filename, and a warning"""
line = line.rstrip('\n')
m = warning_re.match(line)
if m and m.group(2) not in allowed_warnings:
print "error, forbidden warning:", m.group(2)
# If there is a warning, remove any object if it exists.
if ofile:
try:
os.remove(ofile)
except OSError:
pass
sys.exit(1)
def run_gcc():
args = sys.argv[1:]
# Look for -o
try:
i = args.index('-o')
global ofile
ofile = args[i+1]
except (ValueError, IndexError):
pass
compiler = sys.argv[0]
try:
proc = subprocess.Popen(args, stderr=subprocess.PIPE)
for line in proc.stderr:
print line,
interpret_warning(line)
result = proc.wait()
except OSError as e:
result = e.errno
if result == errno.ENOENT:
print args[0] + ':',e.strerror
print 'Is your PATH set correctly?'
else:
print ' '.join(args), str(e)
return result
if __name__ == '__main__':
status = run_gcc()
sys.exit(status)