Skip to content

Commit

Permalink
Update way to get a c_bool logical literal
Browse files Browse the repository at this point in the history
  • Loading branch information
ktras committed Dec 13, 2023
1 parent 0eb2b02 commit 917666e
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion example/hello.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ program hello_world
call num_images(image_count=num_imgs)
print *, "Hello from image", me, "of", num_imgs

call prif_stop(logical(.false., c_bool), stop_code_int=0) ! normal termination
call prif_stop(.false._c_bool, stop_code_int=0) ! normal termination

end program
2 changes: 1 addition & 1 deletion example/support-test/error_stop_character_code.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program error_stop_character_code
call prif_init(init_exit_code)
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code"

call prif_error_stop(logical(.false., c_bool), stop_code_char="Oh snap!")
call prif_error_stop(.false._c_bool, stop_code_char="Oh snap!")

stop 0 ! ../../test/caf_error_stop_test.f90 will report a test failure if this line runs
end program
2 changes: 1 addition & 1 deletion example/support-test/error_stop_integer_code.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program error_stop_integer_code
call prif_init(init_exit_code)
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code"

call prif_error_stop(logical(.false., c_bool), 1)
call prif_error_stop(.false._c_bool, 1)

stop 0 ! caffeine/test/caf_error_stop_test.f90 reports a failure if this line runs
end program
2 changes: 1 addition & 1 deletion example/support-test/stop_with_integer_code.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program stop_with_no_code
call prif_init(init_exit_code)
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code"

call prif_stop(logical(.false., c_bool), 1)
call prif_stop(.false._c_bool, 1)

stop 2 ! caffeine/test/zzz_finalization_test.f90 reports a failure if this line runs
end program
2 changes: 1 addition & 1 deletion example/support-test/stop_with_no_code.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program stop_with_no_code
call prif_init(init_exit_code)
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code"

call prif_stop(logical(.false., c_bool))
call prif_stop(.false._c_bool)

stop 1 ! caffeine/test/zzz_finalization_test.f90 reports a failure if this line runs
end program
4 changes: 2 additions & 2 deletions src/caffeine/assert/assert_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

end if represent_diagnostics_as_string

call prif_error_stop(logical(.false., c_bool), stop_code_char=header // ' with diagnostic data "' // trailer // '"')
call prif_error_stop(.false._c_bool, stop_code_char=header // ' with diagnostic data "' // trailer // '"')

end if check_assertion

Expand All @@ -78,7 +78,7 @@ pure function string(numeric) result(number_as_string)
type is(real)
write(untrimmed_string, *) numeric
class default
call prif_error_stop(logical(.false., c_bool), &
call prif_error_stop(.false._c_bool, &
stop_code_char="Internal error in subroutine 'assert': unsupported type in function 'string'.")
end select

Expand Down
10 changes: 5 additions & 5 deletions src/caffeine/assert/intrinsic_array_s.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
type is(double precision)
intrinsic_array%double_precision_1D = array
class default
call prif_error_stop(logical(.false., c_bool), stop_code_char="intrinsic_array_t construct: unsupported rank-2 type")
call prif_error_stop(.false._c_bool, stop_code_char="intrinsic_array_t construct: unsupported rank-2 type")
end select
#ifndef NAGFOR
rank(2)
Expand All @@ -39,7 +39,7 @@
type is(double precision)
intrinsic_array%double_precision_2D = array
class default
call prif_error_stop(logical(.false., c_bool), stop_code_char="intrinsic_array_t construct: unsupported rank-2 type")
call prif_error_stop(.false._c_bool, stop_code_char="intrinsic_array_t construct: unsupported rank-2 type")
end select

rank(3)
Expand All @@ -55,11 +55,11 @@
type is(double precision)
intrinsic_array%double_precision_3D = array
class default
call prif_error_stop(logical(.false., c_bool), stop_code_char="intrinsic_array_t construct: unsupported rank-3 type")
call prif_error_stop(.false._c_bool, stop_code_char="intrinsic_array_t construct: unsupported rank-3 type")
end select

rank default
call prif_error_stop(logical(.false., c_bool), stop_code_char="intrinsic_array_t construct: unsupported rank")
call prif_error_stop(.false._c_bool, stop_code_char="intrinsic_array_t construct: unsupported rank")
end select
#endif

Expand All @@ -75,7 +75,7 @@
allocated(self%logical_2D), allocated(self%real_2D), &
allocated(self%complex_3D), allocated(self%complex_double_3D), allocated(self%integer_3D), &
allocated(self%logical_3D), allocated(self%real_3D) &
])) call prif_error_stop(logical(.false., c_bool), &
])) call prif_error_stop(.false._c_bool, &
stop_code_char="intrinsic_array_t as_character: ambiguous component allocation status.")

if (allocated(self%complex_1D)) then
Expand Down
2 changes: 1 addition & 1 deletion src/caffeine/collective_subroutines/co_max_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
else if (caf_is_f_string(a)) then
call prif_co_reduce(a, c_funloc(reverse_alphabetize), optional_value(result_image), stat, errmsg)
else
call prif_error_stop(logical(.false., c_bool), stop_code_char="caf_co_max: unsupported type")
call prif_error_stop(.false._c_bool, stop_code_char="caf_co_max: unsupported type")
end if

contains
Expand Down
2 changes: 1 addition & 1 deletion src/caffeine/collective_subroutines/co_min_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
else if (caf_is_f_string(a)) then
call prif_co_reduce(a, c_funloc(alphabetize), optional_value(result_image), stat, errmsg)
else
call prif_error_stop(logical(.false., c_bool), stop_code_char="prif_co_min: unsupported type")
call prif_error_stop(.false._c_bool, stop_code_char="prif_co_min: unsupported type")
end if

contains
Expand Down
2 changes: 1 addition & 1 deletion src/caffeine/collective_subroutines/co_reduce_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
call caf_co_reduce(a, optional_value(result_image), stat_ptr, errmsg_ptr, &
int(product(shape(a)), c_size_t), c_funloc(Coll_ReduceSub_c_double_complex), c_null_ptr)
else
call prif_error_stop(logical(.false., c_bool), stop_code_char="caf_co_reduce: unsupported type")
call prif_error_stop(.false._c_bool, stop_code_char="caf_co_reduce: unsupported type")
end if

contains
Expand Down
2 changes: 1 addition & 1 deletion src/caffeine/program_startup_s.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function c_interop_arg(argnum) result(arg)
arg => targ
#endif
call get_command_argument(argnum, arg, arglen)
if (arglen+1>max_arg_len) call prif_error_stop(logical(.false., c_bool), stop_code_char="maximum argument length exceeded")
if (arglen+1>max_arg_len) call prif_error_stop(.false._c_bool, stop_code_char="maximum argument length exceeded")
arg(arglen+1:arglen+1) = c_null_char
end function

Expand Down

0 comments on commit 917666e

Please sign in to comment.