From 4b47e5a4bb656ebb5bd493d1ad6f79eaf4f298e1 Mon Sep 17 00:00:00 2001
From: Kirill Volinsky
If your program may sometimes be linked with versions of PCRE that are older -than 8.20, but you want to use JIT when it is available, you can test -the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such -as PCRE_CONFIG_JIT, for compile-time control of your code. +than 8.20, but you want to use JIT when it is available, you can test the +values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such as +PCRE_CONFIG_JIT, for compile-time control of your code. Also beware that the +pcre_jit_exec() function was not available at all before 8.32, +and may not be available at all if PCRE isn't compiled with +--enable-jit. See the "JIT FAST PATH API" section below for details.
@@ -119,6 +122,20 @@ when you call pcre_study(): PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE +If using pcre_jit_exec() and supporting a pre-8.32 version of +PCRE, you can insert: +
+ #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32 + pcre_jit_exec(...); + #else + pcre_exec(...) + #endif ++but as described in the "JIT FAST PATH API" section below this assumes +version 8.32 and later are compiled with --enable-jit, which may +break. +
+Note that the pcre_jit_exec() function is not available in versions of +PCRE before 8.32 (released in November 2012). If you need to support versions +that old you must either use the slower pcre_exec(), or switch between +the two codepaths by checking the values of PCRE_MAJOR and PCRE_MINOR. +
++Due to an unfortunate implementation oversight, even in versions 8.32 +and later there will be no pcre_jit_exec() stub function defined +when PCRE is compiled with --disable-jit, which is the default, and +there's no way to detect whether PCRE was compiled with --enable-jit +via a macro. +
++If you need to support versions older than 8.32, or versions that may +not build with --enable-jit, you must either use the slower +pcre_exec(), or switch between the two codepaths by checking the +values of PCRE_MAJOR and PCRE_MINOR. +
++Switching between the two by checking the version assumes that all the +versions being targeted are built with --enable-jit. To also support +builds that may use --disable-jit either pcre_exec() must be +used, or a compile-time check for JIT via pcre_config() (which +assumes the runtime environment will be the same), or as the Git +project decided to do, simply assume that pcre_jit_exec() is +present in 8.32 or later unless a compile-time flag is provided, see +the "grep: un-break building with PCRE >= 8.32 without --enable-jit" +commit in git.git for an example of that. +
pcreapi(3) @@ -443,9 +490,9 @@ Cambridge CB2 3QH, England.
-Last updated: 17 March 2013
+Last updated: 05 July 2017
-Copyright © 1997-2013 University of Cambridge.
+Copyright © 1997-2017 University of Cambridge.
Return to the PCRE index page. -- cgit v1.2.3