Skip to content

Commit 206089b

Browse files
authored
Merge pull request #166 from swig-fortran/merge-upstream-swig
Merge upstream swig
2 parents f4c12f0 + 977d325 commit 206089b

File tree

982 files changed

+13628
-34424
lines changed

Some content is hidden

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

982 files changed

+13628
-34424
lines changed

.github/workflows/ci.yml

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'CHANGES*'
7+
- 'Doc/**'
8+
- 'appveyor.yml'
9+
pull_request:
10+
branches: master
11+
paths-ignore:
12+
- 'CHANGES*'
13+
- 'Doc/**'
14+
- 'appveyor.yml'
15+
16+
jobs:
17+
build:
18+
19+
# When continue-on-error is true for an individual build, that build can fail (it'll show red),
20+
# but it won't fail the overall build
21+
continue-on-error: ${{ matrix.continue-on-error || false }}
22+
23+
runs-on: ${{ matrix.os || 'ubuntu-20.04' }}
24+
25+
# By default, the name of the build is the language used and SWIG options, but matrix entries
26+
# can define the additional "desc" field with any additional information to include in the name.
27+
name: ${{ matrix.SWIGLANG || 'none' }}${{ matrix.PY3 }} ${{ matrix.ENGINE}} ${{ matrix.VER }} ${{ matrix.SWIG_FEATURES }} ${{ (matrix.compiler || 'gcc') }}${{ matrix.GCC }} ${{ matrix.CPPSTD }} ${{ matrix.CSTD }} ${{ matrix.desc }} ${{ matrix.continue-on-error && '(can fail)' }}
28+
29+
strategy:
30+
matrix:
31+
include:
32+
- SWIGLANG: fortran
33+
CPPSTD: c++11
34+
- SWIGLANG: fortran
35+
CPPSTD: c++11
36+
- SWIGLANG: fortran
37+
CPPSTD: c++17
38+
FCSTD: f2003
39+
GCC: 11
40+
# Run all of them, as opposed to aborting when one fails
41+
fail-fast: false
42+
43+
env:
44+
SWIGLANG: ${{ matrix.SWIGLANG }}
45+
PY3: ${{ matrix.PY3 }}
46+
VER: ${{ matrix.VER }}
47+
ENGINE: ${{ matrix.ENGINE }}
48+
SWIG_FEATURES: ${{ matrix.SWIG_FEATURES }}
49+
GCC: ${{ matrix.GCC }}
50+
CSTD: ${{ matrix.CSTD }}
51+
CPPSTD: ${{ matrix.CPPSTD }}
52+
FCSTD: ${{ matrix.FCSTD }}
53+
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v2
57+
with:
58+
submodules: recursive
59+
60+
- name: Install CCache
61+
uses: hendrikmuhs/ccache-action@v1
62+
with:
63+
key: ${{ matrix.os || 'ubuntu-20.04' }}-${{ matrix.compiler || 'gcc' }}${{ matrix.GCC }}
64+
65+
# Uncomment to debug via ssh, see https://github.com/mxschmitt/action-tmate
66+
# - name: Setup tmate session
67+
# uses: mxschmitt/action-tmate@v3
68+
69+
- name: Install Dependencies
70+
run: |
71+
set -x
72+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
73+
echo PATH="$PATH" >> $GITHUB_ENV
74+
75+
source $GITHUB_WORKSPACE/Tools/GHA-linux-install.sh
76+
echo WITHLANG="$WITHLANG" >> $GITHUB_ENV
77+
78+
case $(uname) in
79+
Linux)
80+
cpu_count=$(nproc)
81+
;;
82+
83+
Darwin)
84+
cpu_count=$(sysctl -n hw.ncpu)
85+
;;
86+
87+
*)
88+
cpu_count=1
89+
;;
90+
esac
91+
92+
if [[ $cpu_count != 1 ]]; then
93+
echo SWIGJOBS=-j$cpu_count >> $GITHUB_ENV
94+
fi
95+
96+
if test '${{ matrix.compiler }}' = 'clang'; then
97+
CC="clang"
98+
CXX="clang++"
99+
100+
CFLAGS="$CFLAGS -fPIE"
101+
CXXFLAGS="$CXXFLAGS -fPIE"
102+
elif test -n "$GCC"; then
103+
CC="gcc-$GCC"
104+
CXX="g++-$GCC"
105+
FC="gfortran-$GCC"
106+
else
107+
CC="gcc"
108+
CXX="g++"
109+
FC="gfortran"
110+
fi
111+
112+
export CC CXX FC
113+
114+
echo CC="$CC" >> $GITHUB_ENV
115+
echo CXX="$CXX" >> $GITHUB_ENV
116+
echo FC="$FC" >> $GITHUB_ENV
117+
118+
ls -la $(which $CC) $(which $CXX)
119+
$CC --version
120+
$CXX --version
121+
$FC --version
122+
123+
- name: Configure
124+
run: |
125+
source $GITHUB_WORKSPACE/Tools/CI-linux-environment.sh
126+
set -x
127+
128+
if [[ -z "$CSTD" ]]; then
129+
case "$CPPSTD" in
130+
c++11) export CSTD=c11 ;;
131+
c++14) export CSTD=c11 ;;
132+
c++17) export CSTD=c17 ;;
133+
esac
134+
echo CSTD="$CSTD" >> $GITHUB_ENV
135+
fi
136+
if test -n "$CPPSTD"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=$CPPSTD $CXXFLAGS"); fi
137+
if test -n "$CSTD"; then CONFIGOPTS+=("CFLAGS=-std=$CSTD $CFLAGS"); fi
138+
if test -n "$FCSTD"; then CONFIGOPTS+=("FCFLAGS=-std=$FCSTD $FCFLAGS"); fi
139+
if test -n "$SWIGLANG"; then CONFIGOPTS+=(--without-alllang --with-$WITHLANG); fi
140+
echo "${CONFIGOPTS[@]}"
141+
./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}"
142+
143+
- name: Build
144+
working-directory: build/build
145+
run: |
146+
set -x
147+
make -s $SWIGJOBS
148+
./swig -version && ./swig -pcreversion
149+
150+
- name: Test
151+
working-directory: build/build
152+
run: |
153+
source $GITHUB_WORKSPACE/Tools/CI-linux-environment.sh
154+
set -x
155+
156+
if test -z "$SWIGLANG"; then
157+
make $SWIGJOBS check-ccache
158+
make $SWIGJOBS check-errors-test-suite
159+
else
160+
case "$SWIGLANG" in
161+
javascript)
162+
case "$ENGINE" in
163+
v8 | jsc)
164+
# Running tests using v8 or jsc involves creating a custom
165+
# interpreter in Tools/javascript, which is currently broken
166+
# for parallel builds (we attempt to update this interpreter
167+
# while running, resulting in "Text file busy" error).
168+
unset SWIGJOBS
169+
esac
170+
;;
171+
esac
172+
173+
# Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
174+
cflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cflags --std=$CSTD --compiler=$CC)
175+
cxxflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cxxflags --std=$CPPSTD --compiler=$CC)
176+
fcflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --fcflags --std=$FCSTD --compiler=$FC)
177+
make check-$SWIGLANG-version
178+
make check-$SWIGLANG-enabled
179+
make $SWIGJOBS check-$SWIGLANG-examples CFLAGS="$cflags" CXXFLAGS="$cxxflags" FCFLAGS="$fcflags"
180+
make $SWIGJOBS check-$SWIGLANG-test-suite CFLAGS="$cflags" CXXFLAGS="$cxxflags" FCFLAGS="$fcflags"
181+
fi
182+
183+
- name: Install
184+
working-directory: build/build
185+
run: |
186+
set -x
187+
if test -z "$SWIGLANG"; then sudo make install && swig -version && ccache-swig -V; fi
188+
189+
- name: Clean
190+
working-directory: build/build
191+
run: |
192+
set -x
193+
make check-maintainer-clean && ../../configure

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ Examples/guile/*/my-guile
158158

159159
# Java
160160
Examples/test-suite/java/*/
161+
Examples/test-suite/java/expected.txt
162+
Examples/test-suite/java/got.txt
161163
Examples/java/*/*.java
162164
!Examples/java/*/runme.java
163165
Examples/java/doxygen/javadocs
@@ -190,11 +192,8 @@ Examples/perl5/*/*.pm
190192

191193
# PHP
192194
Examples/test-suite/php/php_*.h
193-
Examples/test-suite/php/*.php
194-
!Examples/test-suite/php/*runme.php
195-
!Examples/test-suite/php/skel.php
196195
Examples/php/*/php_*.h
197-
Examples/php/*/example.php
196+
Examples/php/pragmas/example.php
198197

199198
# Python
200199
# Based on https://github.com/github/gitignore/blob/master/Python.gitignore

.travis.yml

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

ANNOUNCE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
*** ANNOUNCE: SWIG 4.0.2 (8 Jun 2020) ***
1+
*** ANNOUNCE: SWIG 4.1.0 (in progress) ***
22

33
http://www.swig.org
44

5-
We're pleased to announce SWIG-4.0.2, the latest SWIG release.
5+
We're pleased to announce SWIG-4.1.0, the latest SWIG release.
66

77
What is SWIG?
88
=============
@@ -25,11 +25,11 @@ Availability
2525
============
2626
The release is available for download on Sourceforge at
2727

28-
http://prdownloads.sourceforge.net/swig/swig-4.0.2.tar.gz
28+
http://prdownloads.sourceforge.net/swig/swig-4.1.0.tar.gz
2929

3030
A Windows version is also available at
3131

32-
http://prdownloads.sourceforge.net/swig/swigwin-4.0.2.zip
32+
http://prdownloads.sourceforge.net/swig/swigwin-4.1.0.zip
3333

3434
Please report problems with this release to the swig-devel mailing list,
3535
details at http://www.swig.org/mail.html.

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/configure.ac

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
dnl Process this file with autoconf to produce a configure script.
22

3-
AC_INIT([ccache-swig], [0.0]) # Get version from SWIG in ccache_swig_config.h.in
4-
AC_PREREQ(2.52)
3+
AC_INIT([ccache-swig],[0.0]) # Get version from SWIG in ccache_swig_config.h.in
4+
AC_PREREQ([2.60])
55
AC_CONFIG_SRCDIR([ccache.h])
66

77
AC_MSG_NOTICE([Configuring ccache])
88

9-
AC_CONFIG_HEADER(config.h)
9+
AC_CONFIG_HEADERS([config.h])
1010
AC_CONFIG_FILES([config_win32.h])
1111

1212
dnl Checks for programs.
@@ -41,7 +41,7 @@ else
4141
fi
4242

4343
AC_HEADER_DIRENT
44-
AC_HEADER_TIME
44+
4545
AC_HEADER_SYS_WAIT
4646

4747
AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h sys/time.h)
@@ -51,19 +51,16 @@ AC_CHECK_FUNCS(gethostname getpwuid)
5151
AC_CHECK_FUNCS(utimes)
5252

5353
AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
54-
AC_TRY_COMPILE(
55-
[#include <stdlib.h>],
56-
[
54+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], [[
5755
void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }
58-
],
59-
ccache_cv_COMPAR_FN_T=yes,ccache_cv_COMPAR_FN_T=no)])
56+
]])],[ccache_cv_COMPAR_FN_T=yes],[ccache_cv_COMPAR_FN_T=no])])
6057
if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
6158
AC_DEFINE(HAVE_COMPAR_FN_T, 1, [ ])
6259
fi
6360

6461
dnl Note: This could be replaced by AC_FUNC_SNPRINTF() in the autoconf macro archive
6562
AC_CACHE_CHECK([for C99 vsnprintf],ccache_cv_HAVE_C99_VSNPRINTF,[
66-
AC_TRY_RUN([
63+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
6764
#include <sys/types.h>
6865
#include <stdarg.h>
6966
void foo(const char *format, ...) {
@@ -81,8 +78,7 @@ void foo(const char *format, ...) {
8178
exit(0);
8279
}
8380
main() { foo("hello"); }
84-
],
85-
ccache_cv_HAVE_C99_VSNPRINTF=yes,ccache_cv_HAVE_C99_VSNPRINTF=no,ccache_cv_HAVE_C99_VSNPRINTF=cross)])
81+
]])],[ccache_cv_HAVE_C99_VSNPRINTF=yes],[ccache_cv_HAVE_C99_VSNPRINTF=no],[ccache_cv_HAVE_C99_VSNPRINTF=cross])])
8682
if test x"$ccache_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
8783
AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ])
8884
fi

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

0 commit comments

Comments
 (0)