mirror of https://github.com/swig/swig
Rename func to funk in tests to avoid Go keyword problems
This commit is contained in:
parent
67190cbb2e
commit
95e8643d70
|
@ -17,20 +17,20 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct A1 {
|
struct A1 {
|
||||||
void func(int i) {}
|
void funk(int i) {}
|
||||||
A1() = default;
|
A1() = default;
|
||||||
~A1() = default;
|
~A1() = default;
|
||||||
void func(double i) = delete; /* Don't cast double to int. Compiler returns an error */
|
void funk(double i) = delete; /* Don't cast double to int. Compiler returns an error */
|
||||||
private:
|
private:
|
||||||
A1(const A1&);
|
A1(const A1&);
|
||||||
};
|
};
|
||||||
A1::A1(const A1&) = default;
|
A1::A1(const A1&) = default;
|
||||||
|
|
||||||
struct A2 {
|
struct A2 {
|
||||||
void func(int i) {}
|
void funk(int i) {}
|
||||||
virtual void fff(int) = delete;
|
virtual void fff(int) = delete;
|
||||||
virtual ~A2() = default;
|
virtual ~A2() = default;
|
||||||
template<class T> void func(T) = delete;
|
template<class T> void funk(T) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct trivial {
|
struct trivial {
|
||||||
|
|
|
@ -51,7 +51,7 @@ int glob = 123;
|
||||||
|
|
||||||
Thingy &&globalrrval = Thingy(55, std::move(glob));
|
Thingy &&globalrrval = Thingy(55, std::move(glob));
|
||||||
|
|
||||||
short && func(short &&i) { return std::move(i); }
|
short && funk(short &&i) { return std::move(i); }
|
||||||
Thingy getit() { return Thingy(22, std::move(glob)); }
|
Thingy getit() { return Thingy(22, std::move(glob)); }
|
||||||
|
|
||||||
void rvalrefFunction1(int &&v = (int &&)5) {}
|
void rvalrefFunction1(int &&v = (int &&)5) {}
|
||||||
|
|
|
@ -108,5 +108,5 @@ PairSubclass::data_t plus1(PairSubclass::const_ref_data_t x) { return x + 1; }
|
||||||
using callback_t = int(*)(int);
|
using callback_t = int(*)(int);
|
||||||
|
|
||||||
callback_t get_callback() { return mult2; }
|
callback_t get_callback() { return mult2; }
|
||||||
int call(callback_t func, int param) { return func(param); }
|
int call(callback_t funk, int param) { return funk(param); }
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class java_director_assumeoverride_runme {
|
||||||
public static void main(String argv[]) {
|
public static void main(String argv[]) {
|
||||||
OverrideMe overrideMe = new MyOverrideMe();
|
OverrideMe overrideMe = new MyOverrideMe();
|
||||||
|
|
||||||
// MyOverrideMe doesn't actually override func(), but because assumeoverride
|
// MyOverrideMe doesn't actually override funk(), but because assumeoverride
|
||||||
// was set to true, the C++ side will believe it was overridden.
|
// was set to true, the C++ side will believe it was overridden.
|
||||||
if (!java_director_assumeoverride.isFuncOverridden(overrideMe)) {
|
if (!java_director_assumeoverride.isFuncOverridden(overrideMe)) {
|
||||||
throw new RuntimeException ( "isFuncOverridden()" );
|
throw new RuntimeException ( "isFuncOverridden()" );
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
class OverrideMe {
|
class OverrideMe {
|
||||||
public:
|
public:
|
||||||
virtual ~OverrideMe() {}
|
virtual ~OverrideMe() {}
|
||||||
virtual void func() {};
|
virtual void funk() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "java_director_assumeoverride_wrap.h"
|
#include "java_director_assumeoverride_wrap.h"
|
||||||
|
@ -23,7 +23,7 @@ bool isFuncOverridden(OverrideMe* f) {
|
||||||
class OverrideMe {
|
class OverrideMe {
|
||||||
public:
|
public:
|
||||||
virtual ~OverrideMe();
|
virtual ~OverrideMe();
|
||||||
virtual void func();
|
virtual void funk();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isFuncOverridden(OverrideMe* f);
|
bool isFuncOverridden(OverrideMe* f);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var null_pointer = require("null_pointer");
|
var null_pointer = require("null_pointer");
|
||||||
|
|
||||||
if (!null_pointer.func(null)) {
|
if (!null_pointer.funk(null)) {
|
||||||
throw new Error("Javascript 'null' should be converted into NULL.");
|
throw new Error("Javascript 'null' should be converted into NULL.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,7 @@ namespace std
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual ~A() {}
|
virtual ~A() {}
|
||||||
#ifndef SWIGGO // func is a keyword in Go.
|
virtual int funk() = 0;
|
||||||
virtual int func() = 0;
|
|
||||||
#endif
|
|
||||||
private:
|
private:
|
||||||
typedef complex False;
|
typedef complex False;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
%module null_pointer
|
%module null_pointer
|
||||||
|
|
||||||
%warnfilter(SWIGWARN_PARSE_KEYWORD) func; // 'func' is a Go keyword, renamed as 'Xfunc'
|
|
||||||
|
|
||||||
%inline {
|
%inline {
|
||||||
struct A {};
|
struct A {};
|
||||||
|
|
||||||
bool func(A* a) {
|
bool funk(A* a) {
|
||||||
return !a;
|
return !a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,4 +5,4 @@ endif
|
||||||
|
|
||||||
null_pointer;
|
null_pointer;
|
||||||
|
|
||||||
assert(func([]));
|
assert(funk([]));
|
||||||
|
|
|
@ -5,8 +5,8 @@ endif
|
||||||
|
|
||||||
octave_cell_deref;
|
octave_cell_deref;
|
||||||
|
|
||||||
assert(func("hello"));
|
assert(funk("hello"));
|
||||||
assert(func({"hello"}));
|
assert(funk({"hello"}));
|
||||||
|
|
||||||
c = func2();
|
c = func2();
|
||||||
assert(strcmp(c{1}, "hello"));
|
assert(strcmp(c{1}, "hello"));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%module octave_cell_deref
|
%module octave_cell_deref
|
||||||
|
|
||||||
%inline {
|
%inline {
|
||||||
bool func(const char* s) {
|
bool funk(const char* s) {
|
||||||
return !strcmp("hello",s);
|
return !strcmp("hello",s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ if is_python_builtin():
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
t = Test()
|
t = Test()
|
||||||
t.func()
|
t.funk()
|
||||||
if is_new_style_class(Test):
|
if is_new_style_class(Test):
|
||||||
t.static_func()
|
t.static_func()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -17,11 +17,11 @@ def clearstaticpath():
|
||||||
staticfuncpath = None
|
staticfuncpath = None
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%pythonappend Test::func %{
|
%pythonappend Test::funk %{
|
||||||
funcpath = os.path.dirname(funcpath)
|
funcpath = os.path.dirname(funcpath)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%pythonprepend Test::func %{
|
%pythonprepend Test::funk %{
|
||||||
global funcpath
|
global funcpath
|
||||||
funcpath = mypath
|
funcpath = mypath
|
||||||
%}
|
%}
|
||||||
|
@ -46,7 +46,7 @@ import os.path
|
||||||
class Test {
|
class Test {
|
||||||
public:
|
public:
|
||||||
static void static_func() {};
|
static void static_func() {};
|
||||||
void func() {};
|
void funk() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SWIGPYTHON_BUILTIN
|
#ifdef SWIGPYTHON_BUILTIN
|
||||||
|
|
|
@ -2,6 +2,6 @@ exec("swigtest.start", -1);
|
||||||
|
|
||||||
p = getnull();
|
p = getnull();
|
||||||
checkequal(SWIG_this(p), 0, "SWIG_this(p)");
|
checkequal(SWIG_this(p), 0, "SWIG_this(p)");
|
||||||
checkequal(func(p), %T, "func(p)");
|
checkequal(funk(p), %T, "funk(p)");
|
||||||
|
|
||||||
exec("swigtest.quit", -1);
|
exec("swigtest.quit", -1);
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace simuPOP
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int func() const
|
virtual int funk() const
|
||||||
{ return m_pop.m_a; }
|
{ return m_pop.m_a; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace simuPOP
|
||||||
struct DerivedOperator: public Operator<Pop>
|
struct DerivedOperator: public Operator<Pop>
|
||||||
{
|
{
|
||||||
DerivedOperator(int a):Operator<Pop>(a){}
|
DerivedOperator(int a):Operator<Pop>(a){}
|
||||||
virtual int func() const
|
virtual int funk() const
|
||||||
{ return 2*this->m_pop.m_a; }
|
{ return 2*this->m_pop.m_a; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ namespace simuPOP
|
||||||
void test( const std::vector< Operator<pop>*>& para)
|
void test( const std::vector< Operator<pop>*>& para)
|
||||||
{
|
{
|
||||||
for( size_t i =0; i < para.size(); ++i)
|
for( size_t i =0; i < para.size(); ++i)
|
||||||
para[i]->func();
|
para[i]->funk();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ if [ catch { load ./null_pointer[info sharedlibextension] null_pointer} err_msg
|
||||||
}
|
}
|
||||||
|
|
||||||
set a [A]
|
set a [A]
|
||||||
if {[func $a] != 0} {
|
if {[funk $a] != 0} {
|
||||||
puts stderr "null_pointer test 1 failed"
|
puts stderr "null_pointer test 1 failed"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue