Skip to content

Commit 6520c84

Browse files
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 28eb1af commit 6520c84

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ all::
153153
# that tells runtime paths to dynamic libraries;
154154
# "-Wl,-rpath=/path/lib" is used instead.
155155
#
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+
#
156159
# Define USE_NSEC below if you want git to care about sub-second file mtimes
157160
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
158161
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
@@ -1374,6 +1377,9 @@ endif
13741377
ifdef USE_ST_TIMESPEC
13751378
BASIC_CFLAGS += -DUSE_ST_TIMESPEC
13761379
endif
1380+
ifdef NO_NORETURN
1381+
BASIC_CFLAGS += -DNO_NORETURN
1382+
endif
13771383
ifdef NO_NSEC
13781384
BASIC_CFLAGS += -DNO_NSEC
13791385
endif

git-compat-util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ extern char *gitbasename(char *);
218218
#if __HP_cc >= 61000
219219
#define NORETURN __attribute__((noreturn))
220220
#define NORETURN_PTR
221-
#elif defined(__GNUC__)
221+
#elif defined(__GNUC__) && !defined(NO_NORETURN)
222222
#define NORETURN __attribute__((__noreturn__))
223223
#define NORETURN_PTR __attribute__((__noreturn__))
224224
#elif defined(_MSC_VER)

0 commit comments

Comments
 (0)