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 {
|
||||
void func(int i) {}
|
||||
void funk(int i) {}
|
||||
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:
|
||||
A1(const A1&);
|
||||
};
|
||||
A1::A1(const A1&) = default;
|
||||
|
||||
struct A2 {
|
||||
void func(int i) {}
|
||||
void funk(int i) {}
|
||||
virtual void fff(int) = delete;
|
||||
virtual ~A2() = default;
|
||||
template<class T> void func(T) = delete;
|
||||
template<class T> void funk(T) = delete;
|
||||
};
|
||||
|
||||
struct trivial {
|
||||
|
|
|
@ -51,7 +51,7 @@ int glob = 123;
|
|||
|
||||
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)); }
|
||||
|
||||
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);
|
||||
|
||||
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[]) {
|
||||
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.
|
||||
if (!java_director_assumeoverride.isFuncOverridden(overrideMe)) {
|
||||
throw new RuntimeException ( "isFuncOverridden()" );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
class OverrideMe {
|
||||
public:
|
||||
virtual ~OverrideMe() {}
|
||||
virtual void func() {};
|
||||
virtual void funk() {};
|
||||
};
|
||||
|
||||
#include "java_director_assumeoverride_wrap.h"
|
||||
|
@ -23,7 +23,7 @@ bool isFuncOverridden(OverrideMe* f) {
|
|||
class OverrideMe {
|
||||
public:
|
||||
virtual ~OverrideMe();
|
||||
virtual void func();
|
||||
virtual void funk();
|
||||
};
|
||||
|
||||
bool isFuncOverridden(OverrideMe* f);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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.");
|
||||
}
|
||||
|
||||
|
|
|
@ -40,9 +40,7 @@ namespace std
|
|||
#endif
|
||||
|
||||
virtual ~A() {}
|
||||
#ifndef SWIGGO // func is a keyword in Go.
|
||||
virtual int func() = 0;
|
||||
#endif
|
||||
virtual int funk() = 0;
|
||||
private:
|
||||
typedef complex False;
|
||||
};
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
%module null_pointer
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_KEYWORD) func; // 'func' is a Go keyword, renamed as 'Xfunc'
|
||||
|
||||
%inline {
|
||||
struct A {};
|
||||
|
||||
bool func(A* a) {
|
||||
bool funk(A* a) {
|
||||
return !a;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,4 +5,4 @@ endif
|
|||
|
||||
null_pointer;
|
||||
|
||||
assert(func([]));
|
||||
assert(funk([]));
|
||||
|
|
|
@ -5,8 +5,8 @@ endif
|
|||
|
||||
octave_cell_deref;
|
||||
|
||||
assert(func("hello"));
|
||||
assert(func({"hello"}));
|
||||
assert(funk("hello"));
|
||||
assert(funk({"hello"}));
|
||||
|
||||
c = func2();
|
||||
assert(strcmp(c{1}, "hello"));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%module octave_cell_deref
|
||||
|
||||
%inline {
|
||||
bool func(const char* s) {
|
||||
bool funk(const char* s) {
|
||||
return !strcmp("hello",s);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ if is_python_builtin():
|
|||
exit(0)
|
||||
|
||||
t = Test()
|
||||
t.func()
|
||||
t.funk()
|
||||
if is_new_style_class(Test):
|
||||
t.static_func()
|
||||
else:
|
||||
|
|
|
@ -17,11 +17,11 @@ def clearstaticpath():
|
|||
staticfuncpath = None
|
||||
%}
|
||||
|
||||
%pythonappend Test::func %{
|
||||
%pythonappend Test::funk %{
|
||||
funcpath = os.path.dirname(funcpath)
|
||||
%}
|
||||
|
||||
%pythonprepend Test::func %{
|
||||
%pythonprepend Test::funk %{
|
||||
global funcpath
|
||||
funcpath = mypath
|
||||
%}
|
||||
|
@ -46,7 +46,7 @@ import os.path
|
|||
class Test {
|
||||
public:
|
||||
static void static_func() {};
|
||||
void func() {};
|
||||
void funk() {};
|
||||
};
|
||||
|
||||
#ifdef SWIGPYTHON_BUILTIN
|
||||
|
|
|
@ -2,6 +2,6 @@ exec("swigtest.start", -1);
|
|||
|
||||
p = getnull();
|
||||
checkequal(SWIG_this(p), 0, "SWIG_this(p)");
|
||||
checkequal(func(p), %T, "func(p)");
|
||||
checkequal(funk(p), %T, "funk(p)");
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace simuPOP
|
|||
{
|
||||
}
|
||||
|
||||
virtual int func() const
|
||||
virtual int funk() const
|
||||
{ return m_pop.m_a; }
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace simuPOP
|
|||
struct DerivedOperator: public Operator<Pop>
|
||||
{
|
||||
DerivedOperator(int a):Operator<Pop>(a){}
|
||||
virtual int func() const
|
||||
virtual int funk() const
|
||||
{ return 2*this->m_pop.m_a; }
|
||||
};
|
||||
|
||||
|
@ -90,7 +90,7 @@ namespace simuPOP
|
|||
void test( const std::vector< Operator<pop>*>& para)
|
||||
{
|
||||
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]
|
||||
if {[func $a] != 0} {
|
||||
if {[funk $a] != 0} {
|
||||
puts stderr "null_pointer test 1 failed"
|
||||
exit 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue