Repository navigation
Feature: pure stop_and_print subroutine #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f800ae5
feat(stop_and_print): print string_t in pure procs
rouson 8c2e689
Apply Copilot suggestions from code review
bonachea 601848d
refactoring(stop_and_print): call internal error termination subroutine
rouson f0bec0b
test(stop_and_print): revert Copilot hallucination
rouson a2b4a8a
fix(stop_and_print): import internal_error_stop
rouson 0bbf9c9
test/modules/test_description_test_m: Fix some harmless warnings from…
bonachea 6708d13
Adjust julienne_error_stop_interface to include `pure`
bonachea f18bd3c
julienne::test_t: Ensure that test_t is treated as a default-initiali…
bonachea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| ! Copyright (c), The Regents of the University of California and Sourcery Institute | ||
| ! Terms of use are as specified in LICENSE.txt | ||
|
|
||
| module julienne_stop_and_print_m | ||
| !! Define a pure subroutine that terminates with an ERROR STOP message from a string_t | ||
| use julienne_string_m, only : string_t | ||
| use julienne_multi_image_m, only : internal_error_stop | ||
| implicit none | ||
|
|
||
| private | ||
| public :: stop_and_print | ||
|
|
||
| contains | ||
|
|
||
| pure subroutine stop_and_print(message) | ||
| implicit none | ||
| type(string_t), intent(in) :: message | ||
| call internal_error_stop(message%string()) | ||
| end subroutine | ||
|
|
||
| end module | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
rouson marked this conversation as resolved.
Resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| ! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute | ||
| ! Terms of use are as specified in LICENSE.txt | ||
|
|
||
| #include "julienne-assert-macros.h" | ||
| #include "language-support.F90" | ||
|
|
||
| program stop_and_print_in_pure_procedure | ||
| !! Conditionally test printing via error termination inside a pure procedure | ||
| use julienne_m, only : command_line_t, string_t, operator(.csv.), stop_and_print | ||
| implicit none | ||
|
|
||
| #if HAVE_MULTI_IMAGE_SUPPORT | ||
| associate(command_line => command_line_t(), me => this_image()) | ||
| #else | ||
| associate(command_line => command_line_t(), me => 1) | ||
| #endif | ||
| if (.not. command_line%argument_present([character(len=len("--help"))::"--help","-h"])) then | ||
| #if TEST_INTENTIONAL_FAILURE && ASSERTIONS | ||
| if (me==1) print '(a)', new_line('') // 'Test the intentional failure of stop_and_print in a pure procedure: ' // new_line('') | ||
| call pure_subroutine | ||
| #else | ||
| if (me==1) print '(a)', & | ||
| new_line('') // & | ||
| 'Skipping the test in ' // __FILE__ // '.' // new_line('') // & | ||
| 'Add the following to your fpm command to test the stop_and_print: --flag "-DASSERTIONS -DTEST_INTENTIONAL_FAILURE"' // & | ||
| new_line('') | ||
| #endif | ||
| end if | ||
| end associate | ||
|
|
||
| contains | ||
|
|
||
| pure subroutine pure_subroutine | ||
| integer, parameter :: array(*) = [1,2,3,4] | ||
| call stop_and_print("array = " // .csv. string_t(array)) | ||
| end subroutine | ||
|
|
||
| end program |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.