Add option to disable NORETURN
Due to a bug in gcc 4.6+ it can crash when doing profile feedback with a noreturn function pointer (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299) This adds a Makefile variable to disable noreturns. [Patch by Junio, description by Andi Kleen] Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 18, 2011 at 18:07 UTC
6520c84685660fc995a405d7b7511a903fc12e18
2 files changed
+7
-1
Makefile
+6
@@ -153,6 +153,9 @@ all::
153
# that tells runtime paths to dynamic libraries;
154
# "-Wl,-rpath=/path/lib" is used instead.
155
#
156
+# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
157
+# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
158
+#
159
# Define USE_NSEC below if you want git to care about sub-second file mtimes
160
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
161
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
@@ -1374,6 +1377,9 @@ endif
1377
ifdef USE_ST_TIMESPEC
1378
BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1379
endif
1380
+ifdef NO_NORETURN
1381
+ BASIC_CFLAGS += -DNO_NORETURN
1382
+endif
1383
ifdef NO_NSEC
1384
BASIC_CFLAGS += -DNO_NSEC
1385
endif
git-compat-util.h
+1
-1
@@ -218,7 +218,7 @@ extern char *gitbasename(char *);
218
#if __HP_cc >= 61000
219
#define NORETURN __attribute__((noreturn))
220
#define NORETURN_PTR
221
-#elif defined(__GNUC__)
221
+#elif defined(__GNUC__) && !defined(NO_NORETURN)
222
#define NORETURN __attribute__((__noreturn__))
223
#define NORETURN_PTR __attribute__((__noreturn__))
224
#elif defined(_MSC_VER)