From 4e19c234f40d55c5c464a174b2a6ae85fc95d1b5 Mon Sep 17 00:00:00 2001 From: toddouska Date: Fri, 21 Sep 2012 13:29:04 -0700 Subject: [PATCH] fix new warnings on linux64 --- ctaocrypt/test/test.c | 4 +++- ctaocrypt/test/test.h | 2 +- cyassl/ctaocrypt/types.h | 6 +++--- cyassl/test.h | 3 ++- m4/ax_harden_compiler_flags.m4 | 5 ++--- src/internal.c | 10 +++++----- tests/api.c | 4 ++++ tests/suites.c | 5 +++++ tests/unit.c | 4 ++++ 9 files changed, 29 insertions(+), 14 deletions(-) diff --git a/ctaocrypt/test/test.c b/ctaocrypt/test/test.c index 66598f93e..9caadff2b 100644 --- a/ctaocrypt/test/test.c +++ b/ctaocrypt/test/test.c @@ -125,8 +125,10 @@ static void err_sys(const char* msg, int es) { printf("%s error = %d\n", msg, es); #ifndef THREADX - exit(es); + if (msg) + exit(es); #endif + return; } /* func_args from test.h, so don't have to pull in other junk */ diff --git a/ctaocrypt/test/test.h b/ctaocrypt/test/test.h index 82ffdf7f4..2f8a75f3f 100644 --- a/ctaocrypt/test/test.h +++ b/ctaocrypt/test/test.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#pragma once; +#pragma once void ctaocrypt_test(void* args); diff --git a/cyassl/ctaocrypt/types.h b/cyassl/ctaocrypt/types.h index 2d42c6256..786a82b8d 100644 --- a/cyassl/ctaocrypt/types.h +++ b/cyassl/ctaocrypt/types.h @@ -54,7 +54,7 @@ || defined(__mips64) || defined(__x86_64__)) /* long should be 64bit */ #define SIZEOF_LONG 8 - #elif (defined__i386__) + #elif defined(__i386__) /* long long should be 64bit */ #define SIZEOF_LONG_LONG 8 #endif @@ -66,11 +66,11 @@ #define WORD64_AVAILABLE #define W64LIT(x) x##ui64 typedef unsigned __int64 word64; -#elif SIZEOF_LONG == 8 +#elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8 #define WORD64_AVAILABLE #define W64LIT(x) x##LL typedef unsigned long word64; -#elif SIZEOF_LONG_LONG == 8 +#elif defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == 8 #define WORD64_AVAILABLE #define W64LIT(x) x##LL typedef unsigned long long word64; diff --git a/cyassl/test.h b/cyassl/test.h index c1d51e00a..6794ef985 100644 --- a/cyassl/test.h +++ b/cyassl/test.h @@ -151,7 +151,8 @@ static const word16 yasslPort = 11111; static INLINE void err_sys(const char* msg) { printf("yassl error: %s\n", msg); - exit(EXIT_FAILURE); + if (msg) + exit(EXIT_FAILURE); } diff --git a/m4/ax_harden_compiler_flags.m4 b/m4/ax_harden_compiler_flags.m4 index 383f1a3f3..360d56a5e 100644 --- a/m4/ax_harden_compiler_flags.m4 +++ b/m4/ax_harden_compiler_flags.m4 @@ -53,6 +53,8 @@ # AX_APPEND_COMPILE_FLAGS([-fstack-protector-all]) -- Issues on 32bit compile # AX_APPEND_COMPILE_FLAGS([-Wlong-long]) -- Don't turn on for compatibility issues memcached_stat_st # AX_APPEND_COMPILE_FLAGS([-Wold-style-definition]) -- Mixed with -Werror either before or after is a problem because tests use main() instead of main(void) +# AX_APPEND_COMPILE_FLAGS([-std=c99]) -- problem seeing DT_REG from dirent.h on some systems +# AX_APPEND_COMPILE_FLAGS([-Wlogical-op]) -- doesn't like strchr argument in mygetopt for now #serial 2 AC_DEFUN([AX_HARDEN_LINKER_FLAGS], [ @@ -84,13 +86,11 @@ AX_APPEND_COMPILE_FLAGS([-Wall]) AX_APPEND_COMPILE_FLAGS([-Wextra]) - AX_APPEND_COMPILE_FLAGS([-std=c99]) AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast]) AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes]) AX_APPEND_COMPILE_FLAGS([-Wnested-externs]) AX_APPEND_COMPILE_FLAGS([-Woverride-init]) AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes]) - AX_APPEND_COMPILE_FLAGS([-Wlogical-op]) AX_APPEND_COMPILE_FLAGS([-Wno-strict-aliasing]) AX_APPEND_COMPILE_FLAGS([-Wfloat-equal]) AX_APPEND_COMPILE_FLAGS([-Wundef]) @@ -147,7 +147,6 @@ AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized]) AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers]) AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn]) - AX_APPEND_COMPILE_FLAGS([-Wlogical-op]) AX_APPEND_COMPILE_FLAGS([-Wnon-virtual-dtor]) AX_APPEND_COMPILE_FLAGS([-Wnormalized=id]) AX_APPEND_COMPILE_FLAGS([-Woverloaded-virtual]) diff --git a/src/internal.c b/src/internal.c index 7038ad0a4..304425e20 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2671,10 +2671,10 @@ static INLINE void Encrypt(CYASSL* ssl, byte* out, const byte* input, word32 sz) case aes: #ifdef CYASSL_AESNI if ((word)input % 16) { - byte buffer[MAX_RECORD_SIZE + MAX_COMP_EXTRA+MAX_MSG_EXTRA]; - XMEMCPY(buffer, input, sz); - AesCbcEncrypt(ssl->encrypt.aes, buffer, buffer, sz); - XMEMCPY(out, buffer, sz); + byte buff[MAX_RECORD_SIZE + MAX_COMP_EXTRA+MAX_MSG_EXTRA]; + XMEMCPY(buff, input, sz); + AesCbcEncrypt(ssl->encrypt.aes, buff, buff, sz); + XMEMCPY(out, buff, sz); break; } #endif @@ -3016,7 +3016,7 @@ static int GetInputData(CYASSL *ssl, word32 size) negative number is error */ int ProcessReply(CYASSL* ssl) { - int ret, type, readSz; + int ret = 0, type, readSz; word32 startIdx = 0; #ifndef NO_CYASSL_SERVER byte b0, b1; diff --git a/tests/api.c b/tests/api.c index 647b86c1c..12d7fbb84 100644 --- a/tests/api.c +++ b/tests/api.c @@ -19,6 +19,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif + #include #include #include diff --git a/tests/suites.c b/tests/suites.c index a60eae971..24590c6cd 100644 --- a/tests/suites.c +++ b/tests/suites.c @@ -19,8 +19,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif + #include #include +#include #include #include diff --git a/tests/unit.c b/tests/unit.c index c53be3997..4397bfd9a 100644 --- a/tests/unit.c +++ b/tests/unit.c @@ -1,4 +1,8 @@ /* unit.c unit tests driver */ +#ifdef HAVE_CONFIG_H + #include +#endif + #include #include