git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Witten <mfwitten@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Portability: returning void
Date: Tue, 29 Mar 2011 17:31:30 +0000	[thread overview]
Message-ID: <71372d7d-dd08-4945-a8bc-c7b981c09fb2-mfwitten@gmail.com> (raw)

Currently, building git with:

  CFLAGS="-std=c99 -pedantic -Wall -Werror -g -02"

causes gcc 4.5.2 to fail with:

  vcs-svn/svndump.c:217:3: error: ISO C forbids 'return' with
                                  expression, in function
                                  returning void

The line in question is this:

  return repo_delete(node_ctx.dst);

Because repo_delete returns void (vcs-svn/repo_tree.h:19):

  void repo_delete(uint32_t *path);

it would seem like it would be OK, but I guess the
C99 standard is quite particular:

  6.8.6.4.1:
  A return statement with an expression shall not appear in
  a function whose return type is void. A return statement
  without an expression shall only appear in a function
  whose return type is void.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
 vcs-svn/svndump.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index eef49ca..572a995 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -214,7 +214,8 @@ static void handle_node(void)
 		if (have_text || have_props || node_ctx.srcRev)
 			die("invalid dump: deletion node has "
 				"copyfrom info, text, or properties");
-		return repo_delete(node_ctx.dst);
+		repo_delete(node_ctx.dst);
+		return;
 	}
 	if (node_ctx.action == NODEACT_REPLACE) {
 		repo_delete(node_ctx.dst);
-- 
1.7.4.2.417.g32d76d

             reply	other threads:[~2011-03-29 19:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29 17:31 Michael Witten [this message]
2011-03-29 20:02 ` [PATCH] Portability: returning void Jonathan Nieder
2011-03-29 22:16   ` Jeff King
2011-03-29 22:36     ` Jeff King
2011-03-29 23:49     ` Jonathan Nieder
2011-03-30  0:16       ` Jeff King
2011-03-30  0:29         ` Jonathan Nieder
2011-03-30  3:30           ` Jeff King
2011-03-30  3:57             ` Jonathan Nieder
2011-03-30  4:13               ` Jeff King
2011-03-30  6:54                 ` Johannes Sixt
2011-03-30  8:16                   ` [PATCH/RFC svn-fe] tests: introduce helper to fill a pipe in the background Jonathan Nieder
2011-03-30  8:41                 ` [PATCH] Portability: returning void Jonathan Nieder
2011-03-30 12:40                   ` Jeff King
2011-03-30 18:54                     ` Jonathan Nieder
2011-03-30  4:41             ` [PULL svn-fe] " Jonathan Nieder
2011-03-30 19:31               ` Junio C Hamano
2011-03-30  0:42         ` [PATCH] " Jonathan Nieder

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=71372d7d-dd08-4945-a8bc-c7b981c09fb2-mfwitten@gmail.com \
    --to=mfwitten@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).