diff mbox series

[PATCH/RFC,2/3] object-store: avoid extra ';' from KHASH_INIT

Message ID 20210809013833.58110-3-carenas@gmail.com (mailing list archive)
State New, archived
Headers show
Series pedantic errors in next | expand

Commit Message

Carlo Marcelo Arenas Belón Aug. 9, 2021, 1:38 a.m. UTC
cf2dc1c238 (speed up alt_odb_usable() with many alternates, 2021-07-07)
introduces a KHASH_INIT invocation with a trailing ';', which while
commonly expected will trigger warnings with pedantic on both
clang[-Wextra-semi] and gcc[-Wpedantic], because that macro has already
a semicolon and is meant to be invoked without one.

while fixing the macro would be a worthy solution (specially considering
this is a common recurring problem), remove the extra ';' for now to
minimize churn.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 object-store.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Junio C Hamano Aug. 9, 2021, 3:53 p.m. UTC | #1
Carlo Marcelo Arenas Belón  <carenas@gmail.com> writes:

> cf2dc1c238 (speed up alt_odb_usable() with many alternates, 2021-07-07)
> introduces a KHASH_INIT invocation with a trailing ';', which while
> commonly expected will trigger warnings with pedantic on both
> clang[-Wextra-semi] and gcc[-Wpedantic], because that macro has already
> a semicolon and is meant to be invoked without one.
>
> while fixing the macro would be a worthy solution (specially considering
> this is a common recurring problem), remove the extra ';' for now to
> minimize churn.

Thanks.  I fully agree with the reasoning.

>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  object-store.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/object-store.h b/object-store.h
> index e679acc4c3..d24915ced1 100644
> --- a/object-store.h
> +++ b/object-store.h
> @@ -34,7 +34,7 @@ struct object_directory {
>  };
>  
>  KHASH_INIT(odb_path_map, const char * /* key: odb_path */,
> -	struct object_directory *, 1, fspathhash, fspatheq);
> +	struct object_directory *, 1, fspathhash, fspatheq)
>  
>  void prepare_alt_odb(struct repository *r);
>  char *compute_alternate_path(const char *path, struct strbuf *err);
diff mbox series

Patch

diff --git a/object-store.h b/object-store.h
index e679acc4c3..d24915ced1 100644
--- a/object-store.h
+++ b/object-store.h
@@ -34,7 +34,7 @@  struct object_directory {
 };
 
 KHASH_INIT(odb_path_map, const char * /* key: odb_path */,
-	struct object_directory *, 1, fspathhash, fspatheq);
+	struct object_directory *, 1, fspathhash, fspatheq)
 
 void prepare_alt_odb(struct repository *r);
 char *compute_alternate_path(const char *path, struct strbuf *err);