[PATCH] Portability: returning void
- From
Michael Witten <mfwitten@gmail.com>
- Date
- Mar 29, 2011, 17:31 UTC
- Message-ID
- <71372d7d-dd08-4945-a8bc-c7b981c09fb2-mfwitten@gmail.com>
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 voidThe 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