Re: [PATCH 4/4] Suppress "statement not reached" warnings under Sun Studio
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 21, 2011, 18:27 UTC
- Message-ID
- <7vvcp9hjam.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1324430302-22441-5-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 17 quoted lines
> 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')