Use -Wall compiler warning level
Sets the C and C++ compiler warning level to -Wall. Fixes for
warnings judged to be non-functional are included in this commit.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I783ff274b7fbd802bc25074953e2c2f287114605
diff --git a/environments/arm-linux/default_toolchain_file.cmake b/environments/arm-linux/default_toolchain_file.cmake
index 7a5f33f..85de9df 100644
--- a/environments/arm-linux/default_toolchain_file.cmake
+++ b/environments/arm-linux/default_toolchain_file.cmake
@@ -15,5 +15,12 @@
string(APPEND CMAKE_C_FLAGS_INIT " -fdiagnostics-show-option -gdwarf-2 -mstrict-align -O0 -DARM64=1")
string(APPEND CMAKE_CXX_FLAGS_INIT " -fdiagnostics-show-option -gdwarf-2 -mstrict-align -O0 -DARM64=1")
+# Set compiler warning level for the root build context. External components
+# are responsible for setting their own warning level.
+if(DEFINED TS_ROOT)
+ string(APPEND CMAKE_C_FLAGS_INIT " -Wall")
+ string(APPEND CMAKE_CXX_FLAGS_INIT " -Wall")
+endif()
+
include($ENV{TS_ROOT}/tools/cmake/compiler/GCC.cmake REQUIRED)
include($ENV{TS_ROOT}/tools/cmake/compiler/config_iface.cmake REQUIRED)
diff --git a/environments/linux-pc/default_toolchain_file.cmake b/environments/linux-pc/default_toolchain_file.cmake
index 6978dbf..1fa32cc 100644
--- a/environments/linux-pc/default_toolchain_file.cmake
+++ b/environments/linux-pc/default_toolchain_file.cmake
@@ -1,8 +1,15 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
include($ENV{TS_ROOT}/tools/cmake/compiler/config_iface.cmake REQUIRED)
+
+# Set compiler warning level for the root build context. External components
+# are responsible for setting their own warning level.
+if(DEFINED TS_ROOT)
+ string(APPEND CMAKE_C_FLAGS_INIT " -Wall")
+ string(APPEND CMAKE_CXX_FLAGS_INIT " -Wall")
+endif()
diff --git a/environments/opteesp/default_toolchain_file.cmake b/environments/opteesp/default_toolchain_file.cmake
index 541cd89..3c4b9a6 100644
--- a/environments/opteesp/default_toolchain_file.cmake
+++ b/environments/opteesp/default_toolchain_file.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -17,9 +17,16 @@
include($ENV{TS_ROOT}/tools/cmake/compiler/GCC.cmake REQUIRED)
include($ENV{TS_ROOT}/tools/cmake/compiler/config_iface.cmake REQUIRED)
+
# Set mandatory compiler and linker flags for this environment:
# - Compile position independent code
string(APPEND CMAKE_C_FLAGS_INIT " -fpic")
-# - Disable startup files and default libraries.
+
+# Set compiler warning level for the root build context. External components
+# are responsible for setting their own warning level.
+if(DEFINED TS_ROOT)
+ string(APPEND CMAKE_C_FLAGS_INIT " -Wall")
+endif()
+
# - Link position independent executable
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -pie")