Changeset c621f4aa in mainline for tools


Ignore:
Timestamp:
2010-07-25T10:11:13Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
377cce8
Parents:
24a2517 (diff), a2da43c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with mainline.

Location:
tools
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • tools/checkers/stanse.py

    r24a2517 rc621f4aa  
    7474                srcfname = arg[0]
    7575                tgtfname = arg[1]
     76                tool = arg[2]
     77                category = arg[3]
    7678                base = arg[4]
    7779                options = arg[5]
     
    8385               
    8486                # Only C files are interesting for us
    85                 if (arg[2] != "cc"):
     87                if (tool != "cc"):
    8688                        continue
    8789               
  • tools/checkers/vcc.py

    r24a2517 rc621f4aa  
    3636import subprocess
    3737import jobfile
     38import re
    3839
    3940jobs = [
    40         "kernel/kernel.job",
    41         "uspace/srv/clip/clip.job"
     41        "kernel/kernel.job"
    4242]
     43
     44re_attribute = re.compile("__attribute__\s*\(\(.*\)\)")
     45re_va_list = re.compile("__builtin_va_list")
     46
     47specification = ""
    4348
    4449def usage(prname):
    4550        "Print usage syntax"
    46         print prname + " <ROOT>"
     51        print prname + " <ROOT> [VCC_PATH]"
    4752
    4853def cygpath(upath):
     
    5459        "Preprocess source using GCC preprocessor and compatibility tweaks"
    5560       
     61        global specification
     62       
    5663        args = ['gcc', '-E']
    5764        args.extend(options.split())
    58         args.append(srcfname)
     65        args.extend(['-DCONFIG_VERIFY_VCC=1', srcfname])
    5966       
    6067        # Change working directory
     
    6673       
    6774        tmpf = file(tmpfname, "w")
     75        tmpf.write(specification)
    6876       
    6977        for line in preproc.splitlines():
     78               
    7079                # Ignore preprocessor directives
     80               
    7181                if (line.startswith('#')):
    72                         continue       
     82                        continue
     83               
     84                # Remove __attribute__((.*)) GCC extension
     85               
     86                line = re.sub(re_attribute, "", line)
     87               
     88                # Ignore unsupported __builtin_va_list type
     89                # (a better solution replacing __builrin_va_list with
     90                # an emulated implementation is needed)
     91               
     92                line = re.sub(re_va_list, "void *", line)
    7393               
    7494                tmpf.write("%s\n" % line)
     
    80100        return True
    81101
    82 def vcc(root, job):
     102def vcc(vcc_path, root, job):
    83103        "Run Vcc on a jobfile"
    84104       
     
    107127                srcfname = arg[0]
    108128                tgtfname = arg[1]
     129                tool = arg[2]
     130                category = arg[3]
    109131                base = arg[4]
    110132                options = arg[5]
     
    118140                tmpfqname = os.path.join(base, tmpfname)
    119141               
     142                vccfname = "%s.i" % srcfname
     143                vccfqname = os.path.join(base, vccfname);
     144               
    120145                # Only C files are interesting for us
    121                 if (arg[2] != "cc"):
     146                if (tool != "cc"):
    122147                        continue
    123148               
     
    128153               
    129154                # Run Vcc
    130                
    131                 retval = subprocess.Popen(['vcc', cygpath(tmpfqname)]).wait()
    132                
    133                 # Cleanup
     155                print " -- %s --" % srcfname           
     156                retval = subprocess.Popen([vcc_path, '/pointersize:32', '/newsyntax', cygpath(tmpfqname)]).wait()
     157               
     158                if (retval != 0):
     159                        return False
     160               
     161                # Cleanup, but only if verification was successful
     162                # (to be able to examine the preprocessed file)
    134163               
    135164                if (os.path.isfile(tmpfqname)):
    136165                        os.remove(tmpfqname)
    137                
    138                 if (retval != 0):
    139                         return False
     166                        os.remove(vccfqname)
    140167       
    141168        return True
    142169
    143170def main():
     171        global specification
     172       
    144173        if (len(sys.argv) < 2):
    145174                usage(sys.argv[0])
     
    147176       
    148177        rootdir = os.path.abspath(sys.argv[1])
     178        if (len(sys.argv) > 2):
     179                vcc_path = sys.argv[2]
     180        else:
     181                vcc_path = "/cygdrive/c/Program Files (x86)/Microsoft Research/Vcc/Binaries/vcc"
     182       
     183        if (not os.path.isfile(vcc_path)):
     184                print "%s is not a binary." % vcc_path
     185                print "Please supply the full Cygwin path to Vcc as the second argument."
     186                return
     187       
    149188        config = os.path.join(rootdir, "HelenOS.config")
    150189       
     
    154193                return
    155194       
     195        specpath = os.path.join(rootdir, "tools/checkers/vcc.h")
     196        if (not os.path.isfile(specpath)):
     197                print "%s not found." % config
     198                return
     199       
     200        specfile = file(specpath, "r")
     201        specification = specfile.read()
     202        specfile.close()
     203       
    156204        for job in jobs:
    157                 if (not vcc(rootdir, job)):
     205                if (not vcc(vcc_path, rootdir, job)):
    158206                        print
    159207                        print "Failed job: %s" % job
  • tools/config.py

    r24a2517 rc621f4aa  
    2828# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929#
     30
    3031"""
    3132HelenOS configuration system
    3233"""
     34
    3335import sys
    3436import os
     
    4143MAKEFILE = 'Makefile.config'
    4244MACROS = 'config.h'
    43 DEFS = 'config.defs'
    4445PRECONF = 'defaults'
    4546
     
    223224        return True
    224225
    225 def create_output(mkname, mcname, dfname, defaults, ask_names):
     226def create_output(mkname, mcname, defaults, ask_names):
    226227        "Create output configuration"
    227228       
     
    229230       
    230231        sys.stderr.write("Fetching current revision identifier ... ")
    231         version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].split(':')
    232         sys.stderr.write("OK\n")
     232       
     233        try:
     234                version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].split(':')
     235                sys.stderr.write("ok\n")
     236        except:
     237                version = [1, "unknown", "unknown"]
     238                sys.stderr.write("failed\n")
    233239       
    234240        if (len(version) == 3):
     
    242248        outmk = file(mkname, 'w')
    243249        outmc = file(mcname, 'w')
    244         outdf = file(dfname, 'w')
    245250       
    246251        outmk.write('#########################################\n')
     
    252257        outmc.write(' ***************************************/\n\n')
    253258       
    254         outdf.write('#########################################\n')
    255         outdf.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
    256         outdf.write('#########################################\n\n')
    257         outdf.write('CONFIG_DEFS =')
     259        defs = 'CONFIG_DEFS ='
    258260       
    259261        for varname, vartype, name, choices, cond in ask_names:
     
    273275                        if (default == "y"):
    274276                                outmc.write('/* %s */\n#define %s\n\n' % (name, varname))
    275                                 outdf.write(' -D%s' % varname)
     277                                defs += ' -D%s' % varname
    276278                else:
    277279                        outmc.write('/* %s */\n#define %s %s\n#define %s_%s\n\n' % (name, varname, default, varname, default))
    278                         outdf.write(' -D%s=%s -D%s_%s' % (varname, default, varname, default))
     280                        defs += ' -D%s=%s -D%s_%s' % (varname, default, varname, default)
    279281       
    280282        if (revision is not None):
    281283                outmk.write('REVISION = %s\n' % revision)
    282284                outmc.write('#define REVISION %s\n' % revision)
    283                 outdf.write(' "-DREVISION=%s"' % revision)
     285                defs += ' "-DREVISION=%s"' % revision
    284286       
    285287        outmk.write('TIMESTAMP = %s\n' % timestamp)
    286288        outmc.write('#define TIMESTAMP %s\n' % timestamp)
    287         outdf.write(' "-DTIMESTAMP=%s"\n' % timestamp)
     289        defs += ' "-DTIMESTAMP=%s"\n' % timestamp
     290       
     291        outmk.write(defs)
    288292       
    289293        outmk.close()
    290294        outmc.close()
    291         outdf.close()
    292295
    293296def sorted_dir(root):
     
    348351        if ((len(sys.argv) >= 3) and (sys.argv[2] == 'default')):
    349352                if (check_choices(defaults, ask_names)):
    350                         create_output(MAKEFILE, MACROS, DEFS, defaults, ask_names)
     353                        create_output(MAKEFILE, MACROS, defaults, ask_names)
    351354                        return 0
    352355       
     
    466469                xtui.screen_done(screen)
    467470       
    468         create_output(MAKEFILE, MACROS, DEFS, defaults, ask_names)
     471        create_output(MAKEFILE, MACROS, defaults, ask_names)
    469472        return 0
    470473
  • tools/jobfile.py

    r24a2517 rc621f4aa  
    2727# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828#
     29
    2930"""
    3031Add a source/object file pair to a checker jobfile
  • tools/mkfat.py

    r24a2517 rc621f4aa  
    2727# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828#
     29
    2930"""
    3031FAT creator
  • tools/mkhord.py

    r24a2517 rc621f4aa  
    2727# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828#
     29
    2930"""
    3031HORD encapsulator
  • tools/mktmpfs.py

    r24a2517 rc621f4aa  
    2727# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828#
     29
    2930"""
    3031TMPFS creator
  • tools/toolchain.sh

    r24a2517 rc621f4aa  
    142142       
    143143        BINUTILS_VERSION="2.20"
    144         GCC_VERSION="4.4.3"
     144        GCC_VERSION="4.5.0"
    145145       
    146146        BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2"
     
    165165        echo ">>> Downloading tarballs"
    166166        download_check "${BINUTILS_SOURCE}" "${BINUTILS}" "ee2d3e996e9a2d669808713360fa96f8"
    167         download_check "${GCC_SOURCE}" "${GCC_CORE}" "054b66f315b3d04ad06544ce26e72365"
    168         download_check "${GCC_SOURCE}" "${GCC_OBJC}" "34711c4de46eaf79aa018206dbec4389"
    169         download_check "${GCC_SOURCE}" "${GCC_CPP}" "cd179ec4f05ee17ce76464da25a2674c"
     167        download_check "${GCC_SOURCE}" "${GCC_CORE}" "58eda33c3184303628f91c42a7ab15b5"
     168        download_check "${GCC_SOURCE}" "${GCC_OBJC}" "8d8c01b6631b020cc6c167860fde2398"
     169        download_check "${GCC_SOURCE}" "${GCC_CPP}" "5ab93605af40def4844eda09ca769c2d"
    170170       
    171171        echo ">>> Removing previous content"
     
    196196        cd "${OBJDIR}"
    197197        check_error $? "Change directory failed."
    198         "${GCCDIR}/configure" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib --disable-libgcj --without-headers --disable-shared
     198        "${GCCDIR}/configure" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib --disable-libgcj --without-headers --disable-shared --enable-lto
    199199        check_error $? "Error configuring GCC."
    200200        PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
Note: See TracChangeset for help on using the changeset viewer.