From: Junio C Hamano Date: Sun, 19 Jun 2011 01:07:03 +0000 (-0700) Subject: Add option to disable NORETURN X-Git-Tag: v1.7.7-rc0~94^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6520c84685660fc995a405d7b7511a903fc12e18;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/Makefile b/Makefile index e40ac0c7f..03b4499d5 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,9 @@ all:: # that tells runtime paths to dynamic libraries; # "-Wl,-rpath=/path/lib" is used instead. # +# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback, +# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299) +# # Define USE_NSEC below if you want git to care about sub-second file mtimes # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely @@ -1374,6 +1377,9 @@ endif ifdef USE_ST_TIMESPEC BASIC_CFLAGS += -DUSE_ST_TIMESPEC endif +ifdef NO_NORETURN + BASIC_CFLAGS += -DNO_NORETURN +endif ifdef NO_NSEC BASIC_CFLAGS += -DNO_NSEC endif diff --git a/git-compat-util.h b/git-compat-util.h index e0bb81ed8..9925cf0ed 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -218,7 +218,7 @@ extern char *gitbasename(char *); #if __HP_cc >= 61000 #define NORETURN __attribute__((noreturn)) #define NORETURN_PTR -#elif defined(__GNUC__) +#elif defined(__GNUC__) && !defined(NO_NORETURN) #define NORETURN __attribute__((__noreturn__)) #define NORETURN_PTR __attribute__((__noreturn__)) #elif defined(_MSC_VER)