git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Aharon Robbins" <arnold@skeeve.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH] compat/regex: define out variables only used under RE_ENABLE_I18N
Date: Thu, 19 Aug 2010 18:30:01 +0000	[thread overview]
Message-ID: <1282242601-2630-1-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <201008191805.o7JI5Aw0002340@localhost.localdomain>

Wrap variables that were only used RE_ENABLE_I18N in `#ifdef
RE_ENABLE_I18N`. This eliminates compiler warnings when compiling with
NO_REGEX=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

On Thu, Aug 19, 2010 at 18:05, Aharon Robbins <arnold@skeeve.com> wrote:
> Hi! Re this:
>
>> Date: Thu, 19 Aug 2010 13:16:56 +0000
>> Subject: Fwd: What's cooking in git.git (Aug 2010, #04; Wed, 18)
>> From: ??var Arnfj??r?? Bjarmason <avarab@gmail.com>
>> To: "Arnold D. Robbins" <arnold@skeeve.com>
>>
>> Hi there. The Git project grabbed the gawk regex engine to use as a
>> compat engine in case the platform we're working on doesn't support
>> REG_STARTEND. But because we don't compile it with RE_ENABLE_I18N
>> it'll spew some warnings about unused variables (see below). Here's a
>> patch to solve this:
>
> Wow! It's really cool to be upstream for someone else. :-)

Cool that someone else is teasing useful code out of glibc so I don't
have to :)

> Thanks for the patch. I'll get it into my code base.

Junio, here's a version of this patch for our tree.

>> I was going to report this upstream once I got around to finding out
>> what upstream *is*, I don't *think* gawk itself is the canonical
>> upstream, they just copy it from somewhere else (again, I *think*).
>
> About every year or so, I sync from whatever is in GLIBC.  But my version
> has a number of additional fixes that have not been accepted back into
> the GLIBC version.
>
> The only other possible candidate for an "upstream" source would be the
> version in gnulib.

That's good to know. B.t.w. we have to compile with -DNO_MBSUPPORT
because regex_internal.h will pull in mbsupport.h if it's defined,
which is a GPLv3 header, the rest being LGPL 2.1.

I don't even know if we want mbsupport.h, but if it's possible to
relicense mbsupport.h to LGPL 2.1 it'd be easier for projects like Git
to pull in the gawk regex engine.

 compat/regex/regex_internal.c |    2 +-
 compat/regex/regexec.c        |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/compat/regex/regex_internal.c b/compat/regex/regex_internal.c
index dad17a8..193854c 100644
--- a/compat/regex/regex_internal.c
+++ b/compat/regex/regex_internal.c
@@ -692,10 +692,10 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
 	}
       else
 	{
+#ifdef RE_ENABLE_I18N
 	  /* No, skip all characters until IDX.  */
 	  int prev_valid_len = pstr->valid_len;
 
-#ifdef RE_ENABLE_I18N
 	  if (BE (pstr->offsets_needed, 0))
 	    {
 	      pstr->len = pstr->raw_len - idx + offset;
diff --git a/compat/regex/regexec.c b/compat/regex/regexec.c
index aee502d..0c2b054 100644
--- a/compat/regex/regexec.c
+++ b/compat/regex/regexec.c
@@ -3059,7 +3059,9 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx,
   const re_dfa_t *const dfa = mctx->dfa;
   int result;
   int cur_idx;
+#ifdef RE_ENABLE_I18N
   reg_errcode_t err = REG_NOERROR;
+#endif
   re_node_set union_set;
   re_node_set_init_empty (&union_set);
   for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx)
-- 
1.7.2.1.446.g168052

  reply	other threads:[~2010-08-19 18:30 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           ` Ævar Arnfjörð Bjarmason [this message]
2010-08-19 20:02             ` [PATCH] compat/regex: define out variables only used under RE_ENABLE_I18N 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                       ` [PATCH] Fix compat/regex ANSIfication on MinGW Johannes Sixt
2010-08-26 20:34                         ` Æ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=1282242601-2630-1-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=arnold@skeeve.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).