github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

665 lines
24 KiB

  1. .TH PCRE2BUILD 3 "15 April 2024" "PCRE2 10.44"
  2. .SH NAME
  3. PCRE2 - Perl-compatible regular expressions (revised API)
  4. .
  5. .
  6. .SH "BUILDING PCRE2"
  7. .rs
  8. .sp
  9. PCRE2 is distributed with a \fBconfigure\fP script that can be used to build
  10. the library in Unix-like environments using the applications known as
  11. Autotools. Also in the distribution are files to support building using
  12. \fBCMake\fP instead of \fBconfigure\fP. The text file
  13. .\" HTML <a href="README.txt">
  14. .\" </a>
  15. \fBREADME\fP
  16. .\"
  17. contains general information about building with Autotools (some of which is
  18. repeated below), and also has some comments about building on various operating
  19. systems. The files in the \fBvms\fP directory support building under OpenVMS.
  20. There is a lot more information about building PCRE2 without using
  21. Autotools (including information about using \fBCMake\fP and building "by
  22. hand") in the text file called
  23. .\" HTML <a href="NON-AUTOTOOLS-BUILD.txt">
  24. .\" </a>
  25. \fBNON-AUTOTOOLS-BUILD\fP.
  26. .\"
  27. You should consult this file as well as the
  28. .\" HTML <a href="README.txt">
  29. .\" </a>
  30. \fBREADME\fP
  31. .\"
  32. file if you are building in a non-Unix-like environment.
  33. .
  34. .
  35. .SH "PCRE2 BUILD-TIME OPTIONS"
  36. .rs
  37. .sp
  38. The rest of this document describes the optional features of PCRE2 that can be
  39. selected when the library is compiled. It assumes use of the \fBconfigure\fP
  40. script, where the optional features are selected or deselected by providing
  41. options to \fBconfigure\fP before running the \fBmake\fP command. However, the
  42. same options can be selected in both Unix-like and non-Unix-like environments
  43. if you are using \fBCMake\fP instead of \fBconfigure\fP to build PCRE2.
  44. .P
  45. If you are not using Autotools or \fBCMake\fP, option selection can be done by
  46. editing the \fBconfig.h\fP file, or by passing parameter settings to the
  47. compiler, as described in
  48. .\" HTML <a href="NON-AUTOTOOLS-BUILD.txt">
  49. .\" </a>
  50. \fBNON-AUTOTOOLS-BUILD\fP.
  51. .\"
  52. .P
  53. The complete list of options for \fBconfigure\fP (which includes the standard
  54. ones such as the selection of the installation directory) can be obtained by
  55. running
  56. .sp
  57. ./configure --help
  58. .sp
  59. The following sections include descriptions of "on/off" options whose names
  60. begin with --enable or --disable. Because of the way that \fBconfigure\fP
  61. works, --enable and --disable always come in pairs, so the complementary option
  62. always exists as well, but as it specifies the default, it is not described.
  63. Options that specify values have names that start with --with. At the end of a
  64. \fBconfigure\fP run, a summary of the configuration is output.
  65. .
  66. .
  67. .SH "BUILDING 8-BIT, 16-BIT AND 32-BIT LIBRARIES"
  68. .rs
  69. .sp
  70. By default, a library called \fBlibpcre2-8\fP is built, containing functions
  71. that take string arguments contained in arrays of bytes, interpreted either as
  72. single-byte characters, or UTF-8 strings. You can also build two other
  73. libraries, called \fBlibpcre2-16\fP and \fBlibpcre2-32\fP, which process
  74. strings that are contained in arrays of 16-bit and 32-bit code units,
  75. respectively. These can be interpreted either as single-unit characters or
  76. UTF-16/UTF-32 strings. To build these additional libraries, add one or both of
  77. the following to the \fBconfigure\fP command:
  78. .sp
  79. --enable-pcre2-16
  80. --enable-pcre2-32
  81. .sp
  82. If you do not want the 8-bit library, add
  83. .sp
  84. --disable-pcre2-8
  85. .sp
  86. as well. At least one of the three libraries must be built. Note that the POSIX
  87. wrapper is for the 8-bit library only, and that \fBpcre2grep\fP is an 8-bit
  88. program. Neither of these are built if you select only the 16-bit or 32-bit
  89. libraries.
  90. .
  91. .
  92. .SH "BUILDING SHARED AND STATIC LIBRARIES"
  93. .rs
  94. .sp
  95. The Autotools PCRE2 building process uses \fBlibtool\fP to build both shared
  96. and static libraries by default. You can suppress an unwanted library by adding
  97. one of
  98. .sp
  99. --disable-shared
  100. --disable-static
  101. .sp
  102. to the \fBconfigure\fP command. Setting --disable-shared ensures that PCRE2
  103. libraries are built as static libraries. The binaries that are then created as
  104. part of the build process (for example, \fBpcre2test\fP and \fBpcre2grep\fP)
  105. are linked statically with one or more PCRE2 libraries, but may also be
  106. dynamically linked with other libraries such as \fBlibc\fP. If you want these
  107. binaries to be fully statically linked, you can set LDFLAGS like this:
  108. .sp
  109. LDFLAGS=--static ./configure --disable-shared
  110. .sp
  111. Note the two hyphens in --static. Of course, this works only if static versions
  112. of all the relevant libraries are available for linking.
  113. .
  114. .
  115. .SH "UNICODE AND UTF SUPPORT"
  116. .rs
  117. .sp
  118. By default, PCRE2 is built with support for Unicode and UTF character strings.
  119. To build it without Unicode support, add
  120. .sp
  121. --disable-unicode
  122. .sp
  123. to the \fBconfigure\fP command. This setting applies to all three libraries. It
  124. is not possible to build one library with Unicode support and another without
  125. in the same configuration.
  126. .P
  127. Of itself, Unicode support does not make PCRE2 treat strings as UTF-8, UTF-16
  128. or UTF-32. To do that, applications that use the library can set the PCRE2_UTF
  129. option when they call \fBpcre2_compile()\fP to compile a pattern.
  130. Alternatively, patterns may be started with (*UTF) unless the application has
  131. locked this out by setting PCRE2_NEVER_UTF.
  132. .P
  133. UTF support allows the libraries to process character code points up to
  134. 0x10ffff in the strings that they handle. Unicode support also gives access to
  135. the Unicode properties of characters, using pattern escapes such as \eP, \ep,
  136. and \eX. Only the general category properties such as \fILu\fP and \fINd\fP,
  137. script names, and some bi-directional properties are supported. Details are
  138. given in the
  139. .\" HREF
  140. \fBpcre2pattern\fP
  141. .\"
  142. documentation.
  143. .P
  144. Pattern escapes such as \ed and \ew do not by default make use of Unicode
  145. properties. The application can request that they do by setting the PCRE2_UCP
  146. option. Unless the application has set PCRE2_NEVER_UCP, a pattern may also
  147. request this by starting with (*UCP).
  148. .
  149. .
  150. .SH "DISABLING THE USE OF \eC"
  151. .rs
  152. .sp
  153. The \eC escape sequence, which matches a single code unit, even in a UTF mode,
  154. can cause unpredictable behaviour because it may leave the current matching
  155. point in the middle of a multi-code-unit character. The application can lock it
  156. out by setting the PCRE2_NEVER_BACKSLASH_C option when calling
  157. \fBpcre2_compile()\fP. There is also a build-time option
  158. .sp
  159. --enable-never-backslash-C
  160. .sp
  161. (note the upper case C) which locks out the use of \eC entirely.
  162. .
  163. .
  164. .SH "JUST-IN-TIME COMPILER SUPPORT"
  165. .rs
  166. .sp
  167. Just-in-time (JIT) compiler support is included in the build by specifying
  168. .sp
  169. --enable-jit
  170. .sp
  171. This support is available only for certain hardware architectures. If this
  172. option is set for an unsupported architecture, a building error occurs.
  173. If in doubt, use
  174. .sp
  175. --enable-jit=auto
  176. .sp
  177. which enables JIT only if the current hardware is supported. You can check
  178. if JIT is enabled in the configuration summary that is output at the end of a
  179. \fBconfigure\fP run. If you are enabling JIT under SELinux you may also want to
  180. add
  181. .sp
  182. --enable-jit-sealloc
  183. .sp
  184. which enables the use of an execmem allocator in JIT that is compatible with
  185. SELinux. This has no effect if JIT is not enabled. See the
  186. .\" HREF
  187. \fBpcre2jit\fP
  188. .\"
  189. documentation for a discussion of JIT usage. When JIT support is enabled,
  190. \fBpcre2grep\fP automatically makes use of it, unless you add
  191. .sp
  192. --disable-pcre2grep-jit
  193. .sp
  194. to the \fBconfigure\fP command.
  195. .
  196. .
  197. .SH "NEWLINE RECOGNITION"
  198. .rs
  199. .sp
  200. By default, PCRE2 interprets the linefeed (LF) character as indicating the end
  201. of a line. This is the normal newline character on Unix-like systems. You can
  202. compile PCRE2 to use carriage return (CR) instead, by adding
  203. .sp
  204. --enable-newline-is-cr
  205. .sp
  206. to the \fBconfigure\fP command. There is also an --enable-newline-is-lf option,
  207. which explicitly specifies linefeed as the newline character.
  208. .P
  209. Alternatively, you can specify that line endings are to be indicated by the
  210. two-character sequence CRLF (CR immediately followed by LF). If you want this,
  211. add
  212. .sp
  213. --enable-newline-is-crlf
  214. .sp
  215. to the \fBconfigure\fP command. There is a fourth option, specified by
  216. .sp
  217. --enable-newline-is-anycrlf
  218. .sp
  219. which causes PCRE2 to recognize any of the three sequences CR, LF, or CRLF as
  220. indicating a line ending. A fifth option, specified by
  221. .sp
  222. --enable-newline-is-any
  223. .sp
  224. causes PCRE2 to recognize any Unicode newline sequence. The Unicode newline
  225. sequences are the three just mentioned, plus the single characters VT (vertical
  226. tab, U+000B), FF (form feed, U+000C), NEL (next line, U+0085), LS (line
  227. separator, U+2028), and PS (paragraph separator, U+2029). The final option is
  228. .sp
  229. --enable-newline-is-nul
  230. .sp
  231. which causes NUL (binary zero) to be set as the default line-ending character.
  232. .P
  233. Whatever default line ending convention is selected when PCRE2 is built can be
  234. overridden by applications that use the library. At build time it is
  235. recommended to use the standard for your operating system.
  236. .
  237. .
  238. .SH "WHAT \eR MATCHES"
  239. .rs
  240. .sp
  241. By default, the sequence \eR in a pattern matches any Unicode newline sequence,
  242. independently of what has been selected as the line ending sequence. If you
  243. specify
  244. .sp
  245. --enable-bsr-anycrlf
  246. .sp
  247. the default is changed so that \eR matches only CR, LF, or CRLF. Whatever is
  248. selected when PCRE2 is built can be overridden by applications that use the
  249. library.
  250. .
  251. .
  252. .SH "HANDLING VERY LARGE PATTERNS"
  253. .rs
  254. .sp
  255. Within a compiled pattern, offset values are used to point from one part to
  256. another (for example, from an opening parenthesis to an alternation
  257. metacharacter). By default, in the 8-bit and 16-bit libraries, two-byte values
  258. are used for these offsets, leading to a maximum size for a compiled pattern of
  259. around 64 thousand code units. This is sufficient to handle all but the most
  260. gigantic patterns. Nevertheless, some people do want to process truly enormous
  261. patterns, so it is possible to compile PCRE2 to use three-byte or four-byte
  262. offsets by adding a setting such as
  263. .sp
  264. --with-link-size=3
  265. .sp
  266. to the \fBconfigure\fP command. The value given must be 2, 3, or 4. For the
  267. 16-bit library, a value of 3 is rounded up to 4. In these libraries, using
  268. longer offsets slows down the operation of PCRE2 because it has to load
  269. additional data when handling them. For the 32-bit library the value is always
  270. 4 and cannot be overridden; the value of --with-link-size is ignored.
  271. .
  272. .
  273. .SH "LIMITING PCRE2 RESOURCE USAGE"
  274. .rs
  275. .sp
  276. The \fBpcre2_match()\fP function increments a counter each time it goes round
  277. its main loop. Putting a limit on this counter controls the amount of computing
  278. resource used by a single call to \fBpcre2_match()\fP. The limit can be changed
  279. at run time, as described in the
  280. .\" HREF
  281. \fBpcre2api\fP
  282. .\"
  283. documentation. The default is 10 million, but this can be changed by adding a
  284. setting such as
  285. .sp
  286. --with-match-limit=500000
  287. .sp
  288. to the \fBconfigure\fP command. This setting also applies to the
  289. \fBpcre2_dfa_match()\fP matching function, and to JIT matching (though the
  290. counting is done differently).
  291. .P
  292. The \fBpcre2_match()\fP function uses heap memory to record backtracking
  293. points. The more nested backtracking points there are (that is, the deeper the
  294. search tree), the more memory is needed. There is an upper limit, specified in
  295. kibibytes (units of 1024 bytes). This limit can be changed at run time, as
  296. described in the
  297. .\" HREF
  298. \fBpcre2api\fP
  299. .\"
  300. documentation. The default limit (in effect unlimited) is 20 million. You can
  301. change this by a setting such as
  302. .sp
  303. --with-heap-limit=500
  304. .sp
  305. which limits the amount of heap to 500 KiB. This limit applies only to
  306. interpretive matching in \fBpcre2_match()\fP and \fBpcre2_dfa_match()\fP, which
  307. may also use the heap for internal workspace when processing complicated
  308. patterns. This limit does not apply when JIT (which has its own memory
  309. arrangements) is used.
  310. .P
  311. You can also explicitly limit the depth of nested backtracking in the
  312. \fBpcre2_match()\fP interpreter. This limit defaults to the value that is set
  313. for --with-match-limit. You can set a lower default limit by adding, for
  314. example,
  315. .sp
  316. --with-match-limit-depth=10000
  317. .sp
  318. to the \fBconfigure\fP command. This value can be overridden at run time. This
  319. depth limit indirectly limits the amount of heap memory that is used, but
  320. because the size of each backtracking "frame" depends on the number of
  321. capturing parentheses in a pattern, the amount of heap that is used before the
  322. limit is reached varies from pattern to pattern. This limit was more useful in
  323. versions before 10.30, where function recursion was used for backtracking.
  324. .P
  325. As well as applying to \fBpcre2_match()\fP, the depth limit also controls
  326. the depth of recursive function calls in \fBpcre2_dfa_match()\fP. These are
  327. used for lookaround assertions, atomic groups, and recursion within patterns.
  328. The limit does not apply to JIT matching.
  329. .
  330. .
  331. .SH "LIMITING VARIABLE-LENGTH LOOKBEHIND ASSERTIONS"
  332. .rs
  333. .sp
  334. Lookbehind assertions in which one or more branches can match a variable number
  335. of characters are supported only if there is a maximum matching length for each
  336. top-level branch. There is a limit to this maximum that defaults to 255
  337. characters. You can alter this default by a setting such as
  338. .sp
  339. --with-max-varlookbehind=100
  340. .sp
  341. The limit can be changed at runtime by calling
  342. \fBpcre2_set_max_varlookbehind()\fP. Lookbehind assertions in which every
  343. branch matches a fixed number of characters (not necessarily all the same) are
  344. not constrained by this limit.
  345. .
  346. .
  347. .\" HTML <a name="createtables"></a>
  348. .SH "CREATING CHARACTER TABLES AT BUILD TIME"
  349. .rs
  350. .sp
  351. PCRE2 uses fixed tables for processing characters whose code points are less
  352. than 256. By default, PCRE2 is built with a set of tables that are distributed
  353. in the file \fIsrc/pcre2_chartables.c.dist\fP. These tables are for ASCII codes
  354. only. If you add
  355. .sp
  356. --enable-rebuild-chartables
  357. .sp
  358. to the \fBconfigure\fP command, the distributed tables are no longer used.
  359. Instead, a program called \fBpcre2_dftables\fP is compiled and run. This
  360. outputs the source for new set of tables, created in the default locale of your
  361. C run-time system. This method of replacing the tables does not work if you are
  362. cross compiling, because \fBpcre2_dftables\fP needs to be run on the local
  363. host and therefore not compiled with the cross compiler.
  364. .P
  365. If you need to create alternative tables when cross compiling, you will have to
  366. do so "by hand". There may also be other reasons for creating tables manually.
  367. To cause \fBpcre2_dftables\fP to be built on the local host, run a normal
  368. compiling command, and then run the program with the output file as its
  369. argument, for example:
  370. .sp
  371. cc src/pcre2_dftables.c -o pcre2_dftables
  372. ./pcre2_dftables src/pcre2_chartables.c
  373. .sp
  374. This builds the tables in the default locale of the local host. If you want to
  375. specify a locale, you must use the -L option:
  376. .sp
  377. LC_ALL=fr_FR ./pcre2_dftables -L src/pcre2_chartables.c
  378. .sp
  379. You can also specify -b (with or without -L). This causes the tables to be
  380. written in binary instead of as source code. A set of binary tables can be
  381. loaded into memory by an application and passed to \fBpcre2_compile()\fP in the
  382. same way as tables created by calling \fBpcre2_maketables()\fP. The tables are
  383. just a string of bytes, independent of hardware characteristics such as
  384. endianness. This means they can be bundled with an application that runs in
  385. different environments, to ensure consistent behaviour.
  386. .
  387. .
  388. .SH "USING EBCDIC CODE"
  389. .rs
  390. .sp
  391. PCRE2 assumes by default that it will run in an environment where the character
  392. code is ASCII or Unicode, which is a superset of ASCII. This is the case for
  393. most computer operating systems. PCRE2 can, however, be compiled to run in an
  394. 8-bit EBCDIC environment by adding
  395. .sp
  396. --enable-ebcdic --disable-unicode
  397. .sp
  398. to the \fBconfigure\fP command. This setting implies
  399. --enable-rebuild-chartables. You should only use it if you know that you are in
  400. an EBCDIC environment (for example, an IBM mainframe operating system).
  401. .P
  402. It is not possible to support both EBCDIC and UTF-8 codes in the same version
  403. of the library. Consequently, --enable-unicode and --enable-ebcdic are mutually
  404. exclusive.
  405. .P
  406. The EBCDIC character that corresponds to an ASCII LF is assumed to have the
  407. value 0x15 by default. However, in some EBCDIC environments, 0x25 is used. In
  408. such an environment you should use
  409. .sp
  410. --enable-ebcdic-nl25
  411. .sp
  412. as well as, or instead of, --enable-ebcdic. The EBCDIC character for CR has the
  413. same value as in ASCII, namely, 0x0d. Whichever of 0x15 and 0x25 is \fInot\fP
  414. chosen as LF is made to correspond to the Unicode NEL character (which, in
  415. Unicode, is 0x85).
  416. .P
  417. The options that select newline behaviour, such as --enable-newline-is-cr,
  418. and equivalent run-time options, refer to these character values in an EBCDIC
  419. environment.
  420. .
  421. .
  422. .SH "PCRE2GREP SUPPORT FOR EXTERNAL SCRIPTS"
  423. .rs
  424. .sp
  425. By default \fBpcre2grep\fP supports the use of callouts with string arguments
  426. within the patterns it is matching. There are two kinds: one that generates
  427. output using local code, and another that calls an external program or script.
  428. If --disable-pcre2grep-callout-fork is added to the \fBconfigure\fP command,
  429. only the first kind of callout is supported; if --disable-pcre2grep-callout is
  430. used, all callouts are completely ignored. For more details of \fBpcre2grep\fP
  431. callouts, see the
  432. .\" HREF
  433. \fBpcre2grep\fP
  434. .\"
  435. documentation.
  436. .
  437. .
  438. .SH "PCRE2GREP OPTIONS FOR COMPRESSED FILE SUPPORT"
  439. .rs
  440. .sp
  441. By default, \fBpcre2grep\fP reads all files as plain text. You can build it so
  442. that it recognizes files whose names end in \fB.gz\fP or \fB.bz2\fP, and reads
  443. them with \fBlibz\fP or \fBlibbz2\fP, respectively, by adding one or both of
  444. .sp
  445. --enable-pcre2grep-libz
  446. --enable-pcre2grep-libbz2
  447. .sp
  448. to the \fBconfigure\fP command. These options naturally require that the
  449. relevant libraries are installed on your system. Configuration will fail if
  450. they are not.
  451. .
  452. .
  453. .SH "PCRE2GREP BUFFER SIZE"
  454. .rs
  455. .sp
  456. \fBpcre2grep\fP uses an internal buffer to hold a "window" on the file it is
  457. scanning, in order to be able to output "before" and "after" lines when it
  458. finds a match. The default starting size of the buffer is 20KiB. The buffer
  459. itself is three times this size, but because of the way it is used for holding
  460. "before" lines, the longest line that is guaranteed to be processable is the
  461. notional buffer size. If a longer line is encountered, \fBpcre2grep\fP
  462. automatically expands the buffer, up to a specified maximum size, whose default
  463. is 1MiB or the starting size, whichever is the larger. You can change the
  464. default parameter values by adding, for example,
  465. .sp
  466. --with-pcre2grep-bufsize=51200
  467. --with-pcre2grep-max-bufsize=2097152
  468. .sp
  469. to the \fBconfigure\fP command. The caller of \fBpcre2grep\fP can override
  470. these values by using --buffer-size and --max-buffer-size on the command line.
  471. .
  472. .
  473. .SH "PCRE2TEST OPTION FOR LIBREADLINE SUPPORT"
  474. .rs
  475. .sp
  476. If you add one of
  477. .sp
  478. --enable-pcre2test-libreadline
  479. --enable-pcre2test-libedit
  480. .sp
  481. to the \fBconfigure\fP command, \fBpcre2test\fP is linked with the
  482. \fBlibreadline\fP or\fBlibedit\fP library, respectively, and when its input is
  483. from a terminal, it reads it using the \fBreadline()\fP function. This provides
  484. line-editing and history facilities. Note that \fBlibreadline\fP is
  485. GPL-licensed, so if you distribute a binary of \fBpcre2test\fP linked in this
  486. way, there may be licensing issues. These can be avoided by linking instead
  487. with \fBlibedit\fP, which has a BSD licence.
  488. .P
  489. Setting --enable-pcre2test-libreadline causes the \fB-lreadline\fP option to be
  490. added to the \fBpcre2test\fP build. In many operating environments with a
  491. system-installed readline library this is sufficient. However, in some
  492. environments (e.g. if an unmodified distribution version of readline is in
  493. use), some extra configuration may be necessary. The INSTALL file for
  494. \fBlibreadline\fP says this:
  495. .sp
  496. "Readline uses the termcap functions, but does not link with
  497. the termcap or curses library itself, allowing applications
  498. which link with readline the to choose an appropriate library."
  499. .sp
  500. If your environment has not been set up so that an appropriate library is
  501. automatically included, you may need to add something like
  502. .sp
  503. LIBS="-ncurses"
  504. .sp
  505. immediately before the \fBconfigure\fP command.
  506. .
  507. .
  508. .SH "INCLUDING DEBUGGING CODE"
  509. .rs
  510. .sp
  511. If you add
  512. .sp
  513. --enable-debug
  514. .sp
  515. to the \fBconfigure\fP command, additional debugging code is included in the
  516. build. This feature is intended for use by the PCRE2 maintainers.
  517. .
  518. .
  519. .SH "DEBUGGING WITH VALGRIND SUPPORT"
  520. .rs
  521. .sp
  522. If you add
  523. .sp
  524. --enable-valgrind
  525. .sp
  526. to the \fBconfigure\fP command, PCRE2 will use valgrind annotations to mark
  527. certain memory regions as unaddressable. This allows it to detect invalid
  528. memory accesses, and is mostly useful for debugging PCRE2 itself.
  529. .
  530. .
  531. .SH "CODE COVERAGE REPORTING"
  532. .rs
  533. .sp
  534. If your C compiler is gcc, you can build a version of PCRE2 that can generate a
  535. code coverage report for its test suite. To enable this, you must install
  536. \fBlcov\fP version 1.6 or above. Then specify
  537. .sp
  538. --enable-coverage
  539. .sp
  540. to the \fBconfigure\fP command and build PCRE2 in the usual way.
  541. .P
  542. Note that using \fBccache\fP (a caching C compiler) is incompatible with code
  543. coverage reporting. If you have configured \fBccache\fP to run automatically
  544. on your system, you must set the environment variable
  545. .sp
  546. CCACHE_DISABLE=1
  547. .sp
  548. before running \fBmake\fP to build PCRE2, so that \fBccache\fP is not used.
  549. .P
  550. When --enable-coverage is used, the following addition targets are added to the
  551. \fIMakefile\fP:
  552. .sp
  553. make coverage
  554. .sp
  555. This creates a fresh coverage report for the PCRE2 test suite. It is equivalent
  556. to running "make coverage-reset", "make coverage-baseline", "make check", and
  557. then "make coverage-report".
  558. .sp
  559. make coverage-reset
  560. .sp
  561. This zeroes the coverage counters, but does nothing else.
  562. .sp
  563. make coverage-baseline
  564. .sp
  565. This captures baseline coverage information.
  566. .sp
  567. make coverage-report
  568. .sp
  569. This creates the coverage report.
  570. .sp
  571. make coverage-clean-report
  572. .sp
  573. This removes the generated coverage report without cleaning the coverage data
  574. itself.
  575. .sp
  576. make coverage-clean-data
  577. .sp
  578. This removes the captured coverage data without removing the coverage files
  579. created at compile time (*.gcno).
  580. .sp
  581. make coverage-clean
  582. .sp
  583. This cleans all coverage data including the generated coverage report. For more
  584. information about code coverage, see the \fBgcov\fP and \fBlcov\fP
  585. documentation.
  586. .
  587. .
  588. .SH "DISABLING THE Z AND T FORMATTING MODIFIERS"
  589. .rs
  590. .sp
  591. The C99 standard defines formatting modifiers z and t for size_t and
  592. ptrdiff_t values, respectively. By default, PCRE2 uses these modifiers in
  593. environments other than old versions of Microsoft Visual Studio when
  594. __STDC_VERSION__ is defined and has a value greater than or equal to 199901L
  595. (indicating support for C99).
  596. However, there is at least one environment that claims to be C99 but does not
  597. support these modifiers. If
  598. .sp
  599. --disable-percent-zt
  600. .sp
  601. is specified, no use is made of the z or t modifiers. Instead of %td or %zu,
  602. a suitable format is used depending in the size of long for the platform.
  603. .
  604. .
  605. .SH "SUPPORT FOR FUZZERS"
  606. .rs
  607. .sp
  608. There is a special option for use by people who want to run fuzzing tests on
  609. PCRE2:
  610. .sp
  611. --enable-fuzz-support
  612. .sp
  613. At present this applies only to the 8-bit library. If set, it causes an extra
  614. library called libpcre2-fuzzsupport.a to be built, but not installed. This
  615. contains a single function called LLVMFuzzerTestOneInput() whose arguments are
  616. a pointer to a string and the length of the string. When called, this function
  617. tries to compile the string as a pattern, and if that succeeds, to match it.
  618. This is done both with no options and with some random options bits that are
  619. generated from the string.
  620. .P
  621. Setting --enable-fuzz-support also causes a binary called \fBpcre2fuzzcheck\fP
  622. to be created. This is normally run under valgrind or used when PCRE2 is
  623. compiled with address sanitizing enabled. It calls the fuzzing function and
  624. outputs information about what it is doing. The input strings are specified by
  625. arguments: if an argument starts with "=" the rest of it is a literal input
  626. string. Otherwise, it is assumed to be a file name, and the contents of the
  627. file are the test string.
  628. .
  629. .
  630. .SH "OBSOLETE OPTION"
  631. .rs
  632. .sp
  633. In versions of PCRE2 prior to 10.30, there were two ways of handling
  634. backtracking in the \fBpcre2_match()\fP function. The default was to use the
  635. system stack, but if
  636. .sp
  637. --disable-stack-for-recursion
  638. .sp
  639. was set, memory on the heap was used. From release 10.30 onwards this has
  640. changed (the stack is no longer used) and this option now does nothing except
  641. give a warning.
  642. .
  643. .SH "SEE ALSO"
  644. .rs
  645. .sp
  646. \fBpcre2api\fP(3), \fBpcre2-config\fP(3).
  647. .
  648. .
  649. .SH AUTHOR
  650. .rs
  651. .sp
  652. .nf
  653. Philip Hazel
  654. Retired from University Computing Service
  655. Cambridge, England.
  656. .fi
  657. .
  658. .
  659. .SH REVISION
  660. .rs
  661. .sp
  662. .nf
  663. Last updated: 15 April 2024
  664. Copyright (c) 1997-2024 University of Cambridge.
  665. .fi