about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2017-04-21T15·39+0200
committerGitHub <noreply@github.com>2017-04-21T15·39+0200
commit169edf94072c92f9a6148838c50c92350c5bc183 (patch)
treeb046be4ff1c5a88d4b404bea68bf01aaf28699a9
parent749696e71c9d637a36ab09a1368dff01b2b1bda8 (diff)
parent804ac524891ead6aa70e27c093686b71391ea232 (diff)
Merge pull request #1352 from corngood/cygwin-fixes
Cygwin fixes
-rw-r--r--mk/lib.mk4
-rw-r--r--src/libmain/shared.cc2
-rw-r--r--src/libutil/util.cc7
-rw-r--r--src/libutil/util.hh2
4 files changed, 10 insertions, 5 deletions
diff --git a/mk/lib.mk b/mk/lib.mk
index bb82801d3b4e..1da51d879734 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -53,8 +53,8 @@ BUILD_SHARED_LIBS ?= 1
 
 ifeq ($(BUILD_SHARED_LIBS), 1)
   ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
-    GLOBAL_CFLAGS += -U__STRICT_ANSI__
-    GLOBAL_CXXFLAGS += -U__STRICT_ANSI__
+    GLOBAL_CFLAGS += -U__STRICT_ANSI__ -D_GNU_SOURCE
+    GLOBAL_CXXFLAGS += -U__STRICT_ANSI__ -D_GNU_SOURCE
   else
     GLOBAL_CFLAGS += -fPIC
     GLOBAL_CXXFLAGS += -fPIC
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 4747b9bf9b4c..d6c1c0c9cb49 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -259,7 +259,7 @@ int handleExceptions(const string & programName, std::function<void()> fun)
                condition is discharged before we reach printMsg()
                below, since otherwise it will throw an (uncaught)
                exception. */
-            interruptThrown = true;
+            setInterruptThrown();
             throw;
         }
     } catch (Exit & e) {
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 37dfccd0669a..88a2f752c023 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -946,7 +946,12 @@ void closeOnExec(int fd)
 
 bool _isInterrupted = false;
 
-thread_local bool interruptThrown = false;
+static thread_local bool interruptThrown = false;
+
+void setInterruptThrown()
+{
+    interruptThrown = true;
+}
 
 void _interrupted()
 {
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 121423cdaa3d..ae40dcd4cd2d 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -267,7 +267,7 @@ void closeOnExec(int fd);
 
 extern bool _isInterrupted;
 
-extern thread_local bool interruptThrown;
+void setInterruptThrown();
 
 void _interrupted();