#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012 The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms with or without
# modification are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS“
# AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE
# IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL
# EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE DATA OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY
# WHETHER IN CONTRACT STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 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([
“return_address.c:63“
“hid-appleir.c:347“
“hid-magicmouse.c:580“
“hid-ntrig.c:1026“
“core.c:1334“
“menu.c:129“
“bus.c:318“ # FIXME
“atags_to_fdt.c:96“
])
# 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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 161792 2013-05-03 17:13 bin\adb.exe
文件 96256 2013-05-03 17:13 bin\AdbWinApi.dll
文件 60928 2013-05-03 17:13 bin\AdbWinUsbApi.dll
文件 230400 2014-07-08 14:27 bin\AFPTool.exe
文件 16384 2013-05-03 17:13 bin\bmptoppm.exe
文件 10543133 2013-06-16 12:57 bin\cc1.exe
文件 41720 2012-04-29 04:39 bin\convert.exe
文件 124430 2013-05-03 17:13 bin\cpio.exe
文件 33758 2013-05-03 17:13 bin\cramfsck.exe
文件 84509 2013-04-04 17:32 bin\cygaa-1.dll
文件 35869 2013-07-14 01:51 bin\cygamd-0.dll
文件 38414 2011-04-14 05:37 bin\cygao-4.dll
文件 116765 2013-06-24 01:07 bin\cygapr-1-0.dll
文件 119837 2013-08-12 02:57 bin\cygaprutil-1-0.dll
文件 226318 2010-04-13 09:48 bin\cygarchive-2.dll
文件 38429 2013-07-23 22:35 bin\cygargp-0.dll
文件 6670 2011-10-16 14:55 bin\cygasprintf-0.dll
文件 18973 2012-10-26 04:38 bin\cygasyncns-0.dll
文件 115741 2013-08-05 13:58 bin\cygatk-1.0-0.dll
文件 156701 2013-08-05 18:36 bin\cygatk-bridge-2.0-0.dll
文件 128541 2013-08-05 18:29 bin\cygatspi-0.dll
文件 13838 2012-05-04 19:39 bin\cygattr-1.dll
文件 72718 2011-06-30 18:42 bin\cygaudio-2.dll
文件 185885 2013-04-08 15:56 bin\cygaudiofile-1.dll
文件 171037 2013-04-28 01:06 bin\cygautotrace-3.dll
文件 56861 2013-01-23 11:07 bin\cygavahi-client-3.dll
文件 38941 2013-01-23 11:07 bin\cygavahi-common-3.dll
文件 174109 2013-01-23 11:07 bin\cygavahi-core-7.dll
文件 10781 2013-01-23 11:07 bin\cygavahi-glib-1.dll
文件 34845 2013-01-23 11:07 bin\cygavahi-gob
............此处省略669个文件信息