List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH] ui-snapshot.c: Terminate cgit_snapshot_formats[] properly
Date: Sun, 3 Mar 2013 22:55:16 +0000	[thread overview]
Message-ID: <20130303225516.GM7738@serenity.lan> (raw)
In-Reply-To: <1362348541-26785-1-git-send-email-cgit@cryptocrack.de>

On Sun, Mar 03, 2013 at 11:09:01PM +0100, Lukas Fleischer wrote:
> Explicitly set the suffix field of the terminating format entry to 0.
> This fixes a GCC warning seen with "-Wmissing-field-initializers".
> 
> Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
> ---
>  ui-snapshot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ui-snapshot.c b/ui-snapshot.c
> index 47432bd..e740645 100644
> --- a/ui-snapshot.c
> +++ b/ui-snapshot.c
> @@ -48,7 +48,7 @@ const struct cgit_snapshot_format cgit_snapshot_formats[] = {
>  	{ ".tar.bz2", "application/x-bzip2", write_tar_bzip2_archive, 0x04 },
>  	{ ".tar", "application/x-tar", write_tar_archive, 0x08 },
>  	{ ".tar.xz", "application/x-xz", write_tar_xz_archive, 0x10 },
> -	{}
> +	{ 0 }

I'm mildly against this - we're not fixing an issue that's been found with some
specific compiler, the meaning of both versions is the same and
-Wmissing-field-initializers isn't in -Wall.  It feels like a warning that was
added for people following some overly prescriptive coding standard, not a
warning that's actually useful.

[Also, I'm surprised this is sufficient to squelch the warning given the
description of -Wmissing-field-initializers in gcc(1):

   Warn if a structure's initializer has some fields missing.  For example,
   the following code would cause such a warning, because "x.h" is implicitly
   zero:

       struct s { int f, g, h; };
       struct s x = { 3, 4 };
]

>  };
>  
>  static const struct cgit_snapshot_format *get_format(const char *filename)
> -- 
> 1.8.2.rc0.247.g811e0c0




  parent reply	other threads:[~2013-03-03 22:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-03 22:09 cgit
2013-03-03 22:16 ` dpmcgee
2013-03-04  7:01   ` cgit
2013-03-04 14:13     ` Jason
2013-03-03 22:55 ` john [this message]
2013-03-03 23:41   ` cgit
2013-03-03 23:53     ` john
2013-03-03 23:59     ` Jason
2013-03-03 23:51 ` [PATCH v2] " cgit

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=20130303225516.GM7738@serenity.lan \
    --to=cgit@lists.zx2c4.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).