# [PATCH] Honor HP C's noreturn attribute

4 messages from 2011-03-07 to 2011-03-08. Participants: Michal Rokos, Junio C Hamano, Piotr Krukowiecki.
Thread: https://gitlist.dev/t/26683

## Michal Rokos, 2011-03-07 12:13

Subject: [PATCH] Honor HP C's noreturn attribute
Message-ID: <32EABE0E-2447-4189-A3CE-05B68A5E18EF@nextsoft.cz>
URL: https://gitlist.dev/e/32EABE0E-2447-4189-A3CE-05B68A5E18EF%40nextsoft.cz

```
HP C for Integrity servers (Itanium) gained support for noreturn attribute sometime in 2006. It was released in Compiler Version A.06.10 and made available in July 2006.

The __HP_cc define detects the HP C compiler version. Precede the __GNUC__ check so it works well when compiling with HP C using -Agcc option that enables partial support for the GNU C dialect. The -Agcc defines the __GNUC__ too.

Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>

diff --git a/git-compat-util.h b/git-compat-util.h
index 9c23622..bf947b1 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -214,7 +214,10 @@ extern char *gitbasename(char *);
 #define is_dir_sep(c) ((c) == '/')
 #endif
 
-#ifdef __GNUC__
+#if __HP_cc >= 61000
+#define NORETURN __attribute__((noreturn))
+#define NORETURN_PTR
+#elif defined(__GNUC__)
 #define NORETURN __attribute__((__noreturn__))
 #define NORETURN_PTR __attribute__((__noreturn__))
 #elif defined(_MSC_VER)

--

Michal Rokos

NextSoft spol. s r.o.
Vyskočilova 1/1410
140 21 Praha 4
Czech Republic
mobile: +420 736 646 591
fax:    +420 267 224 307
e-mail: rokos@nextsoft.cz

```

## Junio C Hamano, 2011-03-08 19:00

Subject: Re: [PATCH] Honor HP C's noreturn attribute
Message-ID: <7v4o7dfndw.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4o7dfndw.fsf%40alter.siamese.dyndns.org
In-Reply-To: <32EABE0E-2447-4189-A3CE-05B68A5E18EF@nextsoft.cz>

```
Michal Rokos <rokos@nextsoft.cz> writes:

> HP C for Integrity servers (Itanium) gained support for noreturn
> attribute sometime in 2006. It was released in Compiler Version A.06.10
> and made available in July 2006.
>
> The __HP_cc define detects the HP C compiler version. Precede the
> __GNUC__ check so it works well when compiling with HP C using -Agcc
> option that enables partial support for the GNU C dialect. The -Agcc
> defines the __GNUC__ too.
>
> Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>

We tend to prefer new code be appended at the end of if/elif/.../then/fi
cascade when there is no strong reason to do otherwise; your log message
clearly explains why this particular #if needs to come before the existing
one.

I love it when people write a very readable log message to explain why the
patch _has_ to be the way it is.  Very good job.

Except for the overlooooooooong lines in the message, which I line-wrapped
locally before applying, that is.

Thanks.

```

## Piotr Krukowiecki, 2011-03-08 19:26

Subject: Re: [PATCH] Honor HP C's noreturn attribute
Message-ID: <AANLkTi=FPkccc3Rk3YDuEsN3YGt_U1NhhT2MGHmbrAra@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3DFPkccc3Rk3YDuEsN3YGt_U1NhhT2MGHmbrAra%40mail.gmail.com
In-Reply-To: <7v4o7dfndw.fsf@alter.siamese.dyndns.org>

```
On Tue, Mar 8, 2011 at 8:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Michal Rokos <rokos@nextsoft.cz> writes:
>
>> HP C for Integrity servers (Itanium) gained support for noreturn
>> attribute sometime in 2006. It was released in Compiler Version A.06.10
>> and made available in July 2006.
>>
>> The __HP_cc define detects the HP C compiler version. Precede the
>> __GNUC__ check so it works well when compiling with HP C using -Agcc
>> option that enables partial support for the GNU C dialect. The -Agcc
>> defines the __GNUC__ too.
>>
>> Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
>
> We tend to prefer new code be appended at the end of if/elif/.../then/fi
> cascade when there is no strong reason to do otherwise; your log message
> clearly explains why this particular #if needs to come before the existing
> one.
>
> I love it when people write a very readable log message to explain why the
> patch _has_ to be the way it is.  Very good job.

I liked it too, but it'd be even better to put the comment in the code IMO.
I don't think anyone would check the commit to see if he can change the
order of the #ifdefs ...

(So please comment in code more!)


-- 
Piotr Krukowiecki

```

## Michal Rokos, 2011-03-08 22:09

Subject: Re: [PATCH] Honor HP C's noreturn attribute
Message-ID: <3597D63F-589A-4BD5-B052-FA720A593301@nextsoft.cz>
URL: https://gitlist.dev/e/3597D63F-589A-4BD5-B052-FA720A593301%40nextsoft.cz
In-Reply-To: <7v4o7dfndw.fsf@alter.siamese.dyndns.org>

```
Dear Junio,

On 8.3.2011, at 20:00, Junio C Hamano wrote:

> Michal Rokos <rokos@nextsoft.cz> writes:
> 
>> The __HP_cc define detects the HP C compiler version. Precede the
>> __GNUC__ check so it works well when compiling with HP C using -Agcc
>> option that enables partial support for the GNU C dialect. The -Agcc
>> defines the __GNUC__ too.
> 
> I love it when people write a very readable log message to explain why the
> patch _has_ to be the way it is.  Very good job.
> 
> Except for the overlooooooooong lines in the message, which I line-wrapped
> locally before applying, that is.


thank you for your review. I will try to improve overall patch and the commit
log quality when sending something more.

Michal

--

Michal Rokos

NextSoft spol. s r.o.
Vyskočilova 1/1410
140 21 Praha 4
Czech Republic
mobile: +420 736 646 591
fax:    +420 267 224 307
e-mail: rokos@nextsoft.cz

```
