Skip to content

Commit

Permalink
Merge branch 'stricter-warnings'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wsfulton committed Feb 11, 2015
2 parents 57e3bf7 + e3a8ee1 commit 1ef899a
Show file tree
Hide file tree
Showing 25 changed files with 163 additions and 119 deletions.
45 changes: 8 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: cpp
compiler:
- clang
# - clang
- gcc
env:
- SWIGLANG=
Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion Examples/test-suite/csharp_exceptions.i
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ enum UnmanagedExceptions {
UnmanagedSystemException,
UnmanagedArgumentException,
UnmanagedArgumentNullException,
UnmanagedArgumentOutOfRangeException,
UnmanagedArgumentOutOfRangeException
};

void check_exception(UnmanagedExceptions e) {
Expand Down
6 changes: 3 additions & 3 deletions Examples/test-suite/csharp_typemaps.i
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Examples/test-suite/enum_forward.i
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions Examples/test-suite/enum_macro.i
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Examples/test-suite/enum_missing.i
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion Examples/test-suite/li_std_auto_ptr.i
Original file line number Diff line number Diff line change
@@ -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
%}
Expand Down
6 changes: 6 additions & 0 deletions Examples/test-suite/nested_class.i
Original file line number Diff line number Diff line change
Expand Up @@ -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;
///////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion Examples/test-suite/nested_extend_c.i
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ typedef struct {
} bar;
} FOO;

struct {
static struct {
int i;
} THING;
%}
Expand Down
2 changes: 1 addition & 1 deletion Examples/test-suite/template_default_class_parms.i
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace Teuchos {
namespace KokkosClassic {
namespace DefaultNode {
struct DefaultNodeType {};
};
}
}

namespace Tpetra {
Expand Down
2 changes: 1 addition & 1 deletion Lib/d/dhead.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
3 changes: 2 additions & 1 deletion Lib/javascript/jsc/javascriptcode.swg
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ static JSStaticFunction $jsnspace_functions[] = {
};

static JSClassDefinition $jsnspace_classDefinition;
static JSObjectRef $jsmangledname_object;
%}

/* -----------------------------------------------------------------------------
Expand All @@ -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);
%}

/* -----------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions Lib/javascript/jsc/javascriptprimtypes.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion Lib/javascript/jsc/javascriptstrings.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
8 changes: 2 additions & 6 deletions Lib/scilab/scimatrixbool.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
10 changes: 3 additions & 7 deletions Lib/scilab/scimatrixchar.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
8 changes: 2 additions & 6 deletions Lib/scilab/scimatrixdouble.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
8 changes: 2 additions & 6 deletions Lib/scilab/scimatrixint.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions Lib/scilab/scirun.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down
Loading

0 comments on commit 1ef899a

Please sign in to comment.