{"thread":{"id":"27383","subject":"[PATCH] compat/regex/regexec.c: Fix some sparse warnings","startedAt":"2011-05-17T17:40:20Z","lastAt":"2011-05-18T04:04:06Z","messageCount":3,"participants":["Ramsay Jones","Ævar Arnfjörð Bjarmason","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"168074","messageId":"4DD2B304.90305@ramsay1.demon.co.uk","threadId":"27383","inReplyTo":null,"subject":"[PATCH] compat/regex/regexec.c: Fix some sparse warnings","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2011-05-17T17:40:20Z","receivedAt":"2011-05-17T17:40:20Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nIn particular, sparse issues the following warnings:\n\n        SP compat/regex/regex.c\n    .../regexec.c:2329:40: warning: Using plain integer as NULL pointer\n    .../regexec.c:2316:15: warning: symbol 'merge_state_with_log' was \\\n        not declared. Should it be static?\n    .../regexec.c:2395:15: warning: symbol 'find_recover_state' was not \\\n        declared. Should it be static?\n\nIn order to fix the \"symbol not declared\" warnings (they are in fact\ndeclared static earlier in the file), we simply add the static modifier\nto the function definitions.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nHi Junio,\n\nNow that I'm building git with NO_REGEX=1 in my config.mak, I'm also\nseeing these sparse warnings.\n\nNote that the \"symbol not declared\" warnings actually highlight\na sparse bug; the earlier static function declarations should have\n(effectively) 'transferred' the static modifier to the corresponding\nfunction definition ...\n[I have a testcase for this in my sparse repo, but I don't seem to have\nfound time to actually create a patch to fix this. :(]\n\nATB,\nRamsay Jones\n \n compat/regex/regexec.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/compat/regex/regexec.c b/compat/regex/regexec.c\nindex 0194965..0cd6e0e 100644\n--- a/compat/regex/regexec.c\n+++ b/compat/regex/regexec.c\n@@ -2313,7 +2313,7 @@ transit_state (reg_errcode_t *err, re_match_context_t *mctx,\n }\n \n /* Update the state_log if we need */\n-re_dfastate_t *\n+static re_dfastate_t *\n internal_function\n merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,\n \t\t      re_dfastate_t *next_state)\n@@ -2326,7 +2326,7 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,\n       mctx->state_log[cur_idx] = next_state;\n       mctx->state_log_top = cur_idx;\n     }\n-  else if (mctx->state_log[cur_idx] == 0)\n+  else if (mctx->state_log[cur_idx] == NULL)\n     {\n       mctx->state_log[cur_idx] = next_state;\n     }\n@@ -2392,7 +2392,7 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,\n /* Skip bytes in the input that correspond to part of a\n    multi-byte match, then look in the log for a state\n    from which to restart matching.  */\n-re_dfastate_t *\n+static re_dfastate_t *\n internal_function\n find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)\n {\n-- \n1.7.5\n"},{"id":"168087","messageId":"BANLkTimQ9N3kYP+fWj+ifnav67fBYo1-oA@mail.gmail.com","threadId":"27383","inReplyTo":"4DD2B304.90305@ramsay1.demon.co.uk","subject":"Re: [PATCH] compat/regex/regexec.c: Fix some sparse warnings","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-05-17T22:52:40Z","receivedAt":"2011-05-17T22:52:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, May 17, 2011 at 19:40, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:\n> In particular, sparse issues the following warnings:\n\nAside from this specific change, I think it's a problem that we pull\nin external libraries, then apply patches to them that upstream would\nprobably want, don't tell upstream, and will inevitably have to deal\nwith conflict when we merge in new versions from upstream.\n\nMaybe we should have some file with contact details for these compat\nlibraries, and try to resolve issues with upstream if we need to apply\npatches like this one?\n"},{"id":"168097","messageId":"7vy624ejt5.fsf@alter.siamese.dyndns.org","threadId":"27383","inReplyTo":"4DD2B304.90305@ramsay1.demon.co.uk","subject":"Re: [PATCH] compat/regex/regexec.c: Fix some sparse warnings","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-18T04:04:06Z","receivedAt":"2011-05-18T04:04:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n\n> In particular, sparse issues the following warnings:\n>\n>         SP compat/regex/regex.c\n\nI'd rather leave stuff in compat/ that were imported from other people\nintact, unless they are functionally wrong. We don't fix their styles\neither.\n\nReplacing our copy with newer versions that have fixed these issues from\nupstreams is Ok, though.\n"}]}