git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Portability: returning void
@ 2011-03-29 17:31 Michael Witten
  2011-03-29 20:02 ` Jonathan Nieder
  0 siblings, 1 reply; 18+ messages in thread
From: Michael Witten @ 2011-03-29 17:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-03-30 19:31 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 17:31 [PATCH] Portability: returning void Michael Witten
2011-03-29 20:02 ` 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

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).