Owen Anderson
77f965d8b2
Fix compilation without pthreads.
...
Patch by Xerxes Ranby.
llvm-svn: 74283
2009-06-26 08:48:03 +00:00
Daniel Dunbar
0d9b275e55
Fix unused variable warnings.
...
llvm-svn: 74250
2009-06-26 01:34:35 +00:00
Owen Anderson
ba05ead9db
Fix error in the Win32 implementation pointed out by Howard Su.
...
llvm-svn: 74248
2009-06-26 00:51:20 +00:00
Owen Anderson
3a892a63b7
Add support for const thread locals.
...
llvm-svn: 74226
2009-06-25 23:31:18 +00:00
Owen Anderson
8d5f9675c7
Fix typo in assertion.
...
llvm-svn: 74225
2009-06-25 23:28:28 +00:00
Owen Anderson
59ffd85020
Add a configure test for pthread_getspecific, and use it when building ThreadLocal.
...
llvm-svn: 74222
2009-06-25 23:10:26 +00:00
Owen Anderson
aef431f9cb
Update cmake build files.
...
llvm-svn: 74210
2009-06-25 21:58:34 +00:00
Owen Anderson
e716e57779
Add a class for supporting platform independent thread-local storage.
...
Windows people, please double-check/patch this.
llvm-svn: 74209
2009-06-25 21:58:01 +00:00
Owen Anderson
d1598408ce
Guard dynamic library loading.
...
I did my best at implementing this for Win32, but I don't have a way to test it.
Can someone with access to a Win32 machine test/fix this?
llvm-svn: 74188
2009-06-25 18:12:44 +00:00
Owen Anderson
5bda03a404
Add atomic multiply and divide operations, built on top of CompareAndSwap.
...
llvm-svn: 74004
2009-06-23 21:19:04 +00:00
Owen Anderson
c11dfb46c1
Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
...
we care about are capable of supporting it.
llvm-svn: 73993
2009-06-23 20:17:22 +00:00
Owen Anderson
c2d02066d0
Atomic ops that do arithmetic use signed arithmetic.
...
llvm-svn: 73980
2009-06-23 18:30:27 +00:00
Owen Anderson
1bea9b9158
Label the existing atomic functions as 32-bit specific, and add a 64-bit one that will be useful in
...
the near future.
llvm-svn: 73971
2009-06-23 18:01:04 +00:00
Owen Anderson
e0ff9fb130
Add an atomic add operation.
...
llvm-svn: 73964
2009-06-23 17:39:31 +00:00
Owen Anderson
c1a4bbe1c8
Workaround for an... interesting bug in Darwin's pthread_rwlock_init.
...
llvm-svn: 73806
2009-06-20 00:32:27 +00:00
Owen Anderson
47968a6dec
Fix bad paste-o in the MSVC atomics.
...
Patch by Ðван СоÑокин.
llvm-svn: 73779
2009-06-19 18:37:50 +00:00
Owen Anderson
4760da0a7a
Give RWMutex the SmartRWMutex treatment too.
...
llvm-svn: 73710
2009-06-18 18:26:15 +00:00
Owen Anderson
9aaa6b8958
Insert a SmartMutex templated class into the class hierarchy, which takes a template parameter specifying whether this mutex
...
should become a no-op when not running in multithreaded mode. Make sys::Mutex a typedef of SmartMutex<false>, to preserve source compatibility.
llvm-svn: 73709
2009-06-18 17:53:17 +00:00
Ted Kremenek
e88e953645
Update CMake files to account for new location of Threading.cpp.
...
llvm-svn: 73708
2009-06-18 17:47:09 +00:00
Owen Anderson
a59f91c08d
Move Threading.[h|cpp] from Support to System.
...
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson
f71490c586
Fix build when disable thread support.
...
Patch by Howard Su.
llvm-svn: 73680
2009-06-18 04:44:46 +00:00
Douglas Gregor
b1764a0bef
Add RWMutex.cpp to the CMake makefiles
...
llvm-svn: 73615
2009-06-17 17:01:30 +00:00
Owen Anderson
c40f3f2752
Improve the Win32 reader-writer lock implementation by making it just a normal
...
lock. This is obviously bad, but at least it's threadsafe! If you know how
to improve this in a pre-Vista friendly well, patches welcome!
Patch by Max Burke.
llvm-svn: 73607
2009-06-17 09:10:42 +00:00
Owen Anderson
3637fc65bd
Use atomic increment/decrement for reference counting of Type's.
...
llvm-svn: 73588
2009-06-17 00:28:49 +00:00
Owen Anderson
430f18d2db
Add an atomic increment and decrement implementation, which will be used for
...
thread-safe reference counting.
llvm-svn: 73587
2009-06-17 00:13:00 +00:00
Owen Anderson
aaf83d86b8
Accidentally broke this file.
...
llvm-svn: 73552
2009-06-16 20:57:51 +00:00
Owen Anderson
208c38b522
Remove the Win32 implementation, since it doesn't compile pre-Vista.
...
llvm-svn: 73550
2009-06-16 20:49:20 +00:00
Owen Anderson
30a1b2528a
Fix/cleanup trailing newlines.
...
llvm-svn: 73546
2009-06-16 20:23:05 +00:00
Owen Anderson
48d53f2c53
Add a portable wrapper for reader-writer locks.
...
llvm-svn: 73545
2009-06-16 20:19:28 +00:00
Dan Gohman
d0637707c5
glibc has two versions of strerror_r, a standards compliant one and a GNU
...
specific one. The GNU one is chosen when _GNU_SOURCE is defined. g++ always
defines _GNU_SOURCE on linux platforms because glibc's headers won't compile
in C++ mode without it. The GNU strerror_r doesn't always modify the buffer
which causes empty error messages on linux.
This patch changes MakeErrMsg to use the return value of strerror_r to get
the string instead of assuming the buffer will be modified, on GLIBC.
Patch by Benjamin Kramer!
llvm-svn: 73396
2009-06-15 18:05:46 +00:00
Chris Lattner
9e81498d2d
"This patch implements the method with the GetModuleFileName function for windows."
...
Patch by Benjamin Kramer!
llvm-svn: 73379
2009-06-15 05:38:04 +00:00
Chris Lattner
dfaaf63aff
add a new static method to portably determine whether a patch is
...
absolute or not, based on a patch by Gregory Curfman!
llvm-svn: 73368
2009-06-15 04:17:07 +00:00
Torok Edwin
a10c3b9bc6
Fix comments.
...
llvm-svn: 72858
2009-06-04 08:18:25 +00:00
Torok Edwin
5da9f51d1e
Add support for outputting ANSI colors to raw_fd_ostream.
...
llvm-svn: 72854
2009-06-04 07:09:50 +00:00
Duncan Sands
1f0ecf9952
At a newline at the end of this file.
...
llvm-svn: 72767
2009-06-03 11:54:28 +00:00
Owen Anderson
6a94d2450e
Undef MemoryFence when compiling on MSVC.
...
llvm-svn: 72732
2009-06-02 17:35:55 +00:00
Bill Wendling
8235a05c1a
Untabification.
...
llvm-svn: 72604
2009-05-30 01:09:53 +00:00
Jay Foad
ccae25d83b
Work around a page size issue on Cygwin.
...
llvm-svn: 72332
2009-05-23 17:57:59 +00:00
Owen Anderson
3e3206324b
Add Atomic.cpp to the CMake build system.
...
llvm-svn: 72202
2009-05-21 00:48:56 +00:00
Owen Anderson
07513122f5
Tabs, be gone!
...
llvm-svn: 72180
2009-05-20 19:06:49 +00:00
Owen Anderson
b3e9d10028
I just fail today.
...
Hopefully this fixes the last build errors on systems with GCC < 4.1.
llvm-svn: 72179
2009-05-20 19:01:50 +00:00
Owen Anderson
0bc99bd557
Copy-and-paste-o.
...
llvm-svn: 72177
2009-05-20 18:47:53 +00:00
Owen Anderson
2753821fab
Move atomic operations' definitions out of line. While this seems kind of silly,
...
all kinds of problems caused by including windows.h and/or config.h in an LLVM header.
llvm-svn: 72174
2009-05-20 18:26:15 +00:00
Douglas Gregor
1ad25cdc99
termios.h contains the winsize structure we need to determine the
...
width of a terminal. Don't try to get the width of a terminal if we
don't have this header.
llvm-svn: 72018
2009-05-18 17:21:34 +00:00
Douglas Gregor
26745696ef
Add terminal width detection to llvm::sys::Process. This is needed to
...
fix Clang PRs 4148 and 4183.
llvm-svn: 71448
2009-05-11 18:05:52 +00:00
Stefanus Du Toit
984008e1d7
Fix choice of version of Windows callback to use to consider not only the Visual Studio version, but also the Windows SDK version.
...
Patch by Tareq Siraj.
llvm-svn: 70299
2009-04-28 16:37:58 +00:00
Torok Edwin
285a5fb1d5
Fix g++-4.4.0 warning, it was causing llvm-nm to fail on wrapped BC files:
...
Path.cpp:59: warning: case label value exceeds maximum value for type
magic[0] is a (signed) char, but some case values are unsigned (e.g. 0xde).
When magic[0] was 0xde, the switch has taken the default branch instead of case
0xde branch.
Apparently this was the behaviour with older versions of gcc too, but not with g++.
Now g++-4.4 behaves as gcc, and ignores unsigned case values out of range signed
range.
llvm-svn: 70038
2009-04-25 10:25:12 +00:00
Anton Korobeynikov
b53ac333d7
Silence warnings.
...
Patch by Jay Foad!
llvm-svn: 69679
2009-04-21 16:04:56 +00:00
Anton Korobeynikov
0a64083f49
Drop obsolete reference to __eprintf.
...
Patch by Jay Foad!
llvm-svn: 69678
2009-04-21 16:04:41 +00:00
Daniel Dunbar
024320d274
Make Unix.h:MakeErrMsg separate the prefix and errno string, so we get:
...
clang: error: unable to make temporary file: /etc/cc: can't make
unique filename: Permission denied
instead of
clang: error: unable to make temporary file: /etc/cc: can't make
unique filenamePermission denied
for example.
Also, audited the uses of MakeErrMsg to make the prefix strings
consistent (not end with newline/punctuation/space/": ").
llvm-svn: 69626
2009-04-20 20:50:13 +00:00