diff mbox series

[2/4] fixup! reftable: implement stack, a mutable database of reftable files.

Message ID 20210930054032.16867-3-carenas@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/4] fixup! reftable: add a heap-based priority queue for reftable records | expand

Commit Message

Carlo Marcelo Arenas Belón Sept. 30, 2021, 5:40 a.m. UTC
Avoid C++ style comments, that are not allowed in C89.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 reftable/stack_test.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Ævar Arnfjörð Bjarmason Oct. 1, 2021, 3:37 p.m. UTC | #1
On Wed, Sep 29 2021, Carlo Marcelo Arenas Belón wrote:

> Avoid C++ style comments, that are not allowed in C89.
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  reftable/stack_test.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/reftable/stack_test.c b/reftable/stack_test.c
> index 7a4641ab60..f907215d3c 100644
> --- a/reftable/stack_test.c
> +++ b/reftable/stack_test.c
> @@ -46,8 +46,10 @@ static int count_dir_entries(const char *dirname)
>  	return len;
>  }
>  
> -// Work linenumber into the tempdir, so we can see which tests forget to
> -// cleanup.
> +/*
> + * Work linenumber into the tempdir, so we can see which tests forget to
> + * cleanup.
> + */
>  static char *get_tmp_template(int linenumber)
>  {
>  	const char *tmp = getenv("TMPDIR");
> @@ -861,7 +863,7 @@ static void test_reftable_stack_compaction_concurrent(void)
>  
>  static void unclean_stack_close(struct reftable_stack *st)
>  {
> -	// break abstraction boundary to simulate unclean shutdown.
> +	/* break abstraction boundary to simulate unclean shutdown */
>  	int i = 0;
>  	for (; i < st->readers_len; i++) {
>  		reftable_reader_free(st->readers[i]);

This change looks fine, but FYI we had a C++ comment in git.git from
v2.21.0 with d73019feb44 (http: add support selecting http version,
2018-11-08) until now.

It'll be removed in v2.34.0 with my 2a7f64616a3 (http: correct version
check for CURL_HTTP_VERSION_2, 2021-09-13) (not the purpose of that
change).

Now, granted it's "only" compiled if you don't have NO_CURL=Y, and it's
on a "#" pre-processor line, not in the "main" code.

So it's possible (but I think not likely) that someone's cpp accepts it,
but not their cc. Or that some platform has nobody compiling with curl
(not very likely).

I'm not advocating for using "//" comments, but I think it's fair to say
given the above that they're purely an asthetic coding style preference
in the context of git.git, and not a matter of C89 portability that
anyone cares about when building or porting git.

We already have a hard dependency on a few C99-only features, I'd think
it's very unlikely that someone has say implemented designated
initializers, but not "//" comment support. So for our purposes support
for it should be universal.
diff mbox series

Patch

diff --git a/reftable/stack_test.c b/reftable/stack_test.c
index 7a4641ab60..f907215d3c 100644
--- a/reftable/stack_test.c
+++ b/reftable/stack_test.c
@@ -46,8 +46,10 @@  static int count_dir_entries(const char *dirname)
 	return len;
 }
 
-// Work linenumber into the tempdir, so we can see which tests forget to
-// cleanup.
+/*
+ * Work linenumber into the tempdir, so we can see which tests forget to
+ * cleanup.
+ */
 static char *get_tmp_template(int linenumber)
 {
 	const char *tmp = getenv("TMPDIR");
@@ -861,7 +863,7 @@  static void test_reftable_stack_compaction_concurrent(void)
 
 static void unclean_stack_close(struct reftable_stack *st)
 {
-	// break abstraction boundary to simulate unclean shutdown.
+	/* break abstraction boundary to simulate unclean shutdown */
 	int i = 0;
 	for (; i < st->readers_len; i++) {
 		reftable_reader_free(st->readers[i]);