From: Robin Rosenberg Date: Sat, 17 Nov 2007 10:39:32 GMT Subject: Re: [PATCH] Rewrite some function exit paths to avoid "unreachable code" traps Message-ID: <200711171139.32631.robin.rosenberg.lists@dewire.com> In-Reply-To: <20071117094617.GD4086@steel.home> lördag 17 november 2007 skrev Alex Riesen: > Noticed by Guido Ostkamp for Sun's Workshop cc. > > Originally-by: Guido Ostkamp > Signed-off-by: Alex Riesen > --- > Guido Ostkamp, Fri, Nov 16, 2007 23:52:01 +0100: > > > > What about the xdiff/xdiffi.c problem that should also be solved? > > > Please... This just looks bad. I'm sure we'll have fixup patches on the list to fix those gotos. Do we support any such stupid compiler that requires a dummy goto? If so we could just add a macro to compat-util.h #if stupid_compiler #define DUMMY_RETURN(x) return x; #else #define DUMMY_RETURN(x) #endif and then use it like this: diff --git a/builtin-apply.c b/builtin-apply.c index 8edcc08..91f8752 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -683,7 +683,6 @@ static char *git_header_name(char *line, int llen)                         }                 }         } -       return NULL; + DUMMY_RETURN(NULL)   } My vote is for Guidos patch and fallback to the suggestion above if we support really stupid compilers. -- robin