git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>,
	Jason Evans <jasone@canonware.com>,
	David Barr <david.barr@cordelta.com>
Subject: Re: [PATCH 4/4] Suppress "statement not reached" warnings under Sun Studio
Date: Wed, 21 Dec 2011 10:27:29 -0800	[thread overview]
Message-ID: <7vvcp9hjam.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1324430302-22441-5-git-send-email-avarab@gmail.com> ("Ævar	Arnfjörð Bjarmason"'s message of "Wed, 21 Dec 2011 01:18:22 +0000")

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> diff --git a/read-cache.c b/read-cache.c
> index a51bba1..0a4e895 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -758,7 +758,13 @@ int verify_path(const char *path)
>  		return 0;
>  
>  	goto inside;
> +#ifdef __sun
> +#	pragma error_messages (off, E_STATEMENT_NOT_REACHED)
> +#endif
>  	for (;;) {
> +#ifdef __sun
> +#	pragma error_messages (on, E_STATEMENT_NOT_REACHED)
> +#endif
>  		if (!c)
>  			return 1;

Patches 1-3 makes sense, but this one is too ugly to live.

Wouldn't something like this be equivalent and have the same effect
without sacrificing the readablity?

diff --git a/read-cache.c b/read-cache.c
index a51bba1..73af797 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -757,12 +757,12 @@ int verify_path(const char *path)
 	if (has_dos_drive_prefix(path))
 		return 0;
 
-	goto inside;
+	/* we are at the beginning of a path component */
+	c = '/';
 	for (;;) {
 		if (!c)
 			return 1;
 		if (is_dir_sep(c)) {
-inside:
 			c = *path++;
 			if ((c == '.' && !verify_dotfile(path)) ||
 			    is_dir_sep(c) || c == '\0')

  reply	other threads:[~2011-12-21 18:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21  1:18 [PATCH 0/4] Eliminate warnings under Sun Studio Ævar Arnfjörð Bjarmason
2011-12-21  1:18 ` [PATCH 1/4] Fix an enum assignment issue spotted by " Ævar Arnfjörð Bjarmason
2011-12-21  1:18 ` [PATCH 2/4] Fix a bitwise negation " Ævar Arnfjörð Bjarmason
2011-12-21  1:18 ` [PATCH 3/4] Appease Sun Studio by renaming "tmpfile" Ævar Arnfjörð Bjarmason
2011-12-21  1:18 ` [PATCH 4/4] Suppress "statement not reached" warnings under Sun Studio Ævar Arnfjörð Bjarmason
2011-12-21 18:27   ` Junio C Hamano [this message]
2011-12-21 19:03     ` Ævar Arnfjörð Bjarmason
2011-12-21 20:41       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vvcp9hjam.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=jasone@canonware.com \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).