Changeset 2ce23a3 in rtems-tools


Ignore:
Timestamp:
Aug 1, 2014, 6:47:11 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, master
Children:
ea29902
Parents:
427acf3
Message:

Fix building on Windows with the latest MSVC.

Remove some warnings.

Location:
linkers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • linkers/rld-files.cpp

    r427acf3 r2ce23a3  
    2626#include <string.h>
    2727#include <sys/stat.h>
     28#include <unistd.h>
    2829
    2930#include <rld.h>
  • linkers/rld-outputter.cpp

    r427acf3 r2ce23a3  
    4545  namespace outputter
    4646  {
     47    int unlink (const char* path)
     48    {
     49#if _WIN32
     50      return ::remove(path);
     51#else
     52      return ::unlink (path);
     53#endif
     54    }
     55
     56    int link (const char* path1, const char* path2)
     57    {
     58#if _WIN32
     59      return ::rename(path1, path2);
     60#else
     61      return ::link (path1, path2);
     62#endif
     63    }
     64
    4765    const std::string
    4866    script_text (const std::string&        entry,
     
    260278        if (ra_exist)
    261279        {
    262           std::string new_name = "rld_XXXXXX";
    263           struct stat sb;
     280          std::string    new_name = "rld_XXXXXX";
    264281          files::archive arch (new_name);
     282          struct stat    sb;
     283
    265284          arch.create (objects);
    266285
    267286          if ((::stat (name.c_str (), &sb) >= 0) && S_ISREG (sb.st_mode))
    268287          {
    269             if (::unlink (name.c_str ()) < 0)
     288            if (unlink (name.c_str ()) < 0)
    270289              std::cerr << "error: unlinking temp file: " << name << std::endl;
    271290          }
    272           if (::link (new_name.c_str (), name.c_str ()) < 0)
     291          if (link (new_name.c_str (), name.c_str ()) < 0)
    273292          {
    274293            std::cerr << "error: linking temp file: " << name << std::endl;
     
    276295          if ((::stat (new_name.c_str (), &sb) >= 0) && S_ISREG (sb.st_mode))
    277296          {
    278             if (::unlink (new_name.c_str ()) < 0)
     297            if (unlink (new_name.c_str ()) < 0)
    279298              std::cerr << "error: unlinking temp file: " << new_name << std::endl;
    280299          }
  • linkers/rld-process.cpp

    r427acf3 r2ce23a3  
    11/*
    2  * Copyright (c) 2011, Chris Johns <chrisj@rtems.org> 
     2 * Copyright (c) 2011, Chris Johns <chrisj@rtems.org>
    33 *
    44 * Permission to use, copy, modify, and/or distribute this software for any
    55 * purpose with or without fee is hereby granted, provided that the above
    66 * copyright notice and this permission notice appear in all copies.
    7  * 
     7 *
    88 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    99 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     
    2424#include <string.h>
    2525#include <sys/stat.h>
     26#include <unistd.h>
    2627
    2728#ifdef HAVE_SYS_WAIT_H
     
    6768      clean_up ();
    6869    }
    69    
     70
    7071    const std::string
    7172    temporary_files::get ()
     
    8990      if ((::stat (name.c_str (), &sb) >= 0) && S_ISREG (sb.st_mode))
    9091      {
    91         if (::unlink (name.c_str ()) < 0)
     92        int r;
     93#if _WIN32
     94        r = ::remove(name.c_str ());
     95#else
     96        r = ::unlink (name.c_str ());
     97#endif
     98        if (r < 0)
    9299        {
    93100          std::cerr << "error: unlinking temp file: " << name << std::endl;
     
    160167    }
    161168
    162     const std::string& 
     169    const std::string&
    163170    tempfile::name () const
    164171    {
     
    175182      if (::stat (_name.c_str (), &sb) == 0)
    176183        return sb.st_size;
    177      
     184
    178185      return 0;
    179186    }
     
    243250
    244251    void
    245     tempfile::output (const std::string& prefix, 
     252    tempfile::output (const std::string& prefix,
    246253                      std::ostream&      out,
    247254                      bool               line_numbers)
     
    269276
    270277    status
    271     execute (const std::string& pname, 
     278    execute (const std::string& pname,
    272279             const std::string& command,
    273280             const std::string& outname,
     
    280287
    281288    status
    282     execute (const std::string&   pname, 
     289    execute (const std::string&   pname,
    283290             const arg_container& args,
    284291             const std::string&   outname,
     
    346353      else
    347354        throw rld::error ("execute: " + args[0], "unknown status returned");
    348          
     355
    349356      return _status;
    350357    }
     
    365372
    366373      args.clear ();
    367      
     374
    368375      const char quote = '"';
    369376      const char escape = '\\';
Note: See TracChangeset for help on using the changeset viewer.