From d64a2f72e6b8ab5c56373a6cc1d01ff6ec7c9425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 30 Jul 2019 14:54:50 +0200 Subject: [PATCH] Fix wrong ifdef in ssl_server2 & add test for it This was found as a warning when running scripts/baremetal.sh --ram --build-only manually, but it should have been found in a more automated way. Adding -Werror so that future such issues will be caught by all.sh (component_test_baremetal already invokes baremetal.sh --ram --build-only). --- programs/ssl/ssl_server2.c | 2 ++ scripts/baremetal.sh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index bc97149ef..6d81626b4 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -791,6 +791,7 @@ static int send_cb( void *ctx, unsigned char const *buf, size_t len ) return( mbedtls_net_send( io_ctx->net, buf, len ) ); } +#if defined(SNI_OPTION) || !defined(MBEDTLS_SSL_CONF_AUTHMODE) /* * Return authmode from string, or -1 on error */ @@ -805,6 +806,7 @@ static int get_auth_mode( const char *s ) return( -1 ); } +#endif /* SNI_OPTION || !MBEDTLS_SSL_CONF_AUTHMODE */ /* * Used by sni_parse and psk_parse to handle coma-separated lists diff --git a/scripts/baremetal.sh b/scripts/baremetal.sh index d6b63722f..813307a9c 100755 --- a/scripts/baremetal.sh +++ b/scripts/baremetal.sh @@ -214,6 +214,9 @@ baremetal_ram_build() { make clean CFLAGS="$BASE_CFLAGS $CFLAGS_CONFIG $CFLAGS_USER_CONFIG" + if [ "$build_only" -eq 1 ]; then + CFLAGS="$CFLAGS -Werror" + fi echo "Modifications: $BAREMETAL_USER_CONFIG" cat $BAREMETAL_USER_CONFIG | grep "^#define" | awk '{print "* " $0 }' @@ -352,7 +355,7 @@ measure_heap=0 measure_stack=0 check=0 - +build_only=0 debug=0 while [ $# -gt 0 ]; do