Ignore all JIT compile errors in pcre2grep.
This commit is contained in:
parent
6332aa1101
commit
224e707ab0
|
@ -321,6 +321,10 @@ characters in the same "not-x" sublists.
|
||||||
its start; pcre2test was not handling this correctly when using the POSIX
|
its start; pcre2test was not handling this correctly when using the POSIX
|
||||||
interface (it was OK with the native interface).
|
interface (it was OK with the native interface).
|
||||||
|
|
||||||
|
50. In pcre2grep, ignore all JIT compile errors. This means that pcre2grep will
|
||||||
|
continue to work, falling back to interpretation if anything goes wrong with
|
||||||
|
JIT.
|
||||||
|
|
||||||
|
|
||||||
Version 10.22 29-July-2016
|
Version 10.22 29-July-2016
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
|
@ -386,11 +386,6 @@ static option_item optionlist[] = {
|
||||||
{ OP_NODATA, 'h', NULL, "no-filename", "suppress the prefixing filename on output" },
|
{ OP_NODATA, 'h', NULL, "no-filename", "suppress the prefixing filename on output" },
|
||||||
{ OP_NODATA, 'I', NULL, "", "treat binary files as not matching (ignore)" },
|
{ OP_NODATA, 'I', NULL, "", "treat binary files as not matching (ignore)" },
|
||||||
{ OP_NODATA, 'i', NULL, "ignore-case", "ignore case distinctions" },
|
{ OP_NODATA, 'i', NULL, "ignore-case", "ignore case distinctions" },
|
||||||
#ifdef SUPPORT_PCRE2GREP_JIT
|
|
||||||
{ OP_NODATA, N_NOJIT, NULL, "no-jit", "do not use just-in-time compiler optimization" },
|
|
||||||
#else
|
|
||||||
{ OP_NODATA, N_NOJIT, NULL, "no-jit", "ignored: this pcre2grep does not support JIT" },
|
|
||||||
#endif
|
|
||||||
{ OP_NODATA, 'l', NULL, "files-with-matches", "print only FILE names containing matches" },
|
{ OP_NODATA, 'l', NULL, "files-with-matches", "print only FILE names containing matches" },
|
||||||
{ OP_NODATA, 'L', NULL, "files-without-match","print only FILE names not containing matches" },
|
{ OP_NODATA, 'L', NULL, "files-without-match","print only FILE names not containing matches" },
|
||||||
{ OP_STRING, N_LABEL, &stdin_name, "label=name", "set name for standard input" },
|
{ OP_STRING, N_LABEL, &stdin_name, "label=name", "set name for standard input" },
|
||||||
|
@ -402,6 +397,11 @@ static option_item optionlist[] = {
|
||||||
{ OP_NODATA, 'M', NULL, "multiline", "run in multiline mode" },
|
{ OP_NODATA, 'M', NULL, "multiline", "run in multiline mode" },
|
||||||
{ OP_STRING, 'N', &newline_arg, "newline=type", "set newline type (CR, LF, CRLF, ANYCRLF or ANY)" },
|
{ OP_STRING, 'N', &newline_arg, "newline=type", "set newline type (CR, LF, CRLF, ANYCRLF or ANY)" },
|
||||||
{ OP_NODATA, 'n', NULL, "line-number", "print line number with output lines" },
|
{ OP_NODATA, 'n', NULL, "line-number", "print line number with output lines" },
|
||||||
|
#ifdef SUPPORT_PCRE2GREP_JIT
|
||||||
|
{ OP_NODATA, N_NOJIT, NULL, "no-jit", "do not use just-in-time compiler optimization" },
|
||||||
|
#else
|
||||||
|
{ OP_NODATA, N_NOJIT, NULL, "no-jit", "ignored: this pcre2grep does not support JIT" },
|
||||||
|
#endif
|
||||||
{ OP_OP_NUMBERS, 'o', &only_matching_data, "only-matching=n", "show only the part of the line that matched" },
|
{ OP_OP_NUMBERS, 'o', &only_matching_data, "only-matching=n", "show only the part of the line that matched" },
|
||||||
{ OP_STRING, N_OM_SEPARATOR, &om_separator, "om-separator=text", "set separator for multiple -o output" },
|
{ OP_STRING, N_OM_SEPARATOR, &om_separator, "om-separator=text", "set separator for multiple -o output" },
|
||||||
{ OP_NODATA, 'q', NULL, "quiet", "suppress output, just set return code" },
|
{ OP_NODATA, 'q', NULL, "quiet", "suppress output, just set return code" },
|
||||||
|
@ -3011,23 +3011,19 @@ sprintf((char *)buffer, "%s%.*s%s", prefix[popts], patlen, ps, suffix[popts]);
|
||||||
p->compiled = pcre2_compile(buffer, PCRE2_ZERO_TERMINATED, options, &errcode,
|
p->compiled = pcre2_compile(buffer, PCRE2_ZERO_TERMINATED, options, &errcode,
|
||||||
&erroffset, compile_context);
|
&erroffset, compile_context);
|
||||||
|
|
||||||
/* Handle successful compile */
|
/* Handle successful compile. Try JIT-compiling if supported and enabled. We
|
||||||
|
ignore any JIT compiler errors, relying falling back to interpreting if
|
||||||
|
anything goes wrong with JIT. */
|
||||||
|
|
||||||
if (p->compiled != NULL)
|
if (p->compiled != NULL)
|
||||||
{
|
{
|
||||||
#ifdef SUPPORT_PCRE2GREP_JIT
|
#ifdef SUPPORT_PCRE2GREP_JIT
|
||||||
if (use_jit)
|
if (use_jit) (void)pcre2_jit_compile(p->compiled, PCRE2_JIT_COMPLETE);
|
||||||
{
|
|
||||||
errcode = pcre2_jit_compile(p->compiled, PCRE2_JIT_COMPLETE);
|
|
||||||
if (errcode == 0) return TRUE;
|
|
||||||
erroffset = PCRE2_SIZE_MAX; /* Will get reduced to patlen below */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle compile and JIT compile errors */
|
/* Handle compile errors */
|
||||||
|
|
||||||
erroffset -= (int)strlen(prefix[popts]);
|
erroffset -= (int)strlen(prefix[popts]);
|
||||||
if (erroffset > patlen) erroffset = patlen;
|
if (erroffset > patlen) erroffset = patlen;
|
||||||
|
|
Loading…
Reference in New Issue