From d4a16a68acb757f80431eb679e74da0b8a2418d6 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 15:47:23 -0400 Subject: [PATCH 1/2] Fixed confusing else clause, added to coding standard. --- CMakeLists.txt | 20 ++++++++++++++++++++ cmake/common/px4_base.cmake | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 736dd6f9b7..0708f5cb6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,26 @@ # # * All cmake functions are lowercase. # +# * For else, endif, endfunction, etc, never put the name of the statement +# +# Instead of the very confusing: +# if (${var} STREQUAL "1") <-- condition now becomes if name +# # do somthing +# elseif (${var} STREQUAL "2") <-- another condition +# # do somthing +# else (${var} STREQUAL "1") <-- tags is referring to name of if +# # do somthing +# endif (${var} STREQUAL "1") <-- tag is referring to name of +# +# Do this: +# if (${var} STREQUAL "1") <-- condition now becomes if name +# # do somthing +# elseif (${var} STREQUAL "2") <-- another condition +# # do somthing +# else () <-- leave blank +# # do somthing +# endif () <-- leave blank +# # Functions/Macros # --------------------------------------------------------------------------- # diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 73a73d21e8..be3d449710 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -510,7 +510,7 @@ function(px4_add_common_flags) list(APPEND warnings -Wno-unused-const-variable ) - else(${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + else() list(APPEND warnings -Werror=unused-but-set-variable -Wformat=1 From 3343d96a087fb5243b355d74aec8112cce55d986 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sat, 12 Sep 2015 15:59:33 -0400 Subject: [PATCH 2/2] Fixed readme typo. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0708f5cb6b..e547333c87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,9 +60,9 @@ # # do somthing # elseif (${var} STREQUAL "2") <-- another condition # # do somthing -# else (${var} STREQUAL "1") <-- tags is referring to name of if +# else (${var} STREQUAL "1") <-- tag is referring to name of if # # do somthing -# endif (${var} STREQUAL "1") <-- tag is referring to name of +# endif (${var} STREQUAL "1") <-- tag is referring to name of if # # Do this: # if (${var} STREQUAL "1") <-- condition now becomes if name