git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/7] Update the compat/regex engine from upstream

From
Junio C Hamano <gitster@pobox.com>
Date
May 12, 2017, 00:31 UTC
Message-ID
<xmqq4lwqapbh.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170504220043.25702-1-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> See the first patch for motivation & why.
> ...

I do not necessarily agree with the upgrading strategy outlined in 1/7, but that is a separate issue. There may be some other bits that needs resurrecting out of "git log -p master compat/regex/", but I cannot test them myself (the part changed by the following patch have no effect in an environment where long is intptr_t, so "make NO_REGEX=YesPlease" build does not fail for me), so I'm letting Dscho's Windows builder find it out via Travis.

-- >8 --
Date: Fri, 12 May 2017 09:00:07 +0900
Subject: [PATCH] compat/regex: make it compile with -Werror=int-to-pointer-cast

The change by 56a1a3ab ("Silence GCC's "cast of pointer to integer of a different size" warning", 2015-10-26) may need resurrecting; I do not think an unprotected #include <stdint.h> is the best way to do this, but for the purpose of places that needs further work, thishsould do.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 compat/regex/regcomp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 5e9ea26cd4..5688a639bf 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -24,9 +24,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_STDINT_H
 #include <stdint.h>
-#endif
 
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
@@ -2641,7 +2639,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
     old_tree = NULL;
 
   if (elem->token.type == SUBEXP)
-    postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx);
+    postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem->token.opr.idx);
 
   tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
   if (BE (tree == NULL, 0))
@@ -3868,7 +3866,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
 static reg_errcode_t
 mark_opt_subexp (void *extra, bin_tree_t *node)
 {
-  int idx = (int) (long) extra;
+  int idx = (int) (intptr_t) extra;
   if (node->token.type == SUBEXP && node->token.opr.idx == idx)
     node->token.opt_subexp = 1;
 
-- 
2.13.0-334-gbb1c091dbc
Previous: Junio C Hamano
Message 21 of 21 in “Update the compat/regex engine from upstream”
  1. 0/7 Update the compat/regex engine from upstreamÆvar Arnfjörð Bjarmason, May 4, 2017
  2. 1/7 compat/regex: add a README with a maintenance guideÆvar Arnfjörð Bjarmason, May 4, 2017
  3. Junio C HamanoMay 12, 2017
  4. Johannes SchindelinMay 12, 2017
  5. Junio C HamanoMay 12, 2017
  6. arnold@skeeve.comMay 14, 2017
  7. Junio C HamanoMay 15, 2017
  8. Johannes SchindelinMay 15, 2017
  9. arnold@skeeve.comMay 15, 2017
  10. 2/7 compat/regex: update the gawk regex engine from upstreamÆvar Arnfjörð Bjarmason, May 4, 2017
  11. 3/7 fixup! compat/regex: update the gawk regex engine from upstreamÆvar Arnfjörð Bjarmason, May 4, 2017
  12. Johannes SixtMay 5, 2017
  13. 8/7 fixup! compat/regex: update the gawk regex engine from upstreamÆvar Arnfjörð Bjarmason, May 5, 2017
  14. 4/7 fixup! compat/regex: update the gawk regex engine from upstreamÆvar Arnfjörð Bjarmason, May 4, 2017
  15. 5/7 fixup! compat/regex: update the gawk regex engine from upstreamÆvar Arnfjörð Bjarmason, May 4, 2017
  16. 6/7 fixup! compat/regex: update the gawk regex engine from upstreamÆvar Arnfjörð Bjarmason, May 4, 2017
  17. 7/7 fixup! compat/regex: update the gawk regex engine from upstreamÆvar Arnfjörð Bjarmason, May 4, 2017
  18. Junio C HamanoMay 8, 2017
  19. Ævar Arnfjörð BjarmasonMay 8, 2017
  20. Junio C HamanoMay 8, 2017
  21. Junio C HamanoMay 12, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.