Add a stdint.h compatibility shim.

This commit is contained in:
Reece H. Dunn
2016-01-09 13:09:50 +00:00
parent a02b91e423
commit 9c7179189b
25 changed files with 62 additions and 55 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ espeak_ng_include_HEADERS = \
lib_LTLIBRARIES += src/libespeak-ng.la
src_libespeak_ng_la_LDFLAGS = -version-info $(SHARED_VERSION) -lpthread -lm
src_libespeak_ng_la_CFLAGS = -Isrc/include \
src_libespeak_ng_la_CFLAGS = -Isrc/include -Isrc/include/compat \
-fPIC -fvisibility=hidden -D _BSD_SOURCE -D_DEFAULT_SOURCE -D _POSIX_C_SOURCE=200112L \
-pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\"
src_libespeak_ng_la_SOURCES = \
+58
View File
@@ -0,0 +1,58 @@
/* Compatibility shim for <stdint.h>
*
* Copyright (C) 2016 Reece H. Dunn
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see: <http://www.gnu.org/licenses/>.
*/
#ifndef STDINT_H_COMPAT_SHIM
#define STDINT_H_COMPAT_SHIM
#ifdef _MSC_VER
#if _MSC_VER >= 1600 // Visual C++ 10 (Visual Studio 2010) and above...
#include <../include/stdint.h>
#else
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef signed __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#ifdef _WIN64
typedef signed __int64 intptr_t;
#else
typedef signed __int32 intptr_t;
#endif
#endif
#else
#pragma GCC system_header // Silence "warning: #include_next is a GCC extension"
#if defined(HAVE_STDINT_H)
#include_next <stdint.h>
#elif defined(HAVE_INTTYPES_H)
#include_next <inttypes.h>
#else
#error stdint.h compatibility is not supported on this platform
#endif
#endif
#endif
-2
View File
@@ -26,9 +26,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -26,9 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <wctype.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -23,9 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -23,9 +23,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <wctype.h>
#include <wchar.h>
-2
View File
@@ -20,9 +20,7 @@
#include <errno.h>
#include <stdio.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <string.h>
#include <malloc.h>
-2
View File
@@ -24,9 +24,7 @@
#include <espeak/speak_lib.h>
#include <stdlib.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include "speech.h"
#include "phoneme.h"
-2
View File
@@ -23,9 +23,7 @@
#include <string.h>
#include <stdlib.h>
#include <wctype.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -29,9 +29,7 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -24,9 +24,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <wctype.h>
#include <wchar.h>
-2
View File
@@ -22,9 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -26,9 +26,7 @@
#include <wctype.h>
#include <wchar.h>
#include <math.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -23,9 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <wctype.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -21,9 +21,7 @@
#include <errno.h>
#include <stdio.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-8
View File
@@ -61,14 +61,6 @@ typedef unsigned short USHORT;
typedef unsigned char UCHAR;
typedef double DOUBLEX;
#if !HAVE_STDINT_H
#ifdef _WIN64
typedef signed __int64 intptr_t;
#else
typedef signed __int32 intptr_t;
#endif
#endif
typedef struct {
const char *mnem;
int value;
-2
View File
@@ -26,9 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -26,9 +26,7 @@
#include <ctype.h>
#include <wctype.h>
#include <string.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -25,9 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-2
View File
@@ -25,9 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <wctype.h>
-2
View File
@@ -23,9 +23,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <wctype.h>
#include <wchar.h>
-2
View File
@@ -24,9 +24,7 @@
#include "wctype.h"
#include "string.h"
#include "stdlib.h"
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include "speech.h"
-2
View File
@@ -26,9 +26,7 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <espeak-ng/espeak_ng.h>
#include <espeak/speak_lib.h>
-3
View File
@@ -7,6 +7,3 @@
// reserved ISO C names (like strdup) in favour of non-portable conforming
// variants that start with an '_'. This removes those deprecation warnings.
#define _CRT_NONSTDC_NO_DEPRECATE
// Visual C++ 2010 and later support <stdint.h>.
#define HAVE_STDINT_H 1
+3 -3
View File
@@ -87,7 +87,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)/../include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)/../include;$(ProjectDir)/../include/compat</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
@@ -116,7 +116,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)/../include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)/../include;$(ProjectDir)/../include/compat</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
@@ -182,4 +182,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>