[PATCH] Fix compat/regex ANSIfication on MinGW

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Sixt
Date: Thursday, August 26, 2010 - 12:58 am

From: Johannes Sixt <j6t@kdbg.org>

compat/regexec.c had a weird combination of function declaration in ANSI
style and function definition in K&R style, for example:

 static unsigned
 re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
      int nregs, int regs_allocated) internal_function;

 static unsigned
 re_copy_regs (regs, pmatch, nregs, regs_allocated)
     struct re_registers *regs;
     regmatch_t *pmatch;
     int nregs, regs_allocated;
 { ... }

with this #define:

 #ifndef _LIBC
 # ifdef __i386__
 #  define internal_function   __attribute ((regparm (3), stdcall))
 # else
 #  define internal_function
 # endif
 #endif

The original version as shown above was fine, but with the ANSIfied
function definition and in the case where internal_function is not empty,
gcc identifies the declaration and definition as different and bails out.

Adding internal_function to the definition doesn't help (it results in
a syntax error); hence, remove it from the subset of declarations that gcc
flags as erroneous.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
Am 8/25/2010 20:24, schrieb Karsten Blees:

Here's a fix.

 compat/regex/regexec.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/compat/regex/regexec.c b/compat/regex/regexec.c
index b49585a..0194965 100644
--- a/compat/regex/regexec.c
+++ b/compat/regex/regexec.c
@@ -40,20 +40,19 @@ static reg_errcode_t re_search_internal (const regex_t *preg,
 					 const char *string, int length,
 					 int start, int range, int stop,
 					 size_t nmatch, regmatch_t pmatch[],
-					 int eflags) internal_function;
+					 int eflags);
 static int re_search_2_stub (struct re_pattern_buffer *bufp,
 			     const char *string1, int length1,
 			     const char *string2, int length2,
 			     int start, int range, struct re_registers *regs,
-			     int stop, int ret_len) internal_function;
+			     int stop, int ret_len);
 static int re_search_stub (struct re_pattern_buffer *bufp,
 			   const char *string, int length, int start,
 			   int range, int stop, struct re_registers *regs,
-			   int ret_len) internal_function;
+			   int ret_len);
 static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
-			      int nregs, int regs_allocated) internal_function;
-static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx)
-     internal_function;
+			      int nregs, int regs_allocated);
+static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx);
 static int check_matching (re_match_context_t *mctx, int fl_longest_match,
 			   int *p_match_first) internal_function;
 static int check_halt_state_context (const re_match_context_t *mctx,
-- 
1.7.2.2.1305.g4e2a
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
What's cooking in git.git (Aug 2010, #04; Wed, 18), Junio C Hamano, (Wed Aug 18, 3:27 pm)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Jonathan Nieder, (Wed Aug 18, 8:02 pm)
jn/update-contrib-example-merge in pu, Jonathan Nieder, (Wed Aug 18, 8:22 pm)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Johannes Sixt, (Thu Aug 19, 1:06 am)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Ævar Arnfjörð Bjarmason, (Thu Aug 19, 5:48 am)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Ævar Arnfjörð Bjarmason, (Thu Aug 19, 5:53 am)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Ævar Arnfjörð Bjarmason, (Thu Aug 19, 8:04 am)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Ævar Arnfjörð Bjarmason, (Thu Aug 19, 8:27 am)
Re: Fwd: What's cooking in git.git (Aug 2010, #04; Wed, 18), Aharon Robbins, (Thu Aug 19, 11:05 am)
[PATCH] compat/regex: define out variables only used under ..., =?UTF-8?q?=C3=86var= ..., (Thu Aug 19, 11:30 am)
Re: [PATCH] compat/regex: define out variables only used u ..., Ævar Arnfjörð Bjarmason, (Thu Aug 19, 1:31 pm)
Re: [PATCH] compat/regex: define out variables only used u ..., Ævar Arnfjörð Bjarmason, (Thu Aug 19, 2:30 pm)
[PATCH] compat/regex: get rid of old-style definition, Junio C Hamano, (Thu Aug 19, 3:45 pm)
Re: [PATCH] compat/regex: get rid of old-style definition, Ævar Arnfjörð Bjarmason, (Fri Aug 20, 12:47 am)
Re: [PATCH] compat/regex: get rid of old-style definition, Karsten Blees, (Wed Aug 25, 11:24 am)
[PATCH] Fix compat/regex ANSIfication on MinGW, Johannes Sixt, (Thu Aug 26, 12:58 am)
Re: [PATCH] Fix compat/regex ANSIfication on MinGW, Ævar Arnfjörð Bjarmason, (Thu Aug 26, 1:34 pm)
Re: [PATCH] Fix compat/regex ANSIfication on MinGW, Ævar Arnfjörð Bjarmason, (Fri Sep 3, 3:21 pm)
Re: [PATCH] Fix compat/regex ANSIfication on MinGW, Junio C Hamano, (Fri Sep 3, 10:22 pm)