Skip to content

Commit aa5ea47

Browse files
author
Edward Thomson
committed
Provide error on gcc < 4.1 when THREADSAFE
Provide a descriptive error message when compiling THREADSAFE on gcc versions < 4.1. We require the atomic primitives (eg `__sync_synchronize`) that were introduced in that version. (Note, clang setes `__GNUC__` but appears to set its version > 4.1.)
1 parent b13f0da commit aa5ea47

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/thread-utils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
#ifndef INCLUDE_thread_utils_h__
88
#define INCLUDE_thread_utils_h__
99

10+
#if defined(__GNUC__) && defined(GIT_THREADS)
11+
# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1))
12+
# error Atomic primitives do not exist on this version of gcc; configure libgit2 with -DTHREADSAFE=OFF
13+
# endif
14+
#endif
15+
1016
/* Common operations even if threading has been disabled */
1117
typedef struct {
1218
#if defined(GIT_WIN32)

0 commit comments

Comments
 (0)