Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cf64d4e

Browse files
committed
Cleanup for unicode-update build target and test.
In preparation for adding more Unicode tables. Discussion: https://postgr.es/m/63cd8625-68fa-4760-844a-6b7f643336f2@ardentperf.com Reviewed-by: Jeremy Schneider
1 parent 29f114b commit cf64d4e

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

src/common/unicode/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ CPPFLAGS += $(ICU_CFLAGS)
2121
# By default, do nothing.
2222
all:
2323

24-
update-unicode: unicode_category_table.h unicode_norm_table.h unicode_nonspacing_table.h unicode_east_asian_fw_table.h unicode_normprops_table.h unicode_norm_hashfunc.h unicode_version.h
24+
update-unicode: unicode_category_table.h unicode_east_asian_fw_table.h unicode_nonspacing_table.h unicode_norm_hashfunc.h unicode_norm_table.h unicode_normprops_table.h unicode_version.h
2525
mv $^ $(top_srcdir)/src/include/common/
2626
$(MAKE) category-check
2727
$(MAKE) normalization-check
2828

2929
# These files are part of the Unicode Character Database. Download
3030
# them on demand. The dependency on Makefile.global is for
3131
# UNICODE_VERSION.
32-
UnicodeData.txt EastAsianWidth.txt DerivedNormalizationProps.txt CompositionExclusions.txt NormalizationTest.txt: $(top_builddir)/src/Makefile.global
32+
CompositionExclusions.txt DerivedNormalizationProps.txt EastAsianWidth.txt NormalizationTest.txt UnicodeData.txt: $(top_builddir)/src/Makefile.global
3333
$(DOWNLOAD) https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/$(@F)
3434

3535
unicode_version.h: generate-unicode_version.pl
@@ -82,4 +82,4 @@ clean:
8282
rm -f $(OBJS) category_test category_test.o norm_test norm_test.o
8383

8484
distclean: clean
85-
rm -f UnicodeData.txt EastAsianWidth.txt CompositionExclusions.txt NormalizationTest.txt norm_test_table.h unicode_norm_table.h
85+
rm -f CompositionExclusions.txt DerivedNormalizationProps.txt EastAsianWidth.txt NormalizationTest.txt UnicodeData.txt norm_test_table.h unicode_category_table.h unicode_norm_table.h

src/common/unicode/category_test.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
static int
2929
parse_unicode_version(const char *version)
3030
{
31-
int n,
32-
major,
33-
minor;
31+
int n PG_USED_FOR_ASSERTS_ONLY;
32+
int major;
33+
int minor;
3434

3535
n = sscanf(version, "%d.%d", &major, &minor);
3636

@@ -54,8 +54,8 @@ main(int argc, char **argv)
5454
int pg_skipped_codepoints = 0;
5555
int icu_skipped_codepoints = 0;
5656

57-
printf("Postgres Unicode Version:\t%s\n", PG_UNICODE_VERSION);
58-
printf("ICU Unicode Version:\t\t%s\n", U_UNICODE_VERSION);
57+
printf("category_test: Postgres Unicode version:\t%s\n", PG_UNICODE_VERSION);
58+
printf("category_test: ICU Unicode version:\t\t%s\n", U_UNICODE_VERSION);
5959

6060
for (UChar32 code = 0; code <= 0x10ffff; code++)
6161
{
@@ -79,11 +79,11 @@ main(int argc, char **argv)
7979
icu_skipped_codepoints++;
8080
else
8181
{
82-
printf("FAILURE for codepoint %06x\n", code);
83-
printf("Postgres category: %02d %s %s\n", pg_category,
82+
printf("category_test: FAILURE for codepoint 0x%06x\n", code);
83+
printf("category_test: Postgres category: %02d %s %s\n", pg_category,
8484
unicode_category_abbrev(pg_category),
8585
unicode_category_string(pg_category));
86-
printf("ICU category: %02d %s %s\n", icu_category,
86+
printf("category_test: ICU category: %02d %s %s\n", icu_category,
8787
unicode_category_abbrev(icu_category),
8888
unicode_category_string(icu_category));
8989
printf("\n");
@@ -93,16 +93,16 @@ main(int argc, char **argv)
9393
}
9494

9595
if (pg_skipped_codepoints > 0)
96-
printf("Skipped %d codepoints unassigned in Postgres due to Unicode version mismatch.\n",
96+
printf("category_test: skipped %d codepoints unassigned in Postgres due to Unicode version mismatch\n",
9797
pg_skipped_codepoints);
9898
if (icu_skipped_codepoints > 0)
99-
printf("Skipped %d codepoints unassigned in ICU due to Unicode version mismatch.\n",
99+
printf("category_test: skipped %d codepoints unassigned in ICU due to Unicode version mismatch\n",
100100
icu_skipped_codepoints);
101101

102-
printf("category_test: All tests successful!\n");
102+
printf("category_test: success\n");
103103
exit(0);
104104
#else
105-
printf("ICU support required for test; skipping.\n");
105+
printf("category_test: ICU support required for test; skipping\n");
106106
exit(0);
107107
#endif
108108
}

src/common/unicode/meson.build

+22-22
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif
1111

1212
# These files are part of the Unicode Character Database. Download them on
1313
# demand.
14-
foreach f : ['UnicodeData.txt', 'EastAsianWidth.txt', 'DerivedNormalizationProps.txt', 'CompositionExclusions.txt', 'NormalizationTest.txt']
14+
foreach f : ['CompositionExclusions.txt', 'DerivedNormalizationProps.txt', 'EastAsianWidth.txt', 'NormalizationTest.txt', 'UnicodeData.txt']
1515
url = unicode_baseurl.format(UNICODE_VERSION, f)
1616
target = custom_target(f,
1717
output: f,
@@ -24,15 +24,6 @@ endforeach
2424

2525
update_unicode_targets = []
2626

27-
update_unicode_targets += \
28-
custom_target('unicode_version.h',
29-
output: ['unicode_version.h'],
30-
command: [
31-
perl, files('generate-unicode_version.pl'),
32-
'--outdir', '@OUTDIR@', '--version', UNICODE_VERSION],
33-
build_by_default: false,
34-
)
35-
3627
update_unicode_targets += \
3728
custom_target('unicode_category_table.h',
3829
input: [unicode_data['UnicodeData.txt']],
@@ -44,14 +35,12 @@ update_unicode_targets += \
4435
)
4536

4637
update_unicode_targets += \
47-
custom_target('unicode_norm_table.h',
48-
input: [unicode_data['UnicodeData.txt'], unicode_data['CompositionExclusions.txt']],
49-
output: ['unicode_norm_table.h', 'unicode_norm_hashfunc.h'],
50-
depend_files: perfect_hash_pm,
51-
command: [
52-
perl, files('generate-unicode_norm_table.pl'),
53-
'--outdir', '@OUTDIR@', '@INPUT@'],
38+
custom_target('unicode_east_asian_fw_table.h',
39+
input: [unicode_data['EastAsianWidth.txt']],
40+
output: ['unicode_east_asian_fw_table.h'],
41+
command: [perl, files('generate-unicode_east_asian_fw_table.pl'), '@INPUT@'],
5442
build_by_default: false,
43+
capture: true,
5544
)
5645

5746
update_unicode_targets += \
@@ -65,12 +54,14 @@ update_unicode_targets += \
6554
)
6655

6756
update_unicode_targets += \
68-
custom_target('unicode_east_asian_fw_table.h',
69-
input: [unicode_data['EastAsianWidth.txt']],
70-
output: ['unicode_east_asian_fw_table.h'],
71-
command: [perl, files('generate-unicode_east_asian_fw_table.pl'), '@INPUT@'],
57+
custom_target('unicode_norm_table.h',
58+
input: [unicode_data['UnicodeData.txt'], unicode_data['CompositionExclusions.txt']],
59+
output: ['unicode_norm_table.h', 'unicode_norm_hashfunc.h'],
60+
depend_files: perfect_hash_pm,
61+
command: [
62+
perl, files('generate-unicode_norm_table.pl'),
63+
'--outdir', '@OUTDIR@', '@INPUT@'],
7264
build_by_default: false,
73-
capture: true,
7465
)
7566

7667
update_unicode_targets += \
@@ -83,6 +74,15 @@ update_unicode_targets += \
8374
capture: true,
8475
)
8576

77+
update_unicode_targets += \
78+
custom_target('unicode_version.h',
79+
output: ['unicode_version.h'],
80+
command: [
81+
perl, files('generate-unicode_version.pl'),
82+
'--outdir', '@OUTDIR@', '--version', UNICODE_VERSION],
83+
build_by_default: false,
84+
)
85+
8686
norm_test_table = custom_target('norm_test_table.h',
8787
input: [unicode_data['NormalizationTest.txt']],
8888
output: ['norm_test_table.h'],

0 commit comments

Comments
 (0)