Skip to content

Commit b6157fc

Browse files
committed
Update macro line continuation recommendation
gfortran's preprocessor is happy with a blank line break, but ifx insists on a backslash (which gfortran also accepts). So update recommended best practice to backslash continuation
1 parent fa52525 commit b6157fc

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ Instead when breaking long lines in a macro invocation, just break the line (no
197197
continuation character!), eg:
198198

199199
```fortran
200-
! When breaking a lines in a macro invocation, just use new-line with no `&` continuation character:
201-
call_assert_diagnose( computed_checksum == expected_checksum,
202-
"Checksum mismatch failure!",
200+
! When breaking a lines in a macro invocation, use backslash `\` continuation character:
201+
call_assert_diagnose( computed_checksum == expected_checksum, \
202+
"Checksum mismatch failure!", \
203203
expected_checksum )
204204
```
205205

@@ -223,8 +223,8 @@ comment (because they are removed by the preprocessor), for example with
223223
gfortran one can instead write the following:
224224

225225
```fortran
226-
call_assert_diagnose( computed_checksum == expected_checksum, /* ensured since version 3.14 */
227-
"Checksum mismatch failure!", /* TODO: write a better message here */
226+
call_assert_diagnose( computed_checksum == expected_checksum, /* ensured since version 3.14 */ \
227+
"Checksum mismatch failure!", /* TODO: write a better message here */ \
228228
computed_checksum )
229229
```
230230

@@ -233,8 +233,8 @@ When in doubt, one can always move the comment outside the macro invocation:
233233

234234
```fortran
235235
! assert a property ensured since version 3.14
236-
call_assert_diagnose( computed_checksum == expected_checksum,
237-
"Checksum mismatch failure!",
236+
call_assert_diagnose( computed_checksum == expected_checksum, \
237+
"Checksum mismatch failure!", \
238238
computed_checksum ) ! TODO: write a better message above
239239
```
240240

test/test-assert-macro.F90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ program test_assert_macros
4444
block
4545
integer :: computed_checksum = 37, expected_checksum = 37
4646

47-
call_assert_diagnose( computed_checksum == expected_checksum,
48-
"Checksum mismatch failure!",
49-
expected_checksum )
47+
call_assert_diagnose( computed_checksum == expected_checksum, \
48+
"Checksum mismatch failure!", \
49+
expected_checksum )
5050
print *," passes with macro-style line breaks"
5151

52-
call_assert_diagnose( computed_checksum == expected_checksum, /* ensured since version 3.14 */
53-
"Checksum mismatch failure!", /* TODO: write a better message here */
52+
call_assert_diagnose( computed_checksum == expected_checksum, /* ensured since version 3.14 */ \
53+
"Checksum mismatch failure!", /* TODO: write a better message here */ \
5454
computed_checksum )
5555
print *," passes with C block comments embedded in macro"
5656

0 commit comments

Comments
 (0)