Fix compile errors with NO_STD_FUNCTIONS

This commit is contained in:
Manuel Pégourié-Gonnard 2015-06-03 10:20:33 +01:00
parent b752715893
commit dccb80b7e5
4 changed files with 14 additions and 2 deletions

View File

@ -35,6 +35,7 @@ Features
errors on use of deprecated functions. errors on use of deprecated functions.
Bugfix Bugfix
* Fix compile errors with PLATFORM_NO_STD_FUNCTIONS.
* Fix compile error with PLATFORM_EXIT_ALT (thanks to Rafał Przywara). * Fix compile error with PLATFORM_EXIT_ALT (thanks to Rafał Przywara).
* Fix bug in entropy.c when THREADING_C is also enabled that caused * Fix bug in entropy.c when THREADING_C is also enabled that caused
entropy_free() to crash (thanks to Rafał Przywara). entropy_free() to crash (thanks to Rafał Przywara).

View File

@ -85,6 +85,8 @@ extern "C" {
#define polarssl_free POLARSSL_PLATFORM_FREE_MACRO #define polarssl_free POLARSSL_PLATFORM_FREE_MACRO
#define polarssl_malloc POLARSSL_PLATFORM_MALLOC_MACRO #define polarssl_malloc POLARSSL_PLATFORM_MALLOC_MACRO
#else #else
/* For size_t */
#include <stddef.h>
extern void * (*polarssl_malloc)( size_t len ); extern void * (*polarssl_malloc)( size_t len );
extern void (*polarssl_free)( void *ptr ); extern void (*polarssl_free)( void *ptr );
@ -108,6 +110,8 @@ int platform_set_malloc_free( void * (*malloc_func)( size_t ),
* The function pointers for fprintf * The function pointers for fprintf
*/ */
#if defined(POLARSSL_PLATFORM_FPRINTF_ALT) #if defined(POLARSSL_PLATFORM_FPRINTF_ALT)
/* We need FILE * */
#include <stdio.h>
extern int (*polarssl_fprintf)( FILE *stream, const char *format, ... ); extern int (*polarssl_fprintf)( FILE *stream, const char *format, ... );
/** /**

View File

@ -72,7 +72,7 @@ static int platform_snprintf_uninit( char * s, size_t n,
{ {
((void) s); ((void) s);
((void) n); ((void) n);
((void) format) ((void) format);
return( 0 ); return( 0 );
} }
@ -148,7 +148,6 @@ int platform_set_fprintf( int (*fprintf_func)( FILE *, const char *, ... ) )
static void platform_exit_uninit( int status ) static void platform_exit_uninit( int status )
{ {
((void) status); ((void) status);
return( 0 );
} }
#define POLARSSL_PLATFORM_STD_EXIT platform_exit_uninit #define POLARSSL_PLATFORM_STD_EXIT platform_exit_uninit

View File

@ -146,6 +146,14 @@ scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C
scripts/config.pl unset POLARSSL_FS_IO scripts/config.pl unset POLARSSL_FS_IO
CC=gcc CFLAGS='-Werror -O0' make CC=gcc CFLAGS='-Werror -O0' make
# catch compile bugs in _uninit functions
msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s
cleanup
cp "$CONFIG_H" "$CONFIG_BAK"
scripts/config.pl full
scripts/config.pl set POLARSSL_PLATFORM_NO_STD_FUNCTIONS
CC=gcc CFLAGS='-Werror -O0' make
if uname -a | grep -F x86_64 >/dev/null; then if uname -a | grep -F x86_64 >/dev/null; then
msg "build: i386, make, gcc" # ~ 30s msg "build: i386, make, gcc" # ~ 30s
cleanup cleanup