Skip to content

Commit 5074d60

Browse files
authored
build: FTBFS for pcre2_dftables (#314)
Since fb84d73 (Add compile-time check that PCRE2_CODE_UNIT_WIDTH is 8, 16, or 32, 2023-06-19), building pcre2_dftables had failed. Add a similar exception to the one what was already in use for pcre2test and while at it, update the dist file.
1 parent 8d3e96c commit 5074d60

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ test-driver
5959
test-suite.log
6060
test3input
6161
test3output
62+
test3outputA
63+
test3outputB
6264
testNinput
6365
testNinputgrep
6466
teststderr

src/pcre2_chartables.c.dist

+3-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
/* This file was automatically written by the pcre2_dftables auxiliary
66
program. It contains character tables that are used when no external
77
tables are passed to PCRE2 by the application that calls it. The tables
8-
are used only for characters whose code values are less than 256. */
8+
are used only for characters whose code values are less than 256, and
9+
only relevant if not in UCP mode. */
910

1011
/* This set of tables was written in the C locale. */
1112

@@ -18,13 +19,6 @@ PCRE2 is configured with --enable-rebuild-chartables. However, you can run
1819
pcre2_dftables manually with the -L option to build tables using the LC_ALL
1920
locale. */
2021

21-
/* The following #include is present because without it gcc 4.x may remove
22-
the array definition from the final binary if PCRE2 is built into a static
23-
library and dead code stripping is activated. This leads to link errors.
24-
Pulling in the header ensures that the array gets flagged as "someone
25-
outside this compilation unit might reference this" and so it will always
26-
be supplied to the linker. */
27-
2822
#ifdef HAVE_CONFIG_H
2923
#include "config.h"
3024
#endif
@@ -163,7 +157,7 @@ graph, print, punct, and cntrl. Other classes are built from combinations. */
163157
0x02 letter
164158
0x04 lower case letter
165159
0x08 decimal digit
166-
0x10 alphanumeric or '_'
160+
0x10 word (alphanumeric or '_')
167161
*/
168162

169163
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */

src/pcre2_dftables.c

+7-13
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ given, they are written in binary. */
5656
#include <string.h>
5757
#include <locale.h>
5858

59+
#define PCRE2_DFTABLES /* for pcre2_internal.h, pcre2_maketables.c */
60+
5961
#define PCRE2_CODE_UNIT_WIDTH 0 /* Must be set, but not relevant here */
6062
#include "pcre2_internal.h"
6163

62-
#define PCRE2_DFTABLES /* pcre2_maketables.c notices this */
6364
#include "pcre2_maketables.c"
6465

6566

@@ -98,8 +99,8 @@ int i;
9899
int nclass = 0;
99100
BOOL binary = FALSE;
100101
char *env = (char *)"C";
101-
const unsigned char *tables;
102-
const unsigned char *base_of_tables;
102+
const uint8_t *tables;
103+
const uint8_t *base_of_tables;
103104

104105
/* Process options */
105106

@@ -180,7 +181,8 @@ the very long string otherwise. */
180181
"/* This file was automatically written by the pcre2_dftables auxiliary\n"
181182
"program. It contains character tables that are used when no external\n"
182183
"tables are passed to PCRE2 by the application that calls it. The tables\n"
183-
"are used only for characters whose code values are less than 256. */\n\n");
184+
"are used only for characters whose code values are less than 256, and\n"
185+
"only relevant if not in UCP mode. */\n\n");
184186

185187
(void)fprintf(f,
186188
"/* This set of tables was written in the %s locale. */\n\n", env);
@@ -205,14 +207,6 @@ the very long string otherwise. */
205207
"#endif\n\n");
206208
#endif
207209

208-
(void)fprintf(f,
209-
"/* The following #include is present because without it gcc 4.x may remove\n"
210-
"the array definition from the final binary if PCRE2 is built into a static\n"
211-
"library and dead code stripping is activated. This leads to link errors.\n"
212-
"Pulling in the header ensures that the array gets flagged as \"someone\n"
213-
"outside this compilation unit might reference this\" and so it will always\n"
214-
"be supplied to the linker. */\n\n");
215-
216210
(void)fprintf(f,
217211
"#ifdef HAVE_CONFIG_H\n"
218212
"#include \"config.h\"\n"
@@ -269,7 +263,7 @@ for (i = 0; i < cbit_length; i++)
269263
" 0x%02x letter\n"
270264
" 0x%02x lower case letter\n"
271265
" 0x%02x decimal digit\n"
272-
" 0x%02x alphanumeric or '_'\n*/\n\n",
266+
" 0x%02x word (alphanumeric or '_')\n*/\n\n",
273267
ctype_space, ctype_letter, ctype_lcletter, ctype_digit, ctype_word);
274268

275269
(void)fprintf(f, " ");

src/pcre2_internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ be including this file. There is no explicit way of forcing a compile to be
5959
abandoned, but trying to include a non-existent file seems cleanest. Otherwise
6060
there will be many irrelevant consequential errors. */
6161

62-
#if !defined PCRE2_BUILDING_PCRE2TEST && \
62+
#if (!defined PCRE2_BUILDING_PCRE2TEST && !defined PCRE2_DFTABLES) && \
6363
(!defined PCRE2_CODE_UNIT_WIDTH || \
6464
(PCRE2_CODE_UNIT_WIDTH != 8 && \
6565
PCRE2_CODE_UNIT_WIDTH != 16 && \

0 commit comments

Comments
 (0)