Skip to content

Commit c0d1e9c

Browse files
committed
Add fortran to keyword tests
1 parent ab9c311 commit c0d1e9c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Examples/test-suite/wallkw.i

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@
77
%warnfilter(SWIGWARN_PARSE_KEYWORD) pass; // 'pass' is a python keyword, renaming to '_pass'
88
%warnfilter(SWIGWARN_PARSE_KEYWORD) alias; // 'alias' is a D keyword, renaming to '_alias'
99
%warnfilter(SWIGWARN_PARSE_KEYWORD) rescue; // 'rescue' is a ruby keyword, renaming to 'C_rescue'
10+
%warnfilter(SWIGWARN_PARSE_KEYWORD) write; // 'write' is a fortran keyword, just warn
11+
%warnfilter(SWIGWARN_LANG_IDENTIFIER) _123_leading_underscore; // leading underscores and numbers are illegal in fortran
12+
13+
// Silence warning for renamed identifiers
14+
%warnfilter(SWIGWARN_LANG_IDENTIFIER,SWIGWARN_PARSE_KEYWORD) delegate;
15+
%warnfilter(SWIGWARN_LANG_IDENTIFIER,SWIGWARN_PARSE_KEYWORD) pass;
16+
%warnfilter(SWIGWARN_LANG_IDENTIFIER,SWIGWARN_PARSE_KEYWORD) alias;
1017

1118
%inline %{
1219
const char * clone() { return "clone"; }
1320
const char * delegate() { return "delegate"; }
1421
const char * pass() { return "pass"; }
1522
const char * alias() { return "alias"; }
1623
const char * rescue() { return "rescue"; }
24+
const char * write() { return "write"; }
25+
const char * _123_leading_underscore() { return "_123_leading_underscore"; }
1726
%}
1827

Lib/allkw.swg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
%include <csharp/csharpkw.swg>
2020
%include <d/dkw.swg>
21+
%include <fortran/fortrankw.swg>
2122
%include <go/gokw.swg>
2223
%include <java/javakw.swg>
2324
%include <lua/luakw.swg>

Lib/fortran/fortrankw.swg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
%keywordwarn("'release' is reserved for SWIG destructors",
3535
rename="release_") "*::release";
3636

37-
#ifdef SWIGFORTRAN
37+
#ifdef %fortransubroutine
3838
/* Always treat return values from assignment as optional, since it's usually
3939
* idiomatic to `return *this;` as a reference that is often ignored by the
4040
* calling code. Making the function a subroutine means being able to use "call"

0 commit comments

Comments
 (0)