Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/checkers/clang.py

    ra35b458 r6582b36  
    4646def clang(root, job):
    4747        "Run Clang on a jobfile"
    48 
     48       
    4949        inname = os.path.join(root, job)
    50 
     50       
    5151        if (not os.path.isfile(inname)):
    5252                print("Unable to open %s" % inname)
    5353                print("Did you run \"make precheck\" on the source tree?")
    5454                return False
    55 
     55       
    5656        inf = open(inname, "r")
    5757        records = inf.read().splitlines()
    5858        inf.close()
    59 
     59       
    6060        for record in records:
    6161                arg = jobfile.parse_arg(record)
    6262                if (not arg):
    6363                        return False
    64 
     64               
    6565                if (len(arg) < 6):
    6666                        print("Not enough jobfile record arguments")
    6767                        return False
    68 
     68               
    6969                srcfname = arg[0]
    7070                tgtfname = arg[1]
     
    7373                base = arg[4]
    7474                options = arg[5].split()
    75 
     75               
    7676                srcfqname = os.path.join(base, srcfname)
    7777                if (not os.path.isfile(srcfqname)):
    7878                        print("Source %s not found" % srcfqname)
    7979                        return False
    80 
     80               
    8181                # Only C files are interesting for us
    8282                if (tool != "cc"):
    8383                        continue
    84 
     84               
    8585                args = ['clang', '-Qunused-arguments', '--analyze',
    8686                        '-Xanalyzer', '-analyzer-opt-analyze-headers',
     
    8888                args.extend(options)
    8989                args.extend(['-o', tgtfname, srcfname])
    90 
     90               
    9191                cwd = os.getcwd()
    9292                os.chdir(base)
    9393                retval = subprocess.Popen(args).wait()
    9494                os.chdir(cwd)
    95 
     95               
    9696                if (retval != 0):
    9797                        return False
    98 
     98               
    9999        return True
    100100
     
    103103                usage(sys.argv[0])
    104104                return
    105 
     105       
    106106        rootdir = os.path.abspath(sys.argv[1])
    107107        config = os.path.join(rootdir, "HelenOS.config")
    108 
     108       
    109109        if (not os.path.isfile(config)):
    110110                print("%s not found." % config)
    111111                print("Please specify the path to HelenOS build tree root as the first argument.")
    112112                return
    113 
     113       
    114114        for job in jobs:
    115115                if (not clang(rootdir, job)):
     
    117117                        print("Failed job: %s" % job)
    118118                        return
    119 
     119       
    120120        print
    121121        print("All jobs passed")
Note: See TracChangeset for help on using the changeset viewer.