From ac484c29b5be83dc5df52c577ed7c14f8dfbeceb Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Wed, 7 Aug 2024 18:45:14 -0500 Subject: [PATCH 1/3] build(assert_macro.h): mv to include/ subdir --- example/invoke-via-macro.F90 | 2 +- {src/assert => include}/assert_macros.h | 0 test/test-assert-macro.F90 | 12 ++++++------ 3 files changed, 7 insertions(+), 7 deletions(-) rename {src/assert => include}/assert_macros.h (100%) diff --git a/example/invoke-via-macro.F90 b/example/invoke-via-macro.F90 index d87dabe..3799990 100644 --- a/example/invoke-via-macro.F90 +++ b/example/invoke-via-macro.F90 @@ -1,4 +1,4 @@ -#include "../src/assert/assert_macros.h" +#include "assert_macros.h" program invoke_via_macro !! Demonstrate how to invoke the 'assert' subroutine using a preprocessor macro that facilitates diff --git a/src/assert/assert_macros.h b/include/assert_macros.h similarity index 100% rename from src/assert/assert_macros.h rename to include/assert_macros.h diff --git a/test/test-assert-macro.F90 b/test/test-assert-macro.F90 index 23e4d14..213161c 100644 --- a/test/test-assert-macro.F90 +++ b/test/test-assert-macro.F90 @@ -6,12 +6,12 @@ program test_assert_macros print *,"The call_assert macro" #define DEBUG -#include "../../src/assert/assert_macros.h" +#include "assert_macros.h" call_assert(1==1) print *," passes on not error-terminating when an assertion expression evaluating to .true. is the only argument" #undef DEBUG -#include "../../src/assert/assert_macros.h" +#include "assert_macros.h" call_assert(.false.) print *," passes on being removed by the preprocessor when DEBUG is undefined" // new_line('') @@ -20,12 +20,12 @@ program test_assert_macros print *,"The call_assert_describe macro" #define DEBUG -#include "../../src/assert/assert_macros.h" +#include "assert_macros.h" call_assert_describe(.true., ".true.") print *," passes on not error-terminating when assertion = .true. and a description is present" #undef DEBUG -#include "../../src/assert/assert_macros.h" +#include "assert_macros.h" call_assert_describe(.false., "") print *," passes on being removed by the preprocessor when DEBUG is undefined" // new_line('') @@ -34,12 +34,12 @@ program test_assert_macros print *,"The call_assert_diagnose macro" #define DEBUG -#include "../../src/assert/assert_macros.h" +#include "assert_macros.h" call_assert_diagnose(.true., ".true.", diagnostic_data=1) print *," passes on not error-terminating when assertion = .true. and description and diagnostic_data are present" #undef DEBUG -#include "../../src/assert/assert_macros.h" +#include "assert_macros.h" call_assert_describe(.false., "") print *," passes on being removed by the preprocessor when DEBUG is undefined" From 11889de448a6055e585fba10f87b719eb3b037c1 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Wed, 7 Aug 2024 19:11:38 -0500 Subject: [PATCH 2/3] fix(example): work around fpm bug + gfortran bug --- example/derived-type_diagnostic.F90 | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/example/derived-type_diagnostic.F90 b/example/derived-type_diagnostic.F90 index 5d2385e..740f8ca 100644 --- a/example/derived-type_diagnostic.F90 +++ b/example/derived-type_diagnostic.F90 @@ -25,10 +25,10 @@ pure module function z(self) result(self_z) complex self_z end function - pure module function defined(self) + pure module function defined(self) result(self_defined) !! Result is true if the object has been marked as user-defined. class(stuff_t), intent(in) :: self - logical defined + logical self_defined end function end interface @@ -41,14 +41,10 @@ pure module function construct(z) result(new_stuff_t) end function end interface -end module - -submodule(stuff_m) stuff_s - implicit none contains module procedure defined - defined = self%defined_ + self_defined = self%defined_ end procedure module procedure construct @@ -62,7 +58,7 @@ pure module function construct(z) result(new_stuff_t) self_z = self%z_ end procedure -end submodule +end module module characterizable_stuff_m !! Demonstrate a pattern for getting derived-type diagnostic data output from a type that @@ -105,10 +101,6 @@ pure module function construct(stuff) result(new_characterizable_stuff) end interface -end module - -submodule(characterizable_stuff_m) characterizable_stuff_s - implicit none contains module procedure as_character @@ -122,7 +114,7 @@ pure module function construct(stuff) result(new_characterizable_stuff) new_characterizable_stuff%stuff_ = stuff end procedure -end submodule +end module program diagnostic_data_pattern !! Demonstrate From 25facb0101b50f0f7bd49c750fd4d29e02469f55 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Wed, 7 Aug 2024 19:11:47 -0500 Subject: [PATCH 3/3] build(fpm.toml): install libassert.a library --- fpm.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fpm.toml b/fpm.toml index 05e3bc5..373abd7 100644 --- a/fpm.toml +++ b/fpm.toml @@ -4,3 +4,7 @@ license = "BSD" author = ["Damian Rouson"] maintainer = "damian@sourceryinstitute.org" copyright = "2021-2024 Sourcery Institute" + +[install] +library = true +