These are global arrays reused several times. When using them msan and
valgrind thus believe they are always initialized, which reduces their
capacity to detect uninitialized values. We can however explicitly tell them
when they are reused, and thus to be considered as uninitialized.
When pollint() returns 100.0, multiplying by 2.55 doesn't actually seem to
be getting 255 on i386. Multiplying by 255 and dividing by 100, however,
does (probably because float computation with small integer values are
guaranteed to have integer results).
Fixes #1151
espeak-ng --compile-phonemes generates phontab, but during the
generation it starts by reading the old phontab. If works just fine,
apart from an error message, if this doesn't exist but if it does exist
it is not clear whether it might end up using old or bad data (e.g.
possibly crashing if phontab is corrupted making it very non-obvious how
to fix the problem...)
The same applies to en_dict as a result of espeak-ng defaulting to the
voice 'en'; again the phontab build works if en_dict is absent but a
spurious message is output. It's not clear what would happen if someone
tried to build a reduced espeak-ng configuration with just one (non
'en') language.
The fix is to change espeak_ng_CompilePhonemeDataPath to call LoadVoice
with a new flag to indicate the voice structure is just required to
compile phoneme data (I changed the error message as well to make it
clear where it comes from - there are two identical error messages, the
other one is in voices.c)
Within LoadVoice the flag causes LoadVoice to not set a default language
or voicename and to skip loading the old phontab or dictionary (both of
which fail in a git clean -dfx build).
I checked the result by doing a compile from-scratch build sequence with
and without the patch, i.e. I did:
git clean -dfx
./autogen.sh
./configure --prefix=a-test-directory
make
make install
Then I compared the two copies of "a-test-directory" as well as the log
file output:
$ diff -r logs/*
diff -r logs/original/make.log logs/patched/make.log
175,176d174
< Unknown phoneme table: 'en'
< Can't read dictionary file:
'/home/jbowler/src/espeak-ng/master/espeak-ng-data/en_dict'
$ diff --no-dereference -r local.original local.patched
Binary files local.original/bin/speak-ng and local.patched/bin/speak-ng differ
Binary files local.original/lib/libespeak-ng.a and local.patched/lib/libespeak-ng.a differ
Binary files local.original/lib/libespeak-ng.so.1.1.51 and local.patched/lib/libespeak-ng.so.1.1.51 differ
So the change has not altered phontab or any of the other generated
files, only the binaries as would be expected. (Note that I am
comparing truely clean builds; what you get if you download the source
and build from scratch. This is the standard approach for people who
build for distribution.)
Signed-off-by: John Bowler <[email protected]>
code cleanup: Check all local includes with include-what-you-use
Going through files in src/libespeak-ng/, include-what-you-use removed a
few unnecessary includes and included explanations on why a certain
header should be included. This makes tracking globals and dependencies easier.
Running the codebase through IWYU should be repeated after each major
code restIncludes to standard c library weren't checked to avoid
breaking builds with other platforms.
See https://github.com/include-what-you-use/include-what-you-use
synthesize.h now contains the definitions STRESS_IS_... that should be used with code related to syllable stress.
Note that isBreak and other defines were renumbered so that stress definitions could have values 0-6.
Possible TODOs:
1. Unify with terms used with phonemes, i.e. keywords like isDiminished in compiledata.c and stress_type in phsource/phonemes
2. Add functionality and documentation about STRESS_IS_PRIORITY and STRESS_IS_EMPHASIZED