-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from albertziegenhagel/pp-nested-if
Fix nested pre-processor blocks
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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,36 @@ | ||
subroutine preprocessor_if_nested() | ||
|
||
! This file, as used in test_preproc, tests that when there are nested | ||
! if-else preprocessor blocks, only the branches are used where ALL | ||
! statements leading to the definition evaluate to true. | ||
|
||
#if 0 | ||
#if 1 | ||
#define PART1 1 | ||
#else | ||
#define PART2 1 | ||
#endif | ||
#else | ||
#if 1 | ||
#define PART3 1 | ||
#else | ||
#define PART4 1 | ||
#endif | ||
#endif | ||
|
||
#ifndef PART1 | ||
#define PART1 0 | ||
#endif | ||
#ifndef PART2 | ||
#define PART2 0 | ||
#endif | ||
#ifndef PART3 | ||
#define PART3 0 | ||
#endif | ||
#ifndef PART4 | ||
#define PART4 0 | ||
#endif | ||
|
||
integer, parameter :: res = PART1+PART2+PART3+PART4 | ||
|
||
endsubroutine preprocessor_if_nested |