Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ed63298 in mainline


Ignore:
Timestamp:
2010-01-05T16:08:57Z (12 years ago)
Author:
U-ALPHA\Administrator <Administrator@…>
Branches:
lfn, master
Children:
b3d513f
Parents:
679c361
Message:

add more Vcc compatibility preprocessing (by Ondrej Sery)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/checkers/vcc.py

    r679c361 red63298  
    22#
    33# Copyright (c) 2010 Martin Decky
     4# Copyright (c) 2010 Ondrej Sery
    45# All rights reserved.
    56#
     
    5152
    5253def preprocess(srcfname, tmpfname, base, options):
    53         "Preprocess source using GCC preprocessor"
     54        "Preprocess source using GCC preprocessor and compatibility tweaks"
    5455       
    5556        args = ['gcc', '-E']
    5657        args.extend(options.split())
    57         args.extend(['-o', tmpfname, srcfname])
     58        args.append(srcfname)
     59       
     60        # Change working directory
    5861       
    5962        cwd = os.getcwd()
    6063        os.chdir(base)
    61         retval = subprocess.Popen(args).wait()
     64       
     65        preproc = subprocess.Popen(args, stdout = subprocess.PIPE).communicate()[0]
     66       
     67        tmpf = file(tmpfname, "w")
     68       
     69        for line in preproc.splitlines():
     70                # Ignore preprocessor directives
     71                if (line.startswith('#')):
     72                        continue       
     73               
     74                tmpf.write("%s\n" % line)
     75       
     76        tmpf.close()
     77       
    6278        os.chdir(cwd)
    63        
    64         if (retval != 0):
    65                 return False
    6679       
    6780        return True
Note: See TracChangeset for help on using the changeset viewer.