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
This commit is contained in:
Juho Hiltunen
2020-07-24 07:29:47 +03:00
parent 5e70981884
commit ee944700f8
28 changed files with 140 additions and 166 deletions
+11 -11
View File
@@ -35,17 +35,17 @@
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include "readclause.h"
#include "synthdata.h"
#include "wavegen.h"
#include "error.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "spect.h"
#include "translate.h"
#include "dictionary.h"
#include "dictionary.h" // for strncpy0
#include "error.h" // for create_file_error_context
#include "phoneme.h" // for PHONEME_TAB, PHONEME_TAB_LIST
#include "readclause.h" // for Read4Bytes
#include "spect.h" // for SpectFrame, peak_t, SpectSeq
#include "speech.h" // for path_home, MNEM_TAB, GetFileLength
#include "synthdata.h" // for LoadPhData
#include "synthesize.h" // for TUNE, frame_t, CONDITION_IS_OTHER
#include "translate.h" // for utf8_out, utf8_in
#include "voice.h" // for LoadVoice, voice
#include "wavegen.h" // for WavegenInit, WavegenSetVoice
#define N_ITEM_STRING 256
+7 -6
View File
@@ -37,12 +37,13 @@
#include "dictionary.h"
#include "readclause.h"
#include "error.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "dictionary.h" // for EncodePhonemes, strncpy0, HashDicti...
#include "error.h" // for create_file_error_context
#include "phoneme.h" // for PHONEME_TAB_LIST, phonSWITCH, phone...
#include "readclause.h" // for towlower2
#include "speech.h" // for LookupMnemName, MNEM_TAB, path_home
#include "synthesize.h" // for Write4Bytes
#include "translate.h" // for isspace2, IsDigit09, utf8_in, utf8_out
static FILE *f_log = NULL;
+5 -5
View File
@@ -30,11 +30,11 @@
#include "mbrola.h"
#include "error.h"
#include "phoneme.h"
#include "speech.h"
#include "voice.h"
#include "synthesize.h"
#include "error.h" // for create_file_error_context
#include "mbrola.h" // for MBROLA_TAB
#include "phoneme.h" // for N_PHONEME_TAB
#include "speech.h" // for path_home
#include "synthesize.h" // for Write4Bytes
static const char *basename(const char *filename)
{
+8 -9
View File
@@ -32,15 +32,14 @@
#include <espeak-ng/encoding.h>
#include "dictionary.h"
#include "numbers.h"
#include "readclause.h"
#include "synthdata.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "numbers.h" // for LookupAccentedLetter, Look...
#include "phoneme.h" // for PHONEME_TAB, phVOWEL, phon...
#include "readclause.h" // for WordToString2, is_str_tota...
#include "speech.h" // for GetFileLength, path_home
#include "compiledict.h" // for DecodeRule
#include "synthdata.h" // for PhonemeCode, InterpretPhoneme
#include "synthesize.h" // for STRESS_IS_PRIMARY, phoneme...
#include "translate.h" // for Translator, utf8_in, LANGU...
typedef struct {
int points;
+4 -3
View File
@@ -21,9 +21,10 @@
#ifndef ESPEAK_NG_DICTIONARY_H
#define ESPEAK_NG_DICTIONARY_H
#include "compiledict.h"
#include "synthesize.h"
#include "translate.h"
#include "espeak-ng/espeak_ng.h" // for ESPEAK_NG_API
#include "phoneme.h" // for PHONEME_TAB
#include "synthesize.h" // for PHONEME_LIST
#include "translate.h" // for Translator, WORD_TAB
#ifdef __cplusplus
extern "C"
+4 -5
View File
@@ -25,11 +25,10 @@
#include <espeak-ng/espeak_ng.h>
#include <espeak-ng/encoding.h>
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include <espeak-ng/encoding.h> // for espeak_ng_TEXT_DECODER, ESPEAKNG_EN...
#include "espeak-ng/speak_lib.h" // for espeakCHARS_16BIT, espeakCHARS_8BIT
#include "speech.h" // for LookupMnem, MNEM_TAB
#include "translate.h" // for LEADING_2_BITS, UTF8_TAIL_BITS
// http://www.iana.org/assignments/character-sets/character-sets.xhtml
MNEM_TAB mnem_encoding[] = {
+1 -5
View File
@@ -27,11 +27,7 @@
#include <espeak-ng/espeak_ng.h>
#include "error.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "dictionary.h"
#include "dictionary.h" // for strncpy0
espeak_ng_STATUS
create_file_error_context(espeak_ng_ERROR_CONTEXT *context,
+2 -5
View File
@@ -29,11 +29,8 @@
#include "compiledict.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "event.h"
#include "synthesize.h" // for espeakINITIALIZE_PHONEME_IPA
#include "translate.h" // for dictionary_name, option_phoneme_events
static espeak_ERROR status_to_espeak_error(espeak_ng_STATUS status)
{
+4 -6
View File
@@ -29,12 +29,10 @@
#include <espeak-ng/encoding.h>
#include "intonation.h"
#include "synthdata.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "phoneme.h" // for PHONEME_TAB, PhonemeCode2, phonPAUSE, phPAUSE
#include "synthdata.h" // for PhonemeCode
#include "synthesize.h" // for PHONEME_LIST, TUNE, phoneme_list, phoneme_tab
#include "translate.h" // for Translator, LANGUAGE_OPTIONS, L, OPTION_EMPH...
/* Note this module is mostly old code that needs to be rewritten to
provide a more flexible intonation system.
+2 -3
View File
@@ -34,10 +34,9 @@
#include <espeak-ng/espeak_ng.h>
#include <espeak-ng/speak_lib.h>
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "klatt.h"
#include "synthesize.h" // for frame_t, WGEN_DATA, STEPSIZE, N_KLATTP, echo...
#include "voice.h" // for voice_t, N_PEAKS
extern unsigned char *out_ptr;
extern unsigned char *out_end;
+2 -2
View File
@@ -24,8 +24,8 @@
#ifndef ESPEAK_NG_KLATT_H
#define ESPEAK_NG_KLATT_H
#include "speech.h"
#include "synthesize.h"
#include "voice.h" // for voice_t
#include "synthesize.h" // for frame_t, WGEN_DATA
#ifdef __cplusplus
extern "C"
+1 -1
View File
@@ -23,7 +23,7 @@
#include <espeak-ng/espeak_ng.h>
#include "speech.h"
#include "speech.h" // for MNEM_TAB, LookupMnem, LookupMnemName
int LookupMnem(MNEM_TAB *table, const char *string)
{
+7 -8
View File
@@ -31,15 +31,14 @@
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include "dictionary.h"
#include "numbers.h"
#include "readclause.h"
#include "synthdata.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "dictionary.h" // for Lookup, TranslateRules, EncodePhonemes, Look...
#include "phoneme.h" // for phonSWITCH, PHONEME_TAB, phonEND_WORD, phonP...
#include "readclause.h" // for WordToString2, towlower2
#include "synthdata.h" // for SelectPhonemeTable
#include "synthesize.h" // for phoneme_tab
#include "translate.h" // for Translator, LANGUAGE_OPTIONS, IsDigit09, WOR...
#include "voice.h" // for voice, voice_t
#define M_LIGATURE 0x8000
#define M_NAME 0
+4 -2
View File
@@ -30,10 +30,12 @@
#include <espeak-ng/encoding.h>
#include "phonemelist.h"
#include "synthdata.h"
#include "phoneme.h" // for PHONEME_TAB, phVOWEL, REPLACE_PHONEMES, phPAUSE
#include "synthdata.h" // for InterpretPhoneme, SelectPhonemeTable
#include "synthesize.h" // for PHONEME_LIST, PHONEME_LIST2, phoneme_tab
#include "translate.h" // for Translator, LANGUAGE_OPTIONS, option_wordgap
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
+10 -10
View File
@@ -36,17 +36,17 @@
#include <espeak-ng/encoding.h>
#include <ucd/ucd.h>
#include "dictionary.h"
#include "readclause.h"
#include "synthdata.h"
#include "error.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "ssml.h"
#include "config.h" // for HAVE_MKSTEMP
#include "dictionary.h" // for LookupDictList, DecodePhonemes, Set...
#include "error.h" // for create_file_error_context
#include "phoneme.h" // for phonSWITCH
#include "speech.h" // for GetFileLength, LookupMnem, PATHSEP
#include "ssml.h" // for SSML_STACK, ProcessSsmlTag, N_PARAM...
#include "synthdata.h" // for SelectPhonemeTable
#include "synthesize.h" // for SOUND_ICON, soundicon_tab, samplerate
#include "translate.h" // for Translator, utf8_out, CLAUSE_OPTION...
#include "voice.h" // for voice, voice_t, current_voice_selected
#define N_XML_BUF 500
+4 -4
View File
@@ -30,11 +30,11 @@
#include <espeak-ng/espeak_ng.h>
#include <espeak-ng/speak_lib.h>
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "spect.h"
#include "ieee80.h"
#include "ieee80.h" // for ConvertFromIeeeExtended
#include "wavegen.h" // for wavegen_peaks_t, PeaksToHarmspect
#include "synthesize.h" // for KLATT_AV, KLATT_Kopen, N_KLATTP2
#include "voice.h" // for N_PEAKS
static int frame_width;
+3 -6
View File
@@ -20,12 +20,9 @@
#ifndef ESPEAK_NG_SPECT_H
#define ESPEAK_NG_SPECT_H
#include <espeak-ng/espeak_ng.h>
#include "wavegen.h"
#include "synthesize.h"
#include "speech.h"
#include <espeak-ng/espeak_ng.h> // for espeak_ng_STATUS
#include "voice.h" // for N_PEAKS
#include "synthesize.h" // for N_KLATTP2
#ifdef __cplusplus
extern "C"
+11 -13
View File
@@ -48,20 +48,18 @@
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include "dictionary.h"
#include "mbrola.h"
#include "readclause.h"
#include "synthdata.h"
#include "wavegen.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "espeak_command.h"
#include "fifo.h"
#include "event.h"
#include "dictionary.h" // for GetTranslatedPhonemeString, strncpy0
#include "espeak_command.h" // for delete_espeak_command, SetParameter
#include "event.h" // for event_declare, event_clear_all, eve...
#include "fifo.h" // for fifo_add_command, fifo_add_commands
#include "mbrola.h" // for mbrola_delay
#include "readclause.h" // for PARAM_STACK, param_stack
#include "synthdata.h" // for FreePhData, LoadConfig, LoadPhData
#include "synthesize.h" // for SpeakNextClause, Generate, Synthesi...
#include "translate.h" // for p_decoder, InitText, translator
#include "voice.h" // for FreeVoiceList, VoiceReset, current_...
#include "wavegen.h" // for WavegenFill, WavegenInit, WcmdqUsed
unsigned char *outbuf = NULL;
int outbuf_size = 0;
+1 -1
View File
@@ -20,9 +20,9 @@
#ifndef ESPEAK_NG_SPEECH_H
#define ESPEAK_NG_SPEECH_H
#include <endian.h> // for BYTE_ORDER, BIG_ENDIAN
#include <espeak-ng/espeak_ng.h>
#include "mbrola.h"
#ifdef __cplusplus
extern "C"
+6 -9
View File
@@ -39,16 +39,13 @@
#include <espeak-ng/encoding.h>
#include <ucd/ucd.h>
#include "readclause.h"
#include "error.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "dictionary.h"
#include "ssml.h"
#include "dictionary.h" // for strncpy0
#include "readclause.h" // for PARAM_STACK, param_stack, AddNameData
#include "speech.h" // for MNEM_TAB, LookupMnem
#include "synthesize.h" // for SPEED_FACTORS, speed
#include "translate.h" // for CTRL_EMBEDDED, IsDigit09, utf8_out
#include "voice.h" // for SelectVoice, SelectVoiceByName
static MNEM_TAB ssmltags[] = {
{ "speak", SSML_SPEAK },
+7 -8
View File
@@ -31,15 +31,14 @@
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include "readclause.h"
#include "synthdata.h"
#include "error.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "error.h" // for create_file_error_context, crea...
#include "phoneme.h" // for PHONEME_TAB, PHONEME_TAB_LIST
#include "speech.h" // for path_home, GetFileLength, PATHSEP
#include "mbrola.h" // for mbrola_name
#include "synthesize.h" // for PHONEME_LIST, frameref_t, PHONE...
#include "translate.h" // for Translator, LANGUAGE_OPTIONS
#include "voice.h" // for ReadTonePoints, tone_points, voice
const int version_phdata = 0x014801;
+5 -3
View File
@@ -21,14 +21,16 @@
#ifndef ESPEAK_NG_SYNTHDATA_H
#define ESPEAK_NG_SYNTHDATA_H
#include "synthesize.h"
#include "translate.h"
#ifdef __cplusplus
extern "C"
{
#endif
#include "espeak-ng/espeak_ng.h" // for espeak_ng_ERROR_CONTEXT, espea...
#include "phoneme.h" // for PHONEME_TAB
#include "synthesize.h" // for PHONEME_DATA, PHONEME_LIST
#include "translate.h" // for Translator
void InterpretPhoneme(Translator *tr,
int control,
PHONEME_LIST *plist,
+9 -10
View File
@@ -32,17 +32,16 @@
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include "dictionary.h"
#include "intonation.h"
#include "mbrola.h"
#include "setlengths.h"
#include "synthdata.h"
#include "wavegen.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "dictionary.h" // for WritePhMnemonic, GetTranslatedPhone...
#include "intonation.h" // for CalcPitches
#include "mbrola.h" // for MbrolaGenerate, mbrola_name
#include "phoneme.h" // for PHONEME_TAB, phVOWEL, phLIQUID, phN...
#include "setlengths.h" // for CalcLengths
#include "synthdata.h" // for InterpretPhoneme, GetEnvelope, Inte...
#include "translate.h" // for translator, LANGUAGE_OPTIONS, Trans...
#include "voice.h" // for voice_t, voice, LoadVoiceVariant
#include "wavegen.h" // for WcmdqInc, WcmdqFree, WcmdqStop
static void SmoothSpect(void);
+1 -2
View File
@@ -28,8 +28,7 @@ extern "C"
#include <stdint.h>
#include <stdbool.h>
#include <espeak-ng/espeak_ng.h>
#include "phoneme.h"
#include "voice.h"
#include "phoneme.h" // for PHONEME_TAB, N_PHONEME_TAB
#define espeakINITIALIZE_PHONEME_IPA 0x0002 // move this to speak_lib.h, after eSpeak version 1.46.02
+1 -4
View File
@@ -30,10 +30,7 @@
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "translate.h" // for Translator, LANGUAGE_OPTIONS, L, NUM...
// start of unicode pages for character sets
#define OFFSET_GREEK 0x380
+9 -10
View File
@@ -32,17 +32,16 @@
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include "dictionary.h"
#include "numbers.h"
#include "phonemelist.h"
#include "readclause.h"
#include "synthdata.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "dictionary.h" // for TranslateRules, LookupDictList, Cha...
#include "numbers.h" // for SetSpellingStress, TranslateLetter
#include "phoneme.h" // for phonSWITCH, PHONEME_TAB, phonPAUSE_...
#include "phonemelist.h" // for MakePhonemeList
#include "readclause.h" // for towlower2, Eof, ReadClause, is_str_...
#include "synthdata.h" // for SelectPhonemeTable, LookupPhonemeTable
#include "synthesize.h" // for PHONEME_LIST2, N_PHONEME_LIST, PHON...
#include "ucd/ucd.h" // for ucd_toupper
#include "voice.h" // for voice, voice_t
Translator *translator = NULL; // the main translator
Translator *translator2 = NULL; // secondary translator for certain words
+9 -10
View File
@@ -38,16 +38,15 @@
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include "dictionary.h"
#include "readclause.h"
#include "synthdata.h"
#include "wavegen.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "voice.h" // for voice_t, DoVoiceChange, N_PEAKS
#include "dictionary.h" // for strncpy0, LoadDictionary
#include "phoneme.h" // for REPLACE_PHONEMES, n_replace_pho...
#include "speech.h" // for LookupMnem, GetFileLength, PATHSEP
#include "mbrola.h" // for LoadMbrolaTable
#include "synthdata.h" // for SelectPhonemeTableName, LookupP...
#include "synthesize.h" // for SetSpeed, SPEED_FACTORS, speed
#include "translate.h" // for LANGUAGE_OPTIONS, DeleteTranslator
#include "wavegen.h" // for InitBreath
MNEM_TAB genders[] = {
{ "male", ENGENDER_MALE },
+2 -5
View File
@@ -33,11 +33,8 @@
#include <espeak-ng/speak_lib.h>
#include "wavegen.h"
#include "synthesize.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h" // for WGEN_DATA, RESONATOR, frame_t
#include "mbrola.h" // for MbrolaFill, MbrolaReset, mbrola...
#ifdef INCLUDE_KLATT
#include "klatt.h"