Skip to content

Commit e25911b

Browse files
authored
Merge branch 'swig:master' into imfunc
2 parents e10da8a + 11009f8 commit e25911b

File tree

308 files changed

+5143
-4908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

308 files changed

+5143
-4908
lines changed

.github/workflows/ci.yml

Lines changed: 457 additions & 0 deletions
Large diffs are not rendered by default.

.travis.yml

Lines changed: 0 additions & 499 deletions
This file was deleted.

CCache/README.swig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ This directory contains a version of ccache. The initial version was based on cc
22
debian patches 01-02, 04-14, see the debian/patches subdirectory. The ccache-win32-2.4 modifications
33
to ccache-2.4 have also been merged in.
44

5-
Changes have been made to support cacheing the output from SWIG. The ability to cache c/c++ compiler
5+
Changes have been made to support caching the output from SWIG. The ability to cache c/c++ compiler
66
output has been retained.
77

88
Additional features added are the CCACHE_VERBOSE and CCACHE_SWIG environment variables, see docs.

CCache/execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ int execute(char **argv,
137137
_dup2(fd, 2);
138138
_close(fd);
139139

140-
/* Spawn process (_exec* familly doesn't return) */
140+
/* Spawn process (_exec* family doesn't return) */
141141
status = _spawnv(_P_WAIT, argv[0], (const char **)argv);
142142

143143
/* Restore descriptors */

CCache/snprintf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* for string length. This covers a nasty loophole.
1717
*
1818
* The other functions are there to prevent NULL pointers from
19-
* causing nast effects.
19+
* causing nasty effects.
2020
*
2121
* More Recently:
2222
* Brandon Long <[email protected]> 9/15/96 for mutt 0.43
@@ -30,7 +30,7 @@
3030
* probably requires libm on most operating systems. Don't yet
3131
* support the exponent (e,E) and sigfig (g,G). Also, fmtint()
3232
* was pretty badly broken, it just wasn't being exercised in ways
33-
* which showed it, so that's been fixed. Also, formated the code
33+
* which showed it, so that's been fixed. Also, formatted the code
3434
* to mutt conventions, and removed dead code left over from the
3535
* original. Also, there is now a builtin-test, just compile with:
3636
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm

CCache/web/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h2>Latest release</h2>
3434

3535
You can get this release from the <a href="http://ccache.samba.org/ftp/ccache/">download directory</a>
3636

37-
<p>NOTE! This release changes the hash input slighly, so you will
37+
<p>NOTE! This release changes the hash input slightly, so you will
3838
probably find that you will not get any hits against your existing
3939
cache when you upgrade.
4040

CHANGES.current

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,149 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
77
Version 4.1.0 (in progress)
88
===========================
99

10+
2022-02-02: olly
11+
[Ruby] https://sourceforge.net/p/swig/bugs/1136/ Fix remove of prefix
12+
from method name to only remove it at the start.
13+
14+
2022-02-01: olly
15+
#231 Handle returning an object by reference in a C++ trailing
16+
return type.
17+
18+
2022-02-01: davidcl
19+
[Scilab] #745 use SWIG_<module>_Init() as a C module init function.
20+
21+
2022-02-01: olly
22+
[OCaml] #2083 Fix to work when CAML_SAFE_STRING is on, which it is
23+
by default in recent Ocaml releases.
24+
25+
2022-01-31: mreeez
26+
https://sourceforge.net/p/swig/bugs/1147/
27+
Fix copyToR() generated for a struct in a namespace.
28+
29+
2022-01-29: fschlimb
30+
#655 Better handling of using declarations.
31+
32+
2022-01-29: dontpanic92
33+
#676 Fix code generated for a C++ class with a non-capitalised
34+
name.
35+
36+
2022-01-26: trex58
37+
#1919 #1921 #1923 Various fixes for AIX portability.
38+
39+
2022-01-26: olly
40+
#1935 Don't crash on an unclosed HTML tag in a doxygen comment
41+
when -doxygen is specified.
42+
43+
2022-01-25: olly
44+
Constant expressions now support member access with `.` such as
45+
`foo.bar`. Previous this only worked in a case like `x->foo.bar`.
46+
47+
2022-01-25: olly
48+
#2091 Support most cases of `sizeof` applied to an expression
49+
in constant expressions. Previously there was only support for
50+
`sizeof(<type>)` and expressions which syntactically look like a
51+
type (such as `sizeof(foo)`).
52+
53+
2022-01-25: olly
54+
#80 #635 https://sourceforge.net/p/swig/bugs/1139/
55+
Add support for parsing common cases of `<` and `>` comparisons
56+
in constant expressions. Adding full support for these seems hard
57+
to do without introducing conflicts into the parser grammar, but in
58+
fact all reported cases have had parentheses around the comparison
59+
and we can support that with a few restrictions on the left side of
60+
`<`.
61+
62+
2022-01-25: wsfulton
63+
New warning 327 for extern templates, eg:
64+
65+
extern template class std::vector<int>;
66+
extern template void Func<int>();
67+
68+
results in warning
69+
70+
example.i:3: Warning 327: Extern template ignored.
71+
example.i:4: Warning 327: Extern template ignored.
72+
73+
Extern template classes previously resulted in warning 320.
74+
75+
2022-01-24: romintomasetti
76+
#2131 #2157 C++11 extern function template parsing error fix.
77+
78+
2022-01-21: wsfulton
79+
#2120 #2138 Replace legacy PCRE dependency with PCRE2.
80+
This requires changes for building SWIG from source. See updated
81+
html documentation in Preface.html and Windows.html. Updated
82+
instructions are also shown when running ./configure if PCRE2 is not
83+
found. Note that debian based systems can install PCRE2 using:
84+
85+
apt install libpcre2-dev
86+
87+
Note that https://github.com/swig/swig/wiki/Getting-Started also has
88+
updated information for building from source.
89+
90+
2022-01-19: olly
91+
[PHP] #2027 Automatically generate PHP type declarations for PHP 8.
92+
The generate code still compiles for PHP 7.x, but without type
93+
declarations since PHP 7.x has much more limited type declaration
94+
support.
95+
96+
2022-01-18: olly
97+
[Perl] #1629 Perl 5.8.0 is now the oldest version we aim to support.
98+
99+
2022-01-14: wsfulton
100+
[Python] Fix %callback and specifying the callback function as a
101+
static member function using Python staticmethod syntax, such as
102+
Klass.memberfunction instead of Klass_memberfunction when using
103+
-builtin and -fastproxy.
104+
105+
2022-01-11: wsfulton
106+
[Python] Accept keyword arguments accessing static member functions when
107+
using -builtin and kwargs feature and Python class staticmethod syntax.
108+
The missing keyword argument support was only when using the
109+
class staticmethod syntax, such as Klass.memberfunction, and not when
110+
using the flat static method syntax, such as Klass_memberfunction.
111+
112+
2022-01-04: juierror
113+
[Go] #2045 Add support for std::array in std_array.i.
114+
115+
2021-12-18: olly
116+
[PHP] Add PHP keyword 'readonly' (added in 8.1) to the list SWIG
117+
knows to automatically rename. This keyword is special in that PHP
118+
allows it to be used as a function (or method) name.
119+
120+
2021-12-07: vstinner
121+
[Python] #2116 Python 3.11 support: use Py_SET_TYPE()
122+
123+
2021-12-05: rwf1
124+
[Octave] #2020 #1893 Add support for Octave 6 up to and including 6.4.
125+
Also add support for compiling with -Bsymbolic which is used by default
126+
by mkoctfile.
127+
128+
2021-12-02: jsenn
129+
[Python] #2102 Fixed crashes when using embedded Python interpreters.
130+
131+
2021-11-12: wsfulton
132+
[Javascript] v8 and node only. Fix mismatched new char[] and free()
133+
when wrapping C code char arrays. Now calloc is now used instead of
134+
new char[] in SWIG_AsCharPtrAndSize.
135+
136+
2021-10-03: ajrh1
137+
[Perl] #2074: Avoid -Wmisleading-indentation in generated code
138+
when using gcc11.
139+
140+
2021-10-03: jschueller
141+
[CMake] #2065: Add option to enable or disable PCRE support.
142+
143+
2021-09-16: ianlancetaylor
144+
[Go] Improved _cgo_panic implementation.
145+
146+
2021-09-16: ianlancetaylor
147+
[Go] Don't use crosscall2 for panicking. Instead rely on documented
148+
and exported interfaces.
149+
150+
2021-09-14: ianlancetaylor
151+
[Go] Remove -no-cgo option (long unsupported in Go)
152+
10153
2021-05-04: olly
11154
[PHP] #2014 Throw PHP exceptions instead of using PHP errors
12155

CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ if (MSVC)
7373
set (CMAKE_CXX_FLAGS "/EHsc ${CMAKE_CXX_FLAGS}")
7474
endif ()
7575

76-
set (PCRE_REQUIRED_ARG "REQUIRED" CACHE STRING "required arg")
77-
find_package (PCRE ${PCRE_REQUIRED_ARG})
78-
if (PCRE_FOUND)
76+
option (WITH_PCRE "Enable PCRE" ON)
77+
if (WITH_PCRE)
78+
find_package (PCRE2 REQUIRED)
7979
set (HAVE_PCRE 1)
80-
include_directories (${PCRE_INCLUDE_DIRS})
80+
include_directories (${PCRE2_INCLUDE_DIRS})
8181
endif()
8282

8383
if (WIN32)
@@ -145,8 +145,8 @@ add_executable (swig
145145
${PROJECT_BINARY_DIR}/Source/CParse/parser.c
146146
${PROJECT_BINARY_DIR}/Source/CParse/parser.h
147147
)
148-
if (PCRE_FOUND)
149-
target_link_libraries (swig ${PCRE_LIBRARIES})
148+
if (PCRE2_FOUND)
149+
target_link_libraries (swig ${PCRE2_LIBRARIES})
150150
endif ()
151151
install (TARGETS swig DESTINATION bin)
152152

@@ -160,6 +160,7 @@ include (CPack)
160160
# few tests
161161
enable_testing ()
162162
add_test (NAME cmd_version COMMAND swig -version)
163+
add_test (NAME cmd_pcreversion COMMAND swig -pcreversion)
163164
add_test (NAME cmd_swiglib COMMAND swig -swiglib)
164165
add_test (NAME cmd_external_runtime COMMAND swig -external-runtime ext_rt.h)
165166
set_tests_properties(cmd_external_runtime PROPERTIES ENVIRONMENT "SWIG_LIB=${PROJECT_SOURCE_DIR}/Lib")

Doc/Devel/internals.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,12 @@ <h3>2.6 Lists</h3>
441441

442442
<blockquote>
443443
<pre>
444-
hash len: 5
445-
get: hashval2
446-
hash item: hashval5 [h5]
447-
hash item: hashval1 [h1]
448-
hash item: hashval2 [h2]
449-
hash item: hashval3 [h3]
444+
list len: 5
445+
get: listval2
446+
list item: newlistval1
447+
list item: listval2
448+
list item: listval3
449+
list item: listval5
450450
</pre>
451451
</blockquote>
452452

@@ -494,12 +494,12 @@ <h3>2.7 Hash tables </h3>
494494

495495
<blockquote>
496496
<pre>
497-
list len: 5
498-
get: listval2
499-
list item: newlistval1
500-
list item: listval2
501-
list item: listval3
502-
list item: listval5
497+
hash len: 5
498+
get: hashval2
499+
hash item: hashval5 [h5]
500+
hash item: hashval1 [h1]
501+
hash item: hashval2 [h2]
502+
hash item: hashval3 [h3]
503503
</pre>
504504
</blockquote>
505505

Doc/Manual/CPlusPlus11.html

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,39 @@ <H3><a name="CPlusPlus11_generalized_constant_expressions">7.2.2 Generalized con
144144
<H3><a name="CPlusPlus11_extern_template">7.2.3 Extern template</a></H3>
145145

146146

147-
<p>SWIG correctly parses the keywords <tt>extern template</tt>.
147+
<p>SWIG correctly parses <tt>extern template</tt> explicit instantiation declarations.
148148
However, this template instantiation suppression in a translation unit has no relevance outside of the C++ compiler and so is not used by SWIG.
149-
SWIG only uses <tt>%template</tt> for instantiating and wrapping templates.</p>
149+
SWIG only uses <tt>%template</tt> for instantiating and wrapping templates.
150+
Consider the class template below:
151+
</p>
152+
153+
<div class="code"><pre>
154+
// Class template
155+
template class std::vector&lt;int&gt;; // C++03 template explicit instantiation definition in C++
156+
extern template class std::vector&lt;int&gt;; // C++11 template explicit instantiation declaration (extern template)
157+
%template(VectorInt) std::vector&lt;int&gt;; // SWIG template instantiation
158+
</pre></div>
159+
160+
<p>
161+
The above result in warnings:
162+
</p>
163+
164+
<div class="shell">
165+
<pre>
166+
example.i:2: Warning 320: Explicit template instantiation ignored.
167+
example.i:3: Warning 327: Extern template ignored.
168+
</pre>
169+
</div>
170+
171+
<p>
172+
Similarly for the function template below:
173+
</p>
150174

151175
<div class="code"><pre>
152-
template class std::vector&lt;int&gt;; // C++03 explicit instantiation in C++
153-
extern template class std::vector&lt;int&gt;; // C++11 explicit instantiation suppression in C++
154-
%template(VectorInt) std::vector&lt;int&gt;; // SWIG instantiation
176+
// Function template
177+
template void Func&lt;int&gt;(); // C++03 template explicit instantiation definition in C++
178+
extern template void Func&lt;int&gt;(); // C++11 template explicit instantiation declaration (extern template)
179+
%template(FuncInt) Func&lt;int&gt;; // SWIG template instantiation
155180
</pre></div>
156181

157182
<H3><a name="CPlusPlus11_initializer_lists">7.2.4 Initializer lists</a></H3>

0 commit comments

Comments
 (0)