David Turner pushed to branch fix-compiler-warnings at FreeType / FreeType Demo Programs
Commits:
-
3825e638
by David Turner at 2021-05-26T15:32:28+02:00
-
501ac20f
by David Turner at 2021-05-26T15:32:54+02:00
-
3d1095e6
by David Turner at 2021-05-26T15:33:16+02:00
-
51c0b8ac
by David Turner at 2021-05-26T15:33:37+02:00
5 changed files:
Changes:
1 |
+2021-05-23 David Turner <david@freetype.org>
|
|
2 |
+ |
|
3 |
+ * src/ftmemchk.c: Remove minor compiler warning.
|
|
4 |
+ |
|
5 |
+ Casting a pointer to (long) isn't always correct.
|
|
6 |
+ |
|
7 |
+2021-05-23 David Turner <david@freetype.org>
|
|
8 |
+ |
|
9 |
+ * src/ftpngout.c: Remove compiler warning for Mingw64 toolchain.
|
|
10 |
+ |
|
11 |
+ The #pragma statement is only valid with Microsoft Visual C++
|
|
12 |
+ |
|
13 |
+2021-05-23 David Turner <david@freetype.org>
|
|
14 |
+ |
|
15 |
+ * graph/win32/grwin32.c: Fix compiler warnings
|
|
16 |
+ |
|
17 |
+ - Redefine the LCS_sRGB macro to properly compile with the Mingw64
|
|
18 |
+ toolchain and the -Wmultichar warning enabled.
|
|
19 |
+ |
|
20 |
+ - Add missing return code paths in function.
|
|
21 |
+ |
|
22 |
+2021-05-22 David Turner <david@freetype.org>
|
|
23 |
+ |
|
24 |
+ * src/ftbench.c: Fix get_time() for Mingw64
|
|
25 |
+ |
|
26 |
+ clock_gettime() cannot be used when cross-compiling for Windows
|
|
27 |
+ using the Linux Mingw64 toolchain, so ensure the Win32-specific
|
|
28 |
+ timer code is always used when _WIN32 is defined.
|
|
29 |
+ |
|
1 | 30 |
2021-05-24 David Turner <david@freetype.org>
|
2 | 31 |
|
3 | 32 |
[build] Add Meson build files and documentation.
|
... | ... | @@ -256,6 +256,15 @@ gr_win32_surface_set_icon( grWin32Surface* surface, |
256 | 256 |
ICONINFO ici = { TRUE };
|
257 | 257 |
HICON hIcon;
|
258 | 258 |
|
259 |
+/* NOTE: The Mingw64 wingdi.h defines this macro as 'sRGB'
|
|
260 |
+ * which triggers the -Wmultichar warning during compilation,
|
|
261 |
+ * so replace it with the corresponding numerical value.
|
|
262 |
+ */
|
|
263 |
+#ifdef __MINGW64__
|
|
264 |
+#undef LCS_sRGB
|
|
265 |
+#define LCS_sRGB 0x73524742
|
|
266 |
+#endif
|
|
267 |
+ |
|
259 | 268 |
BITMAPV4HEADER hdr = { sizeof( BITMAPV4HEADER ),
|
260 | 269 |
0, 0, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0,
|
261 | 270 |
0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
|
... | ... | @@ -297,6 +306,8 @@ gr_win32_surface_set_icon( grWin32Surface* surface, |
297 | 306 |
case ICON_BIG:
|
298 | 307 |
surface->bIcon = hIcon;
|
299 | 308 |
return s[0];
|
309 |
+ default:
|
|
310 |
+ return 0; /* should not happen */
|
|
300 | 311 |
}
|
301 | 312 |
}
|
302 | 313 |
|
... | ... | @@ -198,19 +198,11 @@ |
198 | 198 |
static double
|
199 | 199 |
get_time( void )
|
200 | 200 |
{
|
201 |
-#if defined _POSIX_TIMERS && _POSIX_TIMERS > 0
|
|
202 |
- struct timespec tv;
|
|
203 |
- |
|
204 |
- |
|
205 |
-#ifdef _POSIX_CPUTIME
|
|
206 |
- clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &tv );
|
|
207 |
-#else
|
|
208 |
- clock_gettime( CLOCK_REALTIME, &tv );
|
|
209 |
-#endif /* _POSIX_CPUTIME */
|
|
210 |
- |
|
211 |
- return 1E6 * (double)tv.tv_sec + 1E-3 * (double)tv.tv_nsec;
|
|
212 |
- |
|
213 |
-#elif defined _WIN32
|
|
201 |
+/* NOTE: When building with the Mingw64 toolchain, _POSIX_TIMERS
|
|
202 |
+ * will be defined, but clock_gettime() won't, so ensure that the
|
|
203 |
+ * _WIN32 specific timer code appears first here.
|
|
204 |
+ */
|
|
205 |
+#if defined _WIN32
|
|
214 | 206 |
|
215 | 207 |
#ifdef QPC
|
216 | 208 |
LARGE_INTEGER ticks;
|
... | ... | @@ -238,6 +230,18 @@ |
238 | 230 |
|
239 | 231 |
#endif
|
240 | 232 |
|
233 |
+#elif defined _POSIX_TIMERS && _POSIX_TIMERS > 0
|
|
234 |
+ struct timespec tv;
|
|
235 |
+ |
|
236 |
+ |
|
237 |
+#ifdef _POSIX_CPUTIME
|
|
238 |
+ clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &tv );
|
|
239 |
+#else
|
|
240 |
+ clock_gettime( CLOCK_REALTIME, &tv );
|
|
241 |
+#endif /* _POSIX_CPUTIME */
|
|
242 |
+ |
|
243 |
+ return 1E6 * (double)tv.tv_sec + 1E-3 * (double)tv.tv_nsec;
|
|
244 |
+ |
|
241 | 245 |
#else
|
242 | 246 |
/* clock() accuracy has improved since glibc 2.18 */
|
243 | 247 |
return 1E6 * (double)clock() / (double)CLOCKS_PER_SEC;
|
... | ... | @@ -66,7 +66,7 @@ void record_my_block( void* base, long size ) |
66 | 66 |
{
|
67 | 67 |
if ( block->base == base && block->size != 0 )
|
68 | 68 |
{
|
69 |
- fprintf( stderr, "duplicate memory block at %08lx\n", (long)block->base );
|
|
69 |
+ fprintf( stderr, "duplicate memory block at %p\n", block->base );
|
|
70 | 70 |
exit(1);
|
71 | 71 |
}
|
72 | 72 |
}
|
... | ... | @@ -147,7 +147,10 @@ |
147 | 147 |
#define WIN32_LEAN_AND_MEAN
|
148 | 148 |
#include<windows.h>
|
149 | 149 |
|
150 |
+/* Microsoft Visual C++ specific pragma */
|
|
151 |
+#ifdef _MSC_VER
|
|
150 | 152 |
#pragma comment (lib,"Gdiplus.lib")
|
153 |
+#endif
|
|
151 | 154 |
|
152 | 155 |
/* Barebone definitions and opaque types to avoid GDI+ (C++) headers */
|
153 | 156 |
|