git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Karsten Blees <blees@dcon.de>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH] Fix compat/regex ANSIfication on MinGW
Date: Thu, 26 Aug 2010 09:58:26 +0200	[thread overview]
Message-ID: <4C761EA2.2060904@viscovery.net> (raw)
In-Reply-To: <loom.20100825T200539-742@post.gmane.org>

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:
> this doesn't compile if internal_function is #defined non-empty (e.g. on
> mingw/msysgit). The old-style definitions work.
> 
> In file included from compat/regex/regex.c:78:
> compat/regex/regexec.c:357: error: conflicting types for 're_search_2_stub'
> compat/regex/regexec.c:44: note: previous declaration of 're_search_2_stub' was
> here

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

  reply	other threads:[~2010-08-26  7:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18 22:27 What's cooking in git.git (Aug 2010, #04; Wed, 18) Junio C Hamano
2010-08-19  3:02 ` Jonathan Nieder
2010-08-19  8:06   ` Johannes Sixt
2010-08-19 12:48     ` Ævar Arnfjörð Bjarmason
2010-08-19 15:04       ` Ævar Arnfjörð Bjarmason
     [not found]       ` <AANLkTinkjsLycvV-uvfG14t7Q=uKt+pnpizKCPGirVW1@mail.gmail.com>
2010-08-19 18:05         ` Fwd: " Aharon Robbins
2010-08-19 18:30           ` [PATCH] compat/regex: define out variables only used under RE_ENABLE_I18N Ævar Arnfjörð Bjarmason
2010-08-19 20:02             ` Junio C Hamano
2010-08-19 20:31               ` Ævar Arnfjörð Bjarmason
2010-08-19 21:07                 ` Junio C Hamano
2010-08-19 21:30                   ` Ævar Arnfjörð Bjarmason
2010-08-19 22:45                   ` [PATCH] compat/regex: get rid of old-style definition Junio C Hamano
2010-08-20  7:47                     ` Ævar Arnfjörð Bjarmason
2010-08-25 18:24                     ` Karsten Blees
2010-08-26  7:58                       ` Johannes Sixt [this message]
2010-08-26 20:34                         ` [PATCH] Fix compat/regex ANSIfication on MinGW Ævar Arnfjörð Bjarmason
2010-09-03 21:23                         ` karsten.blees
2010-09-03 22:21                           ` Ævar Arnfjörð Bjarmason
2010-09-04  5:22                             ` Junio C Hamano
2010-09-07 12:56                           ` Johannes Sixt
2010-08-19  3:22 ` jn/update-contrib-example-merge in pu Jonathan Nieder
2010-08-19 12:53 ` What's cooking in git.git (Aug 2010, #04; Wed, 18) Ævar Arnfjörð Bjarmason
2010-08-19 15:27   ` Ævar Arnfjörð Bjarmason

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=4C761EA2.2060904@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=avarab@gmail.com \
    --cc=blees@dcon.de \
    --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).