From adf9901016fd74221ef55ecf0d68e39ebaa2c401 Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:39:06 +0200 Subject: [PATCH 1/7] style: remove unused variables --- modules/sorts/merge_sort.f90 | 2 +- tests/sorts/tests_gnome_sort.f90 | 1 - tests/sorts/tests_heap_sort.f90 | 1 - tests/sorts/tests_merge_sort.f90 | 1 - tests/sorts/tests_quick_sort.f90 | 1 - tests/sorts/tests_radix_sort.f90 | 1 - 6 files changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/sorts/merge_sort.f90 b/modules/sorts/merge_sort.f90 index 43d3c6b..7b6def5 100644 --- a/modules/sorts/merge_sort.f90 +++ b/modules/sorts/merge_sort.f90 @@ -23,7 +23,7 @@ recursive subroutine merge_sort(array, n) implicit none integer, dimension(:), intent(inout) :: array ! Input/output array to be sorted integer, intent(in) :: n ! Size of the array - integer :: middle, i + integer :: middle integer, dimension(:), allocatable :: left_half, right_half, sorted_array ! Base case: return if the array has 1 or fewer elements diff --git a/tests/sorts/tests_gnome_sort.f90 b/tests/sorts/tests_gnome_sort.f90 index 1e2bdae..fccf7a5 100644 --- a/tests/sorts/tests_gnome_sort.f90 +++ b/tests/sorts/tests_gnome_sort.f90 @@ -6,7 +6,6 @@ program tests_gnome_sort use gnome_sort_module implicit none - integer :: i integer, dimension(:), allocatable :: array ! Test 1: Repeated elements diff --git a/tests/sorts/tests_heap_sort.f90 b/tests/sorts/tests_heap_sort.f90 index 1961d80..0f34812 100644 --- a/tests/sorts/tests_heap_sort.f90 +++ b/tests/sorts/tests_heap_sort.f90 @@ -6,7 +6,6 @@ program tests_heap_sort use heap_sort_module implicit none - integer :: i integer, dimension(:), allocatable :: array ! Test 1: Repeated elements diff --git a/tests/sorts/tests_merge_sort.f90 b/tests/sorts/tests_merge_sort.f90 index 45af1fa..6242e16 100644 --- a/tests/sorts/tests_merge_sort.f90 +++ b/tests/sorts/tests_merge_sort.f90 @@ -6,7 +6,6 @@ program tests_merge_sort use merge_sort_module implicit none - integer :: i integer, dimension(:), allocatable :: array ! Test 1: Repeated elements diff --git a/tests/sorts/tests_quick_sort.f90 b/tests/sorts/tests_quick_sort.f90 index 262f251..3a20d0e 100644 --- a/tests/sorts/tests_quick_sort.f90 +++ b/tests/sorts/tests_quick_sort.f90 @@ -6,7 +6,6 @@ program tests_quick_sort use quick_sort_module implicit none - integer :: i integer, dimension(:), allocatable :: array ! Test 1: Repeated elements diff --git a/tests/sorts/tests_radix_sort.f90 b/tests/sorts/tests_radix_sort.f90 index 26dcc04..afce2ce 100644 --- a/tests/sorts/tests_radix_sort.f90 +++ b/tests/sorts/tests_radix_sort.f90 @@ -6,7 +6,6 @@ program tests_radix_sort use radix_sort_module implicit none - integer :: i integer, dimension(:), allocatable :: array integer, parameter :: base10 = 10, base2 = 2, base16 = 16 From 862750977af4b72e502faf53c80099e14b3454de Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:46:21 +0200 Subject: [PATCH 2/7] style: treat warnings as errors --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef62b3a..a69c599 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.16) project(FortranProject LANGUAGES Fortran) -add_compile_options(-Wall -Wextra -Wpedantic) +add_compile_options(-Wall -Wextra -Wpedantic -Werror) function(add_fortran_sources DIR SOURCES) file(GLOB_RECURSE NEW_SOURCES "${DIR}/*.f90") From fb742a54683203cc01ab031c096a3182781e5eae Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Fri, 27 Sep 2024 08:48:33 +0200 Subject: [PATCH 3/7] style: add `-Wconversion-extra` --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a69c599..590425a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 3.16) project(FortranProject LANGUAGES Fortran) -add_compile_options(-Wall -Wextra -Wpedantic -Werror) +add_compile_options( + -Wall + -Wextra + -Wpedantic + -Wconversion-extra + -Werror) function(add_fortran_sources DIR SOURCES) file(GLOB_RECURSE NEW_SOURCES "${DIR}/*.f90") From 5a4f522832c342263cb14c4a8d6ac6abc63d52f2 Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Fri, 27 Sep 2024 08:56:15 +0200 Subject: [PATCH 4/7] style: add `-Wsurprising` --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 590425a..d48344c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,7 @@ add_compile_options( -Wextra -Wpedantic -Wconversion-extra + -Wsurprising -Werror) function(add_fortran_sources DIR SOURCES) From 567dab9d4a1622f10b9a009a6f82ef383a9e0fc3 Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Fri, 27 Sep 2024 09:01:13 +0200 Subject: [PATCH 5/7] style: add `-Waliasing` --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d48344c..f16fe57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ add_compile_options( -Wall -Wextra -Wpedantic + -Waliasing -Wconversion-extra -Wsurprising -Werror) From ce831ebb41a132ea0b460611aed9ec1e8f4690e2 Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Fri, 27 Sep 2024 09:04:54 +0200 Subject: [PATCH 6/7] style: add `-Wimplicit-interface` --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f16fe57..206bec2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ add_compile_options( -Wpedantic -Waliasing -Wconversion-extra + -Wimplicit-interface -Wsurprising -Werror) From 3aecabafc6393628c809b9c13a90faeb18fec017 Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Fri, 27 Sep 2024 09:06:01 +0200 Subject: [PATCH 7/7] style: add `-Wimplicit-procedure` --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 206bec2..55a9b27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ add_compile_options( -Waliasing -Wconversion-extra -Wimplicit-interface + -Wimplicit-procedure -Wsurprising -Werror)