Replace -O0 by -O1 or -Os in most components

Gcc skips some analyses when compiling with -O0, so we may miss
warnings about things like uninitialized variables.
This commit is contained in:
Gilles Peskine 2019-09-20 19:23:10 +02:00
parent 419f915b58
commit c9247122e3

View File

@ -831,8 +831,8 @@ component_test_no_platform () {
scripts/config.pl unset MBEDTLS_FS_IO scripts/config.pl unset MBEDTLS_FS_IO
# Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19, # Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19,
# to re-enable platform integration features otherwise disabled in C99 builds # to re-enable platform integration features otherwise disabled in C99 builds
make CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -O0 -D_DEFAULT_SOURCE' lib programs make CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -Os -D_DEFAULT_SOURCE' lib programs
make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' test make CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' test
} }
component_build_no_std_function () { component_build_no_std_function () {
@ -841,21 +841,21 @@ component_build_no_std_function () {
scripts/config.pl full scripts/config.pl full
scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED
make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make CC=gcc CFLAGS='-Werror -Wall -Wextra -Os'
} }
component_build_no_ssl_srv () { component_build_no_ssl_srv () {
msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s
scripts/config.pl full scripts/config.pl full
scripts/config.pl unset MBEDTLS_SSL_SRV_C scripts/config.pl unset MBEDTLS_SSL_SRV_C
make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1'
} }
component_build_no_ssl_cli () { component_build_no_ssl_cli () {
msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s
scripts/config.pl full scripts/config.pl full
scripts/config.pl unset MBEDTLS_SSL_CLI_C scripts/config.pl unset MBEDTLS_SSL_CLI_C
make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1'
} }
component_build_no_sockets () { component_build_no_sockets () {
@ -865,7 +865,7 @@ component_build_no_sockets () {
scripts/config.pl full scripts/config.pl full
scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc.
scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux
make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0 -std=c99 -pedantic' lib make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib
} }
component_test_memory_buffer_allocator_backtrace () { component_test_memory_buffer_allocator_backtrace () {