1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

223 Commits

Author SHA1 Message Date
Chandler Carruth
345d3d0aaa Go through the really awkward dance required to delete the memory
allocated by setupterm. Without this, some folks are seeing leaked
memory whenever this routine is called more than once. Thanks to Craig
Topper for the report.

llvm-svn: 188615
2013-08-18 01:20:32 +00:00
Aaron Ballman
e6c86d2f70 Removing unused functionality.
llvm-svn: 188565
2013-08-16 17:33:57 +00:00
Benjamin Kramer
3078fbe0e8 GCC warns about removing const with a c-style cast.
llvm-svn: 188259
2013-08-13 09:57:55 +00:00
Chandler Carruth
ecf7881af3 Remove all checking for the various terminfo headers (term.h and
curses.h). Finding these headers is next to impossible. For example, on
Debian systems libtinfo-dev provides the terminfo reading library we
want, but *not* term.h. For the header, you have to use libncurses-dev.
And libncursesw-dev provides a *different* term.h in a different
location!

These headers aren't worth it. We want two functions the signatures of
which are clearly spec'ed in sys-v and other documentation. Just declare
them ourselves and call them. This should fix some debian builders and
provide better support for "minimal" debian systems that do want color
autodetection.

llvm-svn: 188165
2013-08-12 10:40:11 +00:00
Chandler Carruth
1ee1f67312 Target a minimal terminfo library rather than necessarily a full curses
library for color support detection. This still will use a curses
library if that is all we have available on the system. This change
tries to use a smaller subset of the curses library, specifically the
subset that is on some systems split off into a separate library. For
example, if you install ncurses configured --with-tinfo, a 'libtinfo' is
install that provides just the terminfo querying functionality. That
library is now used instead of curses when it is available.

This happens to fix a build error on systems with that library because
when we tried to link ncurses into the binary, we didn't pull tinfo in
as well. =]

It should also provide an easy path for supporting the NetBSD
libterminfo library, but as I don't have access to a NetBSD system I'm
leaving adding that support to those folks.

llvm-svn: 188160
2013-08-12 09:49:17 +00:00
Rafael Espindola
e297e56431 Check for $PWD in llvm::sys::current_path.
Some users (clang, libTooling) require this. After this patch we can remove
the calls to getenv("PWD") from clang.

llvm-svn: 188125
2013-08-10 00:50:57 +00:00
Chandler Carruth
0ac9f05175 Add support for linking against a curses library when available and
using it to detect whether or not a terminal supports colors. This
replaces a particularly egregious hack that merely compared the TERM
environment variable to "dumb". That doesn't really translate to
a reasonable experience for users that have actually ensured their
terminal's capabilities are accurately reflected.

This makes testing a terminal for color support somewhat more expensive,
but it is called very rarely anyways. The important fast path when the
output is being piped somewhere is already in place.

The global lock may seem excessive, but the spec for calling into curses
is *terrible*. The whole library is terrible, and I spent quite a bit of
time looking for a better way of doing this before convincing myself
that this was the fundamentally correct way to behave. The damage of the
curses library is very narrowly confined, and we continue to use raw
escape codes for actually manipulating the colors which is a much sane
system than directly using curses here (IMO).

If this causes trouble for folks, please let me know. I've tested it on
Linux and will watch the bots carefully. I've also worked to account for
the variances of curses interfaces that I could finde documentation for,
but that may not have been sufficient.

llvm-svn: 187874
2013-08-07 08:47:36 +00:00
Rafael Espindola
197ab4ef5c Make file_status::getUniqueID const.
llvm-svn: 187383
2013-07-29 21:55:38 +00:00
Rafael Espindola
2bf7932f99 Include st_dev to make the result of getUniqueID actually unique.
This will let us use getUniqueID instead of st_dev directly on clang.

llvm-svn: 187378
2013-07-29 21:26:49 +00:00
Rafael Espindola
326babb234 Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."
This reverts commit r187248. It broke many bots.

llvm-svn: 187254
2013-07-26 22:13:57 +00:00
Bill Schmidt
149eda1b1e [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.
Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for
all PowerPC targets, whether 32- or 64-bit.  They will both implicitly
define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not
for 32-bit targets.  We cannot be sure that all other possible
compilers used to compile Clang/LLVM define both __ppc__ and
__powerpc__, for example, so it is best to check for both when relying
on either inside the Clang/LLVM code base.

This patch makes sure we always check for both variants.  In addition,
it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp.
(At least one of __ppc__ and __powerpc__ should always be defined when
compiling for a PowerPC target, no matter which compiler is used, so
testing for them is unnecessary.)

There are some places in the compiler that check for other variants,
like __POWERPC__ and _POWER, and I have left those in place.  There is
no need to add them elsewhere.  This seems to be in Apple-specific
code, and I won't take a chance on breaking it.

There is no intended change in behavior; thus, no test cases are
added.

llvm-svn: 187248
2013-07-26 21:39:15 +00:00
Rafael Espindola
8c0a020996 Add missing 'n'.
Thanks to Han Finkel for noticing it.

llvm-svn: 187241
2013-07-26 20:44:45 +00:00
Reid Kleckner
221b8484c7 Remove dead or useless header checks from cmake and autoconf
On Windows, this improves clean cmake configuration time on my
workstation from 1m58s to 1m32s, which is pretty significant.  There's
probably more that can be done here, but this is the low hanging fruit.

Eric volunteered to regenerate ./configure for me.

llvm-svn: 187209
2013-07-26 16:54:23 +00:00
Rafael Espindola
2cff1f40dc Extend the lifetime of the strings passed to posix_spawn_file_actions_addopen.
Thanks to Hal Finkel for finding the bug and for the initial patch.

llvm-svn: 187208
2013-07-26 16:21:31 +00:00
Rafael Espindola
f40c5de45c Split openFileForWrite into windows and unix versions.
It is similar to 186511, but for creating files for writing.

llvm-svn: 186679
2013-07-19 15:02:03 +00:00
Rafael Espindola
d5796b9a12 Remove dead code.
llvm-svn: 186561
2013-07-18 03:29:51 +00:00
Rafael Espindola
a045716bb8 Split openFileForRead into Windows and Unix versions.
This has some advantages:

* Lets us use native, utf16 windows functions.
* Easy to produce good errors on windows about trying to use a
directory when we want a file.
* Simplifies the unix version a bit.

llvm-svn: 186511
2013-07-17 14:58:25 +00:00
Rafael Espindola
2451973efd Don't fallback to copy + delete in rename.
Rename's documentation says "Files are renamed as if by POSIX rename()". and it
is used for atomically updating output files from a temporary. Having rename
fallback to a non atomic copy has the potential to hide bugs, like using
a temporary file in /tmp instead of a unique name next to the final destination.

llvm-svn: 186483
2013-07-17 03:33:41 +00:00
Rafael Espindola
11c4a6dce3 Add a version of sys::fs::status that uses fstat.
llvm-svn: 186378
2013-07-16 03:20:13 +00:00
Rafael Espindola
4e9e39062b Instead friending status, provide windows and posix constructors to file_status.
This opens the way of having static helpers in the .inc files that can
construct a file_status.

llvm-svn: 186376
2013-07-16 02:55:33 +00:00
Craig Topper
38ebc8e7f2 Revert part of 186302 to fix buildbots.
llvm-svn: 186303
2013-07-15 04:37:54 +00:00
Craig Topper
4e9457fd7d Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]).
llvm-svn: 186301
2013-07-15 04:27:47 +00:00
Rafael Espindola
f1b5484cf9 Fix a FIXME about the format and add a test.
While at it, use strftime on Unix too and use the thread safe versions
of localtime.

llvm-svn: 186090
2013-07-11 15:35:23 +00:00
Rafael Espindola
af2c19d481 Use status to implement file_size.
The status function is already using a syscall that returns the file size.
Remember it and implement file_size as a simple wrapper.

No functionally change, but clients that already use status now can avoid
calling file_size.

llvm-svn: 186016
2013-07-10 17:16:40 +00:00
Rafael Espindola
fc25f0c6cf We now always create files with the correct permissions. Simplify the interface.
llvm-svn: 185834
2013-07-08 16:42:01 +00:00
Eric Christopher
f5e8037cf3 Reapply r185601 with a fix for the cmake build.
llvm-svn: 185605
2013-07-04 01:10:38 +00:00
Eric Christopher
c31256808e Temporarily revert 185601 as it caused cmake build regressions.
llvm-svn: 185603
2013-07-04 00:51:26 +00:00
Eric Christopher
f92d25bdca Add support for futimens for platforms that don't support futimes.
Patch by pashev.igor.

llvm-svn: 185601
2013-07-04 00:47:09 +00:00
Patrik Hagglund
9c5af31019 Suppress GCC "control reaches end of non-void function" warning.
llvm-svn: 185136
2013-06-28 06:54:05 +00:00
Rafael Espindola
8eae838533 Improvements to unique_file and createUniqueDirectory.
* Don't try to create parent directories in unique_file. It had two problem:
   * It violates the contract that it is atomic. If the directory creation
     success and the file creation fails, we would return an error but the
     file system was modified.
   * When creating a temporary file clang would have to first check if the
     parent directory existed or not to avoid creating one when it was not
     supposed to.

* More efficient implementations of createUniqueDirectory and the unique_file
  that produces only the file name. Now all 3 just call into a static
  function passing what they want (name, file or directory).

Clang also has to be updated, so tests might fail if a bot picks up this commit
and not the corresponding clang one.

llvm-svn: 185126
2013-06-28 03:48:47 +00:00
Rafael Espindola
9edd4f6c46 Rename PathV2 to just Path now that it is the only one.
llvm-svn: 185015
2013-06-26 19:33:03 +00:00
Rafael Espindola
86155d2520 Use enums instead of raw octal values.
Patch by 罗勇刚(Yonggang Luo).

llvm-svn: 184971
2013-06-26 17:28:04 +00:00
Rafael Espindola
dc28d9e2d2 PathV1 is deprecated since the 18th of Dec 2010. Remove it.
llvm-svn: 184960
2013-06-26 16:24:35 +00:00
Rafael Espindola
5c2b78684b Remove calls to Path in #ifdefs that don't seem to be used in any of the bots :-(
llvm-svn: 184920
2013-06-26 06:10:32 +00:00
Rafael Espindola
cfa225ba98 Fix the build when __APPLE__ is defined.
llvm-svn: 184917
2013-06-26 05:25:44 +00:00
Rafael Espindola
1c94419f89 Remove sys::GetMainExecutable.
llvm-svn: 184916
2013-06-26 05:05:37 +00:00
Rafael Espindola
07ffa7d08b Port GetMainExecutable over to PathV2.
I will remove the V1 version as soon as I change clang in the next commit.

llvm-svn: 184914
2013-06-26 05:01:35 +00:00
Rafael Espindola
2d8fd3934d Remove PathWithStatus.
llvm-svn: 184910
2013-06-26 04:15:55 +00:00
Rafael Espindola
4ff51c0bcf Move GetEXESuffix to the one place it is used.
llvm-svn: 184853
2013-06-25 14:42:30 +00:00
Rafael Espindola
c818977b7b Remove sys::PathSeparator.
llvm-svn: 184852
2013-06-25 14:32:45 +00:00
Rafael Espindola
ca881d57f8 Add another fixme.
llvm-svn: 184488
2013-06-20 22:07:53 +00:00
Rafael Espindola
9636a2717e Remove last use of PathV1.h from Archive.cpp.
llvm-svn: 184484
2013-06-20 22:02:10 +00:00
Rafael Espindola
932ff464b9 make getLastModificationTime const. Move it with the other getters.
llvm-svn: 184478
2013-06-20 21:51:49 +00:00
Rafael Espindola
695308b067 Add a setLastModificationAndAccessTime to PathV2.
With this we can remove the last use of PathV1 from llvm-ar.cpp.

llvm-svn: 184464
2013-06-20 20:56:14 +00:00
Rafael Espindola
ffbd9ee39f Add support for getting the last modification time from a file_status.
Use that in llvm-ar.cpp to replace a use of sys::PathWithStatus.

llvm-svn: 184450
2013-06-20 18:42:04 +00:00
Evgeniy Stepanov
be5fa31841 Fix get_magic() handling of short reads.
PR16389

llvm-svn: 184434
2013-06-20 15:56:05 +00:00
Rafael Espindola
dc37cdb22d Rename fs::GetUniqueID to fs::getUniqueID to match the style guide.
llvm-svn: 184431
2013-06-20 15:06:35 +00:00
Evgeniy Stepanov
0d9af4e442 Remove MSan hack that is no longer needed.
llvm-svn: 184428
2013-06-20 14:19:10 +00:00
Rafael Espindola
8db1ef8cde Remove Path::getDirectoryContents.
llvm-svn: 184311
2013-06-19 15:32:37 +00:00
Rafael Espindola
9f3be55a57 Remove Path::canExecute.
llvm-svn: 184298
2013-06-19 13:25:31 +00:00