-
-
Notifications
You must be signed in to change notification settings - Fork 47
Support selected Intel-specific preprocessor macro expansions #341
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
Open
emanspeaks
wants to merge
24
commits into
fortran-lang:master
Choose a base branch
from
emanspeaks:ifort-fpp-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
05f93a7
allow for whitespace in PP directives, better def arg regex
emanspeaks f297da5
add draft of unit test
emanspeaks d23088d
Merge branch 'master' into ifort-fpp-fixes
emanspeaks 37752c8
revert changes to try to fix unit tests
emanspeaks 4367f32
everything working but the def regex
emanspeaks 1b3735e
working regex that is at least backwards compatible
emanspeaks 3ddeb00
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6e63f04
working version of macro expansion w/ tests
emanspeaks e1ce5eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0b6fbaa
housekeeping
emanspeaks ccb4d37
replace \s* with [ ]*
emanspeaks b7c3572
attempt to remedy regex warnings
emanspeaks efed76f
second attempt to fix regex warnings
emanspeaks c62ef0f
remove ambiguous define arg matching
emanspeaks 107180d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0ecc55d
additional support for Intel FPP
emanspeaks 0de9e0e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 1ea9700
fix issue with json schema
emanspeaks 755370e
addl logical operators for intel fpp
emanspeaks 9b67c67
parse intel fpp operators separately
emanspeaks ad4de4c
init commit of cherry-picked changes from #341
emanspeaks 5cf36e3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6245d85
Merge branch 'generic-macro-expansions' into ifort-fpp-fixes
emanspeaks c975006
rebase intel-specific changes on top of PR #350
emanspeaks 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
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
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
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,22 @@ | ||
!! sample code adapted from json-fortran/json_macros.inc | ||
|
||
# define SPACING_TEST | ||
# define FILE_ENCODING ,encoding='UTF-8' | ||
|
||
# ifdef __GFORTRAN__ | ||
! gfortran uses cpp in old-school compatibility mode so | ||
! the # stringify and ## concatenate operators don't work | ||
! but we can use C/C++ style comment to ensure PROCEDURE is | ||
! correctly tokenized and prepended with 'wrap_' when the | ||
! macro is expanded | ||
# define MAYBEWRAP(PROCEDURE) PROCEDURE , wrap_/**/PROCEDURE | ||
# else | ||
! Intel's fpp does support the more contemporary ## concatenation | ||
! operator, but doesn't treat the C/C++ comments the same way. | ||
! If you use the gfortran approach and pass the -noB switch to | ||
! fpp, the macro will expand, but with a space between wrap_ and | ||
! whatever PROCEDURE expands to | ||
# define MAYBEWRAP(PROCEDURE) PROCEDURE | ||
# endif | ||
|
||
# define MACROARGS( x , y ) x + y |
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,40 @@ | ||
program preprocessor_spacing_arg_defs | ||
implicit none | ||
|
||
#include "indent.h" | ||
|
||
type :: test_type | ||
private | ||
integer, public :: test_int | ||
|
||
contains | ||
generic, public :: set_test => MAYBEWRAP(test_type_set_test) | ||
procedure :: MAYBEWRAP(test_type_set_test) | ||
|
||
end type test_type | ||
|
||
type(test_type) :: the_test | ||
integer :: argtest | ||
|
||
call the_test%set_test() | ||
|
||
argtest = MACROARGS(the_test%test_int, 4) | ||
|
||
contains | ||
subroutine test_type_set_test(me) | ||
implicit none | ||
|
||
class(test_type), intent(inout) :: me | ||
|
||
me%test_int = 3 | ||
end subroutine test_type_set_test | ||
|
||
subroutine wrap_test_type_set_test(me) | ||
implicit none | ||
|
||
class(test_type), intent(inout) :: me | ||
|
||
me%test_int = 5 | ||
end subroutine wrap_test_type_set_test | ||
|
||
end program preprocessor_spacing_arg_defs |
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.