Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fortran
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrj committed Aug 18, 2023
2 parents 2ea30bc + 872a3ed commit f94cae6
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 102 deletions.
80 changes: 45 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ jobs:
- SWIGLANG: ""
GCC: 12
os: ubuntu-22.04
- SWIGLANG: ""
GCC: 13
os: ubuntu-22.04
- SWIGLANG: ""
compiler: clang
os: ubuntu-22.04
- SWIGLANG: csharp
- SWIGLANG: d
VER: 'ldc'
Expand Down Expand Up @@ -76,6 +80,13 @@ jobs:
- SWIGLANG: guile
VER: '3.0'
- SWIGLANG: java
- SWIGLANG: javascript
ENGINE: jsc
VER: '4.0'
- SWIGLANG: javascript
ENGINE: napi
VER: '18'
CPPSTD: c++11
#- SWIGLANG: javascript
# ENGINE: node
# VER: '6'
Expand All @@ -95,21 +106,6 @@ jobs:
ENGINE: node
VER: '12'
CPPSTD: c++11
- SWIGLANG: javascript
ENGINE: node
VER: '18'
CPPSTD: c++14
- SWIGLANG: javascript
ENGINE: napi
VER: '14'
CPPSTD: c++11
- SWIGLANG: javascript
ENGINE: napi
VER: '18'
CPPSTD: c++14
- SWIGLANG: javascript
ENGINE: jsc
VER: '4.0'
- SWIGLANG: lua
- SWIGLANG: lua
VER: '5.3'
Expand Down Expand Up @@ -144,6 +140,9 @@ jobs:
VER: '3.10'
- SWIGLANG: python
VER: '3.11'
- SWIGLANG: python
VER: '3.12'
CSTD: gnu99
- SWIGLANG: python
PY2: 2
SWIG_FEATURES: -builtin
Expand Down Expand Up @@ -266,70 +265,81 @@ jobs:
CPPSTD: c++14
- SWIGLANG: tcl
CPPSTD: c++14
# c++17 testing (using gcc11)
# c++17 testing (using gcc13)
- SWIGLANG: csharp
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: fortran
CPPSTD: c++17
FCSTD: f2003
GCC: 11
GCC: 13
- SWIGLANG: go
VER: '1.17'
CPPSTD: c++17
GCC: 11
GCC: 13
CSTD: gnu17
- SWIGLANG: guile
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: java
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: javascript
ENGINE: node
VER: '18'
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: lua
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: octave
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: perl5
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: php
CPPSTD: c++17
CSTD: gnu17
GCC: 11
GCC: 13
- SWIGLANG: python
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: r
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: ruby
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: scilab
CPPSTD: c++17
GCC: 11
GCC: 13
- SWIGLANG: tcl
CPPSTD: c++17
GCC: 11
# c++20 testing (using gcc12)
# ubuntu-22.04 is currently experimental on Github Actions, so limit to just one language for now
GCC: 13
# c++20 testing (using gcc13)
- SWIGLANG: python
CPPSTD: c++20
GCC: 12
GCC: 13
os: ubuntu-22.04
- SWIGLANG: javascript
ENGINE: napi
VER: '20'
CPPSTD: c++20
GCC: 13
os: ubuntu-22.04
- SWIGLANG: javascript
ENGINE: node
VER: '20'
CPPSTD: c++20
GCC: 13
os: ubuntu-22.04
# Experimental languages (these are allowed to fail)
- SWIGLANG: mzscheme
continue-on-error: true
#- SWIGLANG: ocaml
# CPPSTD: c++17
# GCC: 11
# GCC: 13
# continue-on-error: true
# os: ubuntu-18.04 # ocaml-4.08 in ubuntu-20.04 not yet working
# Run all of them, as opposed to aborting when one fails
Expand Down
49 changes: 24 additions & 25 deletions CCache/mdfour.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
It assumes that a int is at least 32 bits long
*/

static struct mdfour *m;

#define MASK32 (0xffffffff)

#define F(X,Y,Z) ((((X)&(Y)) | ((~(X))&(Z))))
Expand All @@ -38,12 +36,12 @@ static struct mdfour *m;
#define ROUND3(a,b,c,d,k,s) a = lshift((a + H(b,c,d) + M[k] + 0x6ED9EBA1)&MASK32,s)

/* this applies md4 to 64 byte chunks */
static void mdfour64(uint32 *M)
static void mdfour64(struct mdfour *md, uint32 *M)
{
uint32 AA, BB, CC, DD;
uint32 A,B,C,D;

A = m->A; B = m->B; C = m->C; D = m->D;
A = md->A; B = md->B; C = md->C; D = md->D;
AA = A; BB = B; CC = C; DD = D;

ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7);
Expand Down Expand Up @@ -80,7 +78,7 @@ static void mdfour64(uint32 *M)
A &= MASK32; B &= MASK32;
C &= MASK32; D &= MASK32;

m->A = A; m->B = B; m->C = C; m->D = D;
md->A = A; md->B = B; md->C = C; md->D = D;
}

static void copy64(uint32 *M, const unsigned char *in)
Expand Down Expand Up @@ -111,15 +109,15 @@ void mdfour_begin(struct mdfour *md)
}


static void mdfour_tail(const unsigned char *in, int n)
static void mdfour_tail(struct mdfour *md, const unsigned char *in, int n)
{
unsigned char buf[128];
uint32 M[16];
uint32 b;

m->totalN += n;
md->totalN += n;

b = m->totalN * 8;
b = md->totalN * 8;

memset(buf, 0, 128);
if (n) memcpy(buf, in, n);
Expand All @@ -128,24 +126,22 @@ static void mdfour_tail(const unsigned char *in, int n)
if (n <= 55) {
copy4(buf+56, b);
copy64(M, buf);
mdfour64(M);
mdfour64(md, M);
} else {
copy4(buf+120, b);
copy64(M, buf);
mdfour64(M);
mdfour64(md, M);
copy64(M, buf+64);
mdfour64(M);
mdfour64(md, M);
}
}

void mdfour_update(struct mdfour *md, const unsigned char *in, int n)
{
uint32 M[16];

m = md;

if (in == NULL) {
mdfour_tail(md->tail, md->tail_len);
mdfour_tail(md, md->tail, md->tail_len);
return;
}

Expand All @@ -158,18 +154,18 @@ void mdfour_update(struct mdfour *md, const unsigned char *in, int n)
in += len;
if (md->tail_len == 64) {
copy64(M, md->tail);
mdfour64(M);
m->totalN += 64;
mdfour64(md, M);
md->totalN += 64;
md->tail_len = 0;
}
}

while (n >= 64) {
copy64(M, in);
mdfour64(M);
mdfour64(md, M);
in += 64;
n -= 64;
m->totalN += 64;
md->totalN += 64;
}

if (n) {
Expand All @@ -181,12 +177,10 @@ void mdfour_update(struct mdfour *md, const unsigned char *in, int n)

void mdfour_result(struct mdfour *md, unsigned char *out)
{
m = md;

copy4(out, m->A);
copy4(out+4, m->B);
copy4(out+8, m->C);
copy4(out+12, m->D);
copy4(out, md->A);
copy4(out+4, md->B);
copy4(out+8, md->C);
copy4(out+12, md->D);
}


Expand Down Expand Up @@ -272,7 +266,12 @@ static void file_checksum2(char *fname)
printf("\n");
}
#endif

/*
* To test:
* gcc -DTEST_MDFOUR mdfour.c -o mdfourexe && ./mdfourexe <somefile>
* then compare against a reference, such as:
* openssl dgst -md4 <somefile>
*/
int main(int argc, char *argv[])
{
file_checksum1(argv[1]);
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.current
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.2.0 (in progress)
===========================

2023-08-16: shadchin
[Python] #2665 Fix missing-field-initializers warning to provide support
for python-3.12.

2023-08-09: olly
[Ruby] Remove -feature command line option which has been
deprecated since SWIG 1.3.32 in 2007. Use -init_name instead.
Expand Down
2 changes: 1 addition & 1 deletion Examples/scilab/matrix2/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void getStringVector(char ***resultVector, int *sizeRes)
*resultVector = (char**) malloc((*sizeRes) * sizeof(char*));
for (i=0; i<*sizeRes; i++)
{
char* pc = (char*) calloc(3, sizeof(char));
char* pc = (char*) calloc(16, sizeof(char));
sprintf(pc, "%d", i);
(*resultVector)[i] = pc;
}
Expand Down
2 changes: 2 additions & 0 deletions Examples/test-suite/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ CPP_TEST_CASES += \
abstract_basecast \
abstract_inherit \
abstract_inherit_ok \
abstract_inherit_using \
abstract_signature \
abstract_typedef \
abstract_typedef2 \
Expand Down Expand Up @@ -414,6 +415,7 @@ CPP_TEST_CASES += \
smart_pointer_protected \
smart_pointer_rename \
smart_pointer_simple \
smart_pointer_static \
smart_pointer_template_const_overload \
smart_pointer_template_defaults_overload \
smart_pointer_templatemethods \
Expand Down
16 changes: 8 additions & 8 deletions Examples/test-suite/cpp11_ref_qualifiers.i
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ class Host {
public:
string h1() & { return string(); }
string h2() const & { return string(); }
string h3() && { return std::move(string()); }
string h4() const && { return std::move(string()); }
string h3() && { return string(); }
string h4() const && { return string(); }
string h5() const { return string(); }
string h6() volatile const & { return string(); }
string h7() const volatile & { return string(); }
string h8() volatile const && { return std::move(string()); }
string h9() const volatile && { return std::move(string()); }
string h8() volatile const && { return string(); }
string h9() const volatile && { return string(); }

string h() & { return string(); }
string h() const & { return string(); }
string h() && { return std::move(string()); }
string h() const && { return std::move(string()); }
string h() && { return string(); }
string h() const && { return string(); }
};
%}

Expand Down Expand Up @@ -89,11 +89,11 @@ struct Renames {
%inline %{
struct ConversionOperators {
virtual operator string() & { return string(); }
virtual operator string() && { return std::move(string()); }
virtual operator string() && { return string(); }
virtual ~ConversionOperators() {}
};
struct ConversionOperators2 {
virtual operator string() && { return std::move(string()); }
virtual operator string() && { return string(); }
virtual ~ConversionOperators2() {}
};
%}
Expand Down
3 changes: 2 additions & 1 deletion Examples/test-suite/javascript/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ CPP_TEST_CASES += \
li_std_containers_int \
li_std_map_member

CPP_TEST_BROKEN += \
# napi fails
FAILING_CPP_TESTS += \
smart_pointer_static \

SWIGEXE = $(top_builddir)/swig
Expand Down
6 changes: 0 additions & 6 deletions Examples/test-suite/octave/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ CPP11_TEST_CASES += \
cpp11_shared_ptr_overload \
cpp11_shared_ptr_upcast \

CPP_TEST_BROKEN += \
implicittest \
li_implicit \
li_std_set \
li_std_stream

include $(srcdir)/../common.mk

# Overridden variables here
Expand Down
Loading

0 comments on commit f94cae6

Please sign in to comment.