Merge branch 'stricter-warnings'
* stricter-warnings: Go changes for wrappers to compile as ISO C90 Scilab typecheck typemaps fix for C90 No error for one Javascript node warning Warning fix in testcase for Javascript node nested_extend_c testcase fix when compiled by C++ target languages Temporarily remove -Werror for Scilab testing C90 fixes for Javascript JSC There are a couple of testcases that aren't compliant and supression via pragmas doesn't work for gcc < 4.8 Warning suppression change Scilab typemap fixes for C89 compiler warning suppression correction in testcase Suppress pedantic warnings in C# testcases Suppress pedantic warnings in testcases Pedantic warning fix in testcase pedantic warning fix for D wrappers Travis testing to use testflags.py for setting CFLAGS and CXXFLAGS Add travis build for error-declaration-after-statement branch
This commit is contained in:
commit
1ef899a57b
25 changed files with 163 additions and 119 deletions
45
.travis.yml
45
.travis.yml
|
|
@ -1,6 +1,6 @@
|
|||
language: cpp
|
||||
compiler:
|
||||
- clang
|
||||
# - clang
|
||||
- gcc
|
||||
env:
|
||||
- SWIGLANG=
|
||||
|
|
@ -88,41 +88,11 @@ before_install:
|
|||
- if test "$SWIGLANG" = "python" -a "$VER"; then sudo add-apt-repository -y ppa:fkrull/deadsnakes && sudo apt-get -qq update && sudo apt-get -qq install python${VER}-dev && export CONFIGOPTS="--with-python${PY3}=python${VER}"; fi
|
||||
- if test "$SWIGLANG" = "scilab"; then sudo apt-get -qq install scilab; fi
|
||||
- if test "$SWIGLANG" = "tcl"; then sudo apt-get -qq install tcl8.4-dev; fi
|
||||
# Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
|
||||
- declare -A CFLAGS_EXAMPLES && CFLAGS_EXAMPLES=(
|
||||
["csharp"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["d"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["go"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["guile"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["java"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["javascript"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["lua"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["octave"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["perl5"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["php"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["python"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["ruby"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["tcl"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["scilab"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
)
|
||||
- declare -A CXXFLAGS_EXAMPLES && CXXFLAGS_EXAMPLES=(
|
||||
["csharp"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["d"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["go"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["guile"]="-Werror -std=c++98 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["java"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["javascript"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["lua"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["octave"]="-Werror -std=c++98 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["perl5"]="-Werror -std=c++98 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["php"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["python"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["ruby"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
["tcl"]="-Werror -std=c++98 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
|
||||
["scilab"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
|
||||
)
|
||||
- $CC --version
|
||||
- $CXX --version
|
||||
# Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
|
||||
- export cflags=$(./testflags.py --language $SWIGLANG --cflags) && echo $cflags
|
||||
- export cxxflags=$(./testflags.py --language $SWIGLANG --cxxflags) && echo $cxxflags
|
||||
script:
|
||||
- echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r'
|
||||
- ./autogen.sh && mkdir -p build/build && cd build/build && ../../configure $CONFIGOPTS
|
||||
|
|
@ -135,11 +105,12 @@ script:
|
|||
- if test -z "$SWIGLANG"; then sudo make -s install && swig -version && ccache-swig -V; fi
|
||||
- echo -en 'travis_fold:end:script.2\\r'
|
||||
- if test -n "$SWIGLANG"; then make -s check-$SWIGLANG-version; fi
|
||||
- if test -n "$SWIGLANG"; then make -k $SWIGJOBS check-$SWIGLANG-examples CFLAGS="${CFLAGS_EXAMPLES[$SWIGLANG]}" CXXFLAGS="${CXXFLAGS_EXAMPLES[$SWIGLANG]}"; fi
|
||||
- if test -n "$SWIGLANG"; then make -k $SWIGJOBS check-$SWIGLANG-test-suite; fi
|
||||
- if test -n "$SWIGLANG"; then make $SWIGJOBS check-$SWIGLANG-examples CFLAGS="$cflags" CXXFLAGS="$cxxflags"; fi
|
||||
- if test -n "$SWIGLANG"; then make $SWIGJOBS check-$SWIGLANG-test-suite CFLAGS="$cflags" CXXFLAGS="$cxxflags"; fi
|
||||
- echo 'Cleaning...' && echo -en 'travis_fold:start:script.3\\r'
|
||||
- make check-maintainer-clean && ../../configure $CONFIGOPTS
|
||||
# - make check-maintainer-clean && ../../configure $CONFIGOPTS
|
||||
- echo -en 'travis_fold:end:script.3\\r'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- error-declaration-after-statement
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ enum UnmanagedExceptions {
|
|||
UnmanagedSystemException,
|
||||
UnmanagedArgumentException,
|
||||
UnmanagedArgumentNullException,
|
||||
UnmanagedArgumentOutOfRangeException,
|
||||
UnmanagedArgumentOutOfRangeException
|
||||
};
|
||||
|
||||
void check_exception(UnmanagedExceptions e) {
|
||||
|
|
|
|||
|
|
@ -77,17 +77,17 @@ public:
|
|||
Number quadruple(Number n) {
|
||||
n.Value *= 4;
|
||||
return n;
|
||||
};
|
||||
}
|
||||
Number times8(const Number& num) {
|
||||
Number n(num);
|
||||
n.Value *= 8;
|
||||
return n;
|
||||
};
|
||||
}
|
||||
Number times12(const Number* num) {
|
||||
Number n(*num);
|
||||
n.Value *= 12;
|
||||
return n;
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
// Test $csinput expansion
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ enum ForwardEnum2 { CCC, DDD };
|
|||
%}
|
||||
|
||||
%inline %{
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* ISO C forbids forward references to ‘enum’ types [-Werror=pedantic] */
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
#if !defined(__SUNPRO_C)
|
||||
enum ForwardEnum1;
|
||||
enum ForwardEnum2;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
%module enum_macro
|
||||
|
||||
%inline %{
|
||||
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* comma at end of enumerator list [-Werror=pedantic] */
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
|
||||
enum Greeks1
|
||||
{
|
||||
#define GREEK1 -1
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ enum AVPixelFormat * use_pixel_format_ptr(enum AVPixelFormat *px) {
|
|||
return px;
|
||||
}
|
||||
|
||||
const enum AVPixelFormat2 use_pixel_format2(const enum AVPixelFormat2 px) {
|
||||
enum AVPixelFormat2 use_pixel_format2(const enum AVPixelFormat2 px) {
|
||||
return px;
|
||||
}
|
||||
const enum AVPixelFormat2 * use_pixel_format_ptr2(const enum AVPixelFormat2 *px) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
%module li_std_auto_ptr
|
||||
|
||||
%{
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // auto_ptr deprecation
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,12 @@
|
|||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer2::IgnoreMe;
|
||||
|
||||
%inline %{
|
||||
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* ISO C++ prohibits anonymous structs [-Werror=pedantic] */
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
struct Outer {
|
||||
typedef int Integer;
|
||||
///////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ typedef struct {
|
|||
} bar;
|
||||
} FOO;
|
||||
|
||||
struct {
|
||||
static struct {
|
||||
int i;
|
||||
} THING;
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace Teuchos {
|
|||
namespace KokkosClassic {
|
||||
namespace DefaultNode {
|
||||
struct DefaultNodeType {};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace Tpetra {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ typedef enum {
|
|||
SWIG_DIllegalArgumentException,
|
||||
SWIG_DIllegalElementException,
|
||||
SWIG_DIOException,
|
||||
SWIG_DNoSuchElementException,
|
||||
SWIG_DNoSuchElementException
|
||||
} SWIG_DExceptionCodes;
|
||||
|
||||
typedef void (* SWIG_DExceptionCallback_t)(const char *);
|
||||
|
|
|
|||
|
|
@ -402,6 +402,7 @@ static JSStaticFunction $jsnspace_functions[] = {
|
|||
};
|
||||
|
||||
static JSClassDefinition $jsnspace_classDefinition;
|
||||
static JSObjectRef $jsmangledname_object;
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -412,7 +413,7 @@ static JSClassDefinition $jsnspace_classDefinition;
|
|||
%{
|
||||
$jsmangledname_classDefinition.staticFunctions = $jsmangledname_functions;
|
||||
$jsmangledname_classDefinition.staticValues = $jsmangledname_values;
|
||||
JSObjectRef $jsmangledname_object = JSObjectMake(context, JSClassCreate(&$jsmangledname_classDefinition), NULL);
|
||||
$jsmangledname_object = JSObjectMake(context, JSClassCreate(&$jsmangledname_classDefinition), NULL);
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -76,11 +76,12 @@ SWIG_From_dec(unsigned long)(unsigned long value)
|
|||
SWIGINTERN int
|
||||
SWIG_AsVal_dec(unsigned long)(JSValueRef obj, unsigned long *val)
|
||||
{
|
||||
long longVal;
|
||||
if(!JSValueIsNumber(context, obj)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
long longVal = (long) JSValueToNumber(context, obj, NULL);
|
||||
longVal = (long) JSValueToNumber(context, obj, NULL);
|
||||
|
||||
if(longVal < 0) {
|
||||
return SWIG_OverflowError;
|
||||
|
|
@ -142,11 +143,12 @@ SWIG_From_dec(unsigned long long)(unsigned long long value)
|
|||
SWIGINTERN int
|
||||
SWIG_AsVal_dec(unsigned long long)(JSValueRef obj, unsigned long long *val)
|
||||
{
|
||||
long long longVal;
|
||||
if(!JSValueIsNumber(context, obj)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
long long longVal = (unsigned long long) JSValueToNumber(context, obj, NULL);
|
||||
longVal = (unsigned long long) JSValueToNumber(context, obj, NULL);
|
||||
|
||||
if(longVal < 0) {
|
||||
return SWIG_OverflowError;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz
|
|||
return JSValueMakeUndefined(context);
|
||||
} else {
|
||||
JSStringRef jsstring;
|
||||
JSValueRef result;
|
||||
if(size < 2) {
|
||||
char c[2];
|
||||
int i;
|
||||
|
|
@ -63,7 +64,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz
|
|||
} else {
|
||||
jsstring = JSStringCreateWithUTF8CString(carray);
|
||||
}
|
||||
JSValueRef result = JSValueMakeString(context, jsstring);
|
||||
result = JSValueMakeString(context, jsstring);
|
||||
JSStringRelease(jsstring);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,8 @@
|
|||
|
||||
// in (bool *IN, int IN_SIZE)
|
||||
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciBoolean_AsBoolArrayAndSize") (bool *IN, int IN_SIZE)
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciBoolean_AsBoolArrayAndSize") (bool *IN, int IN_SIZE) (int rowCount, int colCount)
|
||||
{
|
||||
int rowCount;
|
||||
int colCount;
|
||||
if (SWIG_SciBoolean_AsBoolArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) {
|
||||
$2 = rowCount * colCount;
|
||||
}
|
||||
|
|
@ -39,10 +37,8 @@
|
|||
|
||||
// in (int IN_SIZE, bool *IN)
|
||||
|
||||
%typemap(in, noblock=1) (int IN_SIZE, bool *IN)
|
||||
%typemap(in, noblock=1) (int IN_SIZE, bool *IN) (int rowCount, int colCount)
|
||||
{
|
||||
int rowCount;
|
||||
int colCount;
|
||||
if (SWIG_SciBoolean_AsBoolArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) {
|
||||
$1 = rowCount * colCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,17 +18,15 @@
|
|||
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (int IN_ROWCOUNT, int IN_COLCOUNT, char **IN)
|
||||
{
|
||||
if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, &$1, &$2, &$3, fname) != SWIG_OK {
|
||||
if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, &$1, &$2, &$3, fname) != SWIG_OK) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
// in (char **IN, int IN_SIZE)
|
||||
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (char **IN, int IN_SIZE)
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (char **IN, int IN_SIZE) (int rowCount, int colCount)
|
||||
{
|
||||
int rowCount;
|
||||
int colCount;
|
||||
if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) {
|
||||
$2 = rowCount * colCount;
|
||||
}
|
||||
|
|
@ -39,10 +37,8 @@
|
|||
|
||||
// in (int IN_SIZE, char **IN)
|
||||
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (int IN_SIZE, char **IN)
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (int IN_SIZE, char **IN) (int rowCount, int colCount)
|
||||
{
|
||||
int rowCount;
|
||||
int colCount;
|
||||
if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) {
|
||||
$1 = rowCount * colCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,8 @@
|
|||
|
||||
// in (double *IN, int IN_SIZE)
|
||||
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (double *IN, int IN_SIZE)
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (double *IN, int IN_SIZE) (int rowCount, int colCount)
|
||||
{
|
||||
int rowCount;
|
||||
int colCount;
|
||||
if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) {
|
||||
$2 = rowCount * colCount;
|
||||
}
|
||||
|
|
@ -39,10 +37,8 @@
|
|||
|
||||
// in (int IN_SIZE, double *IN)
|
||||
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (int IN_SIZE, double *IN)
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (int IN_SIZE, double *IN) (int rowCount, int colCount)
|
||||
{
|
||||
int rowCount;
|
||||
int colCount;
|
||||
if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) {
|
||||
$1 = rowCount * colCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,8 @@
|
|||
|
||||
// in (int *IN, int IN_SIZE)
|
||||
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int *IN, int IN_SIZE)
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int *IN, int IN_SIZE) (int rowCount, int colCount)
|
||||
{
|
||||
int rowCount;
|
||||
int colCount;
|
||||
if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) {
|
||||
$2 = rowCount * colCount;
|
||||
}
|
||||
|
|
@ -42,10 +40,8 @@
|
|||
|
||||
// in (int IN_SIZE, int *IN)
|
||||
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int IN_SIZE, int *IN)
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int IN_SIZE, int *IN) (int rowCount, int colCount)
|
||||
{
|
||||
int rowCount;
|
||||
int colCount;
|
||||
if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) {
|
||||
$1 = rowCount * colCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ SWIG_Scilab_Error(int code, const char *msg)
|
|||
|
||||
#define SWIG_fail return SWIG_ERROR;
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIGRUNTIME void
|
||||
SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) {
|
||||
if (type) {
|
||||
if (obj)
|
||||
|
|
@ -259,7 +259,7 @@ SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descript
|
|||
}
|
||||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIGRUNTIME void
|
||||
SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) {
|
||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,8 @@
|
|||
/* Typecheck typemaps */
|
||||
/* ---------------------------------------------------------------------------*/
|
||||
|
||||
%define SCILAB_TYPECHECK(TYPE_CHECK_FUNCTION)
|
||||
%define %scilab_typecheck_generic(PRECEDENCE, TYPE_CHECK_FUNCTION, TYPE)
|
||||
%typecheck(PRECEDENCE) TYPE {
|
||||
int *piAddrVar = NULL;
|
||||
SciErr sciErr = getVarAddressFromPosition(pvApiCtx, $input, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
|
|
@ -118,11 +119,19 @@
|
|||
return SWIG_ERROR;
|
||||
}
|
||||
$1 = TYPE_CHECK_FUNCTION(pvApiCtx, piAddrVar);
|
||||
}
|
||||
%enddef
|
||||
|
||||
/* Scilab equivalent for C integers can be sci_ints or sci_matrix */
|
||||
%define SCILAB_INTEGERTYPECHECK(INTTYPE)
|
||||
SCILAB_TYPECHECK(isIntegerType)
|
||||
%define %scilab_typecheck_integer(PRECEDENCE, INTTYPE, TYPE)
|
||||
%typecheck(PRECEDENCE) TYPE {
|
||||
int *piAddrVar = NULL;
|
||||
SciErr sciErr = getVarAddressFromPosition(pvApiCtx, $input, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
$1 = isIntegerType(pvApiCtx, piAddrVar);
|
||||
if ($1 == 1) {
|
||||
int iPrec = 0;
|
||||
sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec);
|
||||
|
|
@ -135,39 +144,43 @@
|
|||
else {
|
||||
$1 = isDoubleType(pvApiCtx, piAddrVar);
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
// Double (and Float) have priority over before Integer type.
|
||||
|
||||
// Primitive types
|
||||
%typecheck(SWIG_TYPECHECK_VOIDPTR, noblock=1) SWIGTYPE * { SCILAB_TYPECHECK(isPointerType) }
|
||||
%typecheck(SWIG_TYPECHECK_POINTER, noblock=1) SWIGTYPE * { SCILAB_TYPECHECK(isPointerType) }
|
||||
%typecheck(SWIG_TYPECHECK_BOOL, noblock=1) bool { SCILAB_TYPECHECK(isBooleanType) }
|
||||
%typemap(typecheck, precedence=16, noblock=1) double { SCILAB_TYPECHECK(isDoubleType) }
|
||||
%typemap(typecheck, precedence=17, noblock=1) float { SCILAB_TYPECHECK(isDoubleType) }
|
||||
%typecheck(SWIG_TYPECHECK_INT8, noblock=1) signed char { SCILAB_INTEGERTYPECHECK(SCI_INT8) }
|
||||
%typecheck(SWIG_TYPECHECK_UINT8, noblock=1) unsigned char { SCILAB_INTEGERTYPECHECK(SCI_UINT8) }
|
||||
%typecheck(SWIG_TYPECHECK_INT16, noblock=1) short { SCILAB_INTEGERTYPECHECK(SCI_INT16) }
|
||||
%typecheck(SWIG_TYPECHECK_UINT16, noblock=1) unsigned short { SCILAB_INTEGERTYPECHECK(SCI_UINT16) }
|
||||
%typecheck(SWIG_TYPECHECK_INT32, noblock=1) int, long { SCILAB_INTEGERTYPECHECK(SCI_INT32) }
|
||||
%typecheck(SWIG_TYPECHECK_UINT32, noblock=1) unsigned int, unsigned long { SCILAB_INTEGERTYPECHECK(SCI_UINT32) }
|
||||
%typecheck(SWIG_TYPECHECK_INT32, noblock=1) enum SWIGTYPE { SCILAB_INTEGERTYPECHECK(SCI_INT32) }
|
||||
%typecheck(SWIG_TYPECHECK_CHAR, noblock=1) char { SCILAB_TYPECHECK(isStringType) }
|
||||
%scilab_typecheck_generic(SWIG_TYPECHECK_VOIDPTR, isPointerType, SWIGTYPE *)
|
||||
%scilab_typecheck_generic(SWIG_TYPECHECK_POINTER, isPointerType, SWIGTYPE *)
|
||||
%scilab_typecheck_generic(SWIG_TYPECHECK_BOOL, isBooleanType, bool)
|
||||
%scilab_typecheck_generic(16, isDoubleType, double)
|
||||
%scilab_typecheck_generic(17, isDoubleType, float)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT8, SCI_INT8, signed char)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_UINT8, SCI_UINT8, unsigned char)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT16, SCI_INT16, short)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_UINT16, SCI_UINT16, unsigned short)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT32, SCI_INT32, int)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT32, SCI_INT32, long)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_UINT32, SCI_UINT32, unsigned int)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_UINT32, SCI_UINT32, unsigned long)
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT32, SCI_INT32, enum SWIGTYPE)
|
||||
%scilab_typecheck_generic(SWIG_TYPECHECK_CHAR, isStringType, char)
|
||||
|
||||
// Arrays
|
||||
%typecheck(SWIG_TYPECHECK_BOOL_ARRAY, noblock=1) bool { SCILAB_TYPECHECK(isBooleanType) }
|
||||
%typemap(typecheck, precedence=1016, noblock=1) double [ANY] { SCILAB_TYPECHECK(isDoubleType) }
|
||||
%typemap(typecheck, precedence=1017, noblock=1) float [ANY] { SCILAB_TYPECHECK(isDoubleType) }
|
||||
%typecheck(SWIG_TYPECHECK_INT8_ARRAY, noblock=1) signed char [ANY] { SCILAB_INTEGERTYPECHECK(SCI_INT8) }
|
||||
%typemap(typecheck, precedence=1026, noblock=1) unsigned char [ANY] { SCILAB_INTEGERTYPECHECK(SCI_UINT8) }
|
||||
%typecheck(SWIG_TYPECHECK_INT16_ARRAY, noblock=1) short [ANY] { SCILAB_INTEGERTYPECHECK(SCI_INT16) }
|
||||
%typemap(typecheck, precedence=1036, noblock=1) unsigned short [ANY] { SCILAB_INTEGERTYPECHECK(SCI_UINT16) }
|
||||
%typecheck(SWIG_TYPECHECK_INT32_ARRAY, noblock=1) int [ANY], long [ANY] { SCILAB_INTEGERTYPECHECK(SCI_INT32) }
|
||||
%typemap(typecheck, precedence=1046, noblock=1) unsigned int [ANY] { SCILAB_INTEGERTYPECHECK(SCI_UINT32) }
|
||||
%typemap(typecheck, precedence=1046, noblock=1) unsigned long [ANY] { SCILAB_INTEGERTYPECHECK(SCI_UINT32) }
|
||||
%typecheck(SWIG_TYPECHECK_CHAR_ARRAY, noblock=1) char [ANY] { SCILAB_TYPECHECK(isStringType) }
|
||||
%typecheck(SWIG_TYPECHECK_STRING_ARRAY, noblock=1) char *[ANY], char ** { SCILAB_TYPECHECK(isStringType) }
|
||||
%scilab_typecheck_generic(SWIG_TYPECHECK_BOOL_ARRAY, isBooleanType, bool)
|
||||
%scilab_typecheck_generic(1016, isDoubleType, double [ANY])
|
||||
%scilab_typecheck_generic(1017, isDoubleType, float [ANY])
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT8_ARRAY, SCI_INT8, signed char [ANY])
|
||||
%scilab_typecheck_integer(1026, SCI_UINT8, unsigned char [ANY])
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT16_ARRAY, SCI_INT16, short [ANY])
|
||||
%scilab_typecheck_integer(1036, SCI_UINT16, unsigned short [ANY])
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT32_ARRAY, SCI_INT32, int [ANY])
|
||||
%scilab_typecheck_integer(SWIG_TYPECHECK_INT32_ARRAY, SCI_INT32, long [ANY])
|
||||
%scilab_typecheck_integer(1046, SCI_UINT32, unsigned int [ANY])
|
||||
%scilab_typecheck_integer(1046, SCI_UINT32, unsigned long [ANY])
|
||||
%scilab_typecheck_generic(SWIG_TYPECHECK_CHAR_ARRAY, isStringType, char [ANY])
|
||||
%scilab_typecheck_generic(SWIG_TYPECHECK_STRING_ARRAY, isStringType, char *[ANY])
|
||||
%scilab_typecheck_generic(SWIG_TYPECHECK_STRING_ARRAY, isStringType, char **)
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------*/
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
// INPUT typemaps
|
||||
%define %scilab_input_typemap(Type)
|
||||
%typemap(in, noblock=1, fragment=SWIG_AsVal_frag(Type)) Type *INPUT(Type temp), Type &INPUT(Type temp) {
|
||||
int ecode$argnum = SWIG_AsVal_dec(Type)($input, &temp);
|
||||
if (!SWIG_IsOK(ecode$argnum)) {
|
||||
%argument_fail(ecode$argnum, "$type", $symname, $argnum);
|
||||
%typemap(in, noblock=1, fragment=SWIG_AsVal_frag(Type)) Type *INPUT(Type temp)(int ecode), Type &INPUT(Type temp)(int ecode) {
|
||||
ecode = SWIG_AsVal_dec(Type)($input, &temp);
|
||||
if (!SWIG_IsOK(ecode)) {
|
||||
%argument_fail(ecode, "$type", $symname, $argnum);
|
||||
}
|
||||
$1 = &temp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@
|
|||
|
||||
/* varout */
|
||||
|
||||
%typemap(varout,noblock=1,fragment=#SWIG_CharBufLen)
|
||||
%typemap(varout,fragment=#SWIG_CharBufLen)
|
||||
Char [ANY], const Char [ANY] {
|
||||
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
|
||||
size_t size = SWIG_CharBufLen($1, $1_dim0);
|
||||
|
|
|
|||
|
|
@ -1486,10 +1486,10 @@ private:
|
|||
// The single function parameter is a pointer to the real argument
|
||||
// values. Define the structure that it points to.
|
||||
|
||||
Printv(f->code, "\tstruct swigargs {\n", NULL);
|
||||
String *swigargs = NewString("\tstruct swigargs {\n");
|
||||
|
||||
if (parm_count > required_count) {
|
||||
Printv(f->code, "\t\tintgo _swig_optargc;\n", NULL);
|
||||
Printv(swigargs, "\t\tintgo _swig_optargc;\n", NULL);
|
||||
}
|
||||
|
||||
Parm *p = parms;
|
||||
|
|
@ -1499,7 +1499,7 @@ private:
|
|||
String *ln = Getattr(p, "lname");
|
||||
SwigType *pt = Getattr(p, "type");
|
||||
String *ct = gcCTypeForGoValue(p, pt, ln);
|
||||
Printv(f->code, "\t\t\t", ct, ";\n", NULL);
|
||||
Printv(swigargs, "\t\t\t", ct, ";\n", NULL);
|
||||
Delete(ct);
|
||||
|
||||
String *gn = NewStringf("_swig_go_%d", i);
|
||||
|
|
@ -1511,11 +1511,11 @@ private:
|
|||
p = nextParm(p);
|
||||
}
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(f->code, "\t\tlong : 0;\n", NULL);
|
||||
Printv(swigargs, "\t\tlong : 0;\n", NULL);
|
||||
String *ln = NewString(Swig_cresult_name());
|
||||
String *ct = gcCTypeForGoValue(n, result, ln);
|
||||
Delete(ln);
|
||||
Printv(f->code, "\t\t", ct, ";\n", NULL);
|
||||
Printv(swigargs, "\t\t", ct, ";\n", NULL);
|
||||
Delete(ct);
|
||||
|
||||
ln = NewString("_swig_go_result");
|
||||
|
|
@ -1524,9 +1524,7 @@ private:
|
|||
Delete(ct);
|
||||
Delete(ln);
|
||||
}
|
||||
Printv(f->code, "\t} *swig_a = (struct swigargs *) swig_v;\n", NULL);
|
||||
|
||||
Printv(f->code, "\n", NULL);
|
||||
Printv(swigargs, "\t} *swig_a = (struct swigargs *) swig_v;\n", NULL);
|
||||
|
||||
// Copy the input arguments out of the structure into the Go local
|
||||
// variables.
|
||||
|
|
@ -1574,12 +1572,15 @@ private:
|
|||
|
||||
cleanupFunction(n, f, parms);
|
||||
|
||||
Printv(f->locals, swigargs, NULL);
|
||||
|
||||
Printv(f->code, "}\n", NULL);
|
||||
|
||||
Wrapper_print(f, f_c_wrappers);
|
||||
|
||||
Swig_restore(n);
|
||||
|
||||
Delete(swigargs);
|
||||
DelWrapper(f);
|
||||
Delete(base_parm);
|
||||
|
||||
|
|
|
|||
|
|
@ -1792,6 +1792,7 @@ int JSCEmitter::emitNamespaces() {
|
|||
namespace_definition.replace("$jsglobalvariables", variables)
|
||||
.replace("$jsglobalfunctions", functions)
|
||||
.replace("$jsnspace", name_mangled)
|
||||
.replace("$jsmangledname", name_mangled)
|
||||
.pretty_print(f_wrap_cpp);
|
||||
|
||||
Template t_createNamespace(getTemplate("jsc_nspace_definition"));
|
||||
|
|
|
|||
52
testflags.py
Executable file
52
testflags.py
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env python
|
||||
c_common = "-fdiagnostics-show-option -std=gnu89 -Wno-long-long -Wreturn-type -Wdeclaration-after-statement"
|
||||
cflags = {
|
||||
"csharp":"-Werror " + c_common,
|
||||
"d":"-Werror " + c_common,
|
||||
"go":"-Werror " + c_common,
|
||||
"guile":"-Werror " + c_common,
|
||||
"java":"-Werror " + c_common,
|
||||
"javascript":"-Werror " + c_common,
|
||||
"lua":"-Werror " + c_common,
|
||||
"octave":"-Werror " + c_common,
|
||||
"perl5":"-Werror " + c_common,
|
||||
"php":"-Werror " + c_common,
|
||||
"python":"-Werror " + c_common,
|
||||
"ruby":"-Werror " + c_common,
|
||||
"scilab":"-Werror " + c_common,
|
||||
"tcl":"-Werror " + c_common,
|
||||
}
|
||||
|
||||
cxx_common = "-fdiagnostics-show-option -std=c++98 -Wno-long-long -Wreturn-type"
|
||||
cxxflags = {
|
||||
"csharp":"-Werror " + cxx_common,
|
||||
"d":"-Werror " + cxx_common,
|
||||
"go":"-Werror " + cxx_common,
|
||||
"guile":"-Werror " + cxx_common,
|
||||
"java":"-Werror " + cxx_common,
|
||||
"javascript":"-Werror " + cxx_common + " -Wno-error=unused-function", # Until overload_rename is fixed for node
|
||||
"lua":"-Werror " + cxx_common,
|
||||
"octave":"-Werror " + cxx_common,
|
||||
"perl5":"-Werror " + cxx_common,
|
||||
"php":"-Werror " + cxx_common,
|
||||
"python":"-Werror " + cxx_common,
|
||||
"ruby":"-Werror " + cxx_common,
|
||||
"scilab": cxx_common,
|
||||
"tcl":"-Werror " + cxx_common,
|
||||
}
|
||||
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser(description="Display CFLAGS or CXXFLAGS to use for testing the SWIG examples and test-suite.")
|
||||
parser.add_argument('-l', '--language', required=True, help='set language to show flags for')
|
||||
flags = parser.add_mutually_exclusive_group(required=True)
|
||||
flags.add_argument('-c', '--cflags', action='store_true', default=False, help='show CFLAGS')
|
||||
flags.add_argument('-x', '--cxxflags', action='store_true', default=False, help='show CXXFLAGS')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.cflags:
|
||||
print("{}".format(cflags[args.language]))
|
||||
elif args.cxxflags:
|
||||
print("{}".format(cxxflags[args.language]))
|
||||
else:
|
||||
parser.print_help()
|
||||
exit(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue