Merge branch 'clang-warning-fixes'
* clang-warning-fixes: Correct Examples makefile for guile Suppress clang warning in testcase preproc_constants warning suppression when using clang Warning suppression in li_std_vector_extra testcase for clang preproc_constants warning suppression when using clang Modify preproc testcase to remove clang warning Rename test warning suppressions when using clang primitive_types testcase improvement
This commit is contained in:
commit
f8491f8ab0
7 changed files with 68 additions and 9 deletions
|
|
@ -485,11 +485,10 @@ guile: $(SRCDIR_SRCS)
|
||||||
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ISRCS) $(SRCDIR_SRCS)
|
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ISRCS) $(SRCDIR_SRCS)
|
||||||
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
|
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
|
||||||
|
|
||||||
guile_cpp: $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
|
guile_cpp: $(SRCDIR_SRCS)
|
||||||
$(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO): $(SRCDIR_SRCS)
|
|
||||||
$(SWIG) -c++ -guile -Linkage passive $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
$(SWIG) -c++ -guile -Linkage passive $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||||
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
|
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
|
||||||
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) $(CPP_DLLIBS) -o $@
|
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) $(CPP_DLLIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
|
||||||
|
|
||||||
guile_externalhdr:
|
guile_externalhdr:
|
||||||
$(SWIG) -guile -external-runtime $(TARGET)
|
$(SWIG) -guile -external-runtime $(TARGET)
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,17 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
// Suppress:
|
||||||
|
// warning: destination for this 'memset' call is a pointer to dynamic class
|
||||||
|
// 'Test::B'; vtable pointer will be overwritten [-Wdynamic-class-memaccess]
|
||||||
|
// memset(v_def,0,sizeof(Type));
|
||||||
|
// Better generated code is probably needed though
|
||||||
|
#pragma clang diagnostic ignored "-Wdynamic-class-memaccess"
|
||||||
|
#endif
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,13 @@
|
||||||
#pragma SWIG nowarn=890 /* lots of Go name conflicts */
|
#pragma SWIG nowarn=890 /* lots of Go name conflicts */
|
||||||
#pragma SWIG nowarn=206 /* Unexpected tokens after #endif directive. */
|
#pragma SWIG nowarn=206 /* Unexpected tokens after #endif directive. */
|
||||||
|
|
||||||
|
%{
|
||||||
|
#if defined(__clang__)
|
||||||
|
//Suppress: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
|
||||||
|
#pragma clang diagnostic ignored "-Wconstant-logical-operand"
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
/* check __cplusplus case */
|
/* check __cplusplus case */
|
||||||
%header
|
%header
|
||||||
%{
|
%{
|
||||||
|
|
@ -225,8 +232,8 @@ This testcase tests operators for defines
|
||||||
#define A7 13 & 14
|
#define A7 13 & 14
|
||||||
#define A8 15 | 16
|
#define A8 15 | 16
|
||||||
#define A9 17 ^ 18
|
#define A9 17 ^ 18
|
||||||
#define A10 19 && 20
|
#define A10 1 && 0
|
||||||
#define A11 21 || 21
|
#define A11 1 || 0
|
||||||
#define A12 ~22
|
#define A12 ~22
|
||||||
#define A13 !23
|
#define A13 !23
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
%module preproc_constants
|
%module preproc_constants
|
||||||
|
|
||||||
|
%{
|
||||||
|
#if defined(__clang__)
|
||||||
|
//Suppress: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
|
||||||
|
#pragma clang diagnostic ignored "-Wconstant-logical-operand"
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
// Note: C types are slightly different to C++ types as (a && b) is int in C and bool in C++
|
// Note: C types are slightly different to C++ types as (a && b) is int in C and bool in C++
|
||||||
|
|
||||||
// Simple constants
|
// Simple constants
|
||||||
|
|
@ -102,3 +109,4 @@ enum MyEnum {
|
||||||
enum MyEnum {
|
enum MyEnum {
|
||||||
kValue = BIT(2)
|
kValue = BIT(2)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -327,10 +327,19 @@ macro(size_t, pfx, sizet)
|
||||||
if (a.str() != b.str()) {
|
if (a.str() != b.str()) {
|
||||||
std::cout << "failing in pfx""_""name : "
|
std::cout << "failing in pfx""_""name : "
|
||||||
<< a.str() << " : " << b.str() << std::endl;
|
<< a.str() << " : " << b.str() << std::endl;
|
||||||
// return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%enddef
|
%enddef
|
||||||
|
/* check variables (arrays can't be compared so compare as strings) */
|
||||||
|
%define var_array_check(type, pfx, name)
|
||||||
|
std::ostringstream a; std::ostringstream b;
|
||||||
|
a << pfx##_##name;
|
||||||
|
b << def_##name;
|
||||||
|
if (a.str() != b.str()) {
|
||||||
|
std::cout << "failing in pfx""_""name : "
|
||||||
|
<< a.str() << " : " << b.str() << std::endl;
|
||||||
|
}
|
||||||
|
%enddef
|
||||||
|
|
||||||
/* check a function call */
|
/* check a function call */
|
||||||
%define call_check(type, pfx, name)
|
%define call_check(type, pfx, name)
|
||||||
|
|
@ -342,7 +351,6 @@ macro(size_t, pfx, sizet)
|
||||||
if (a.str() != b.str()) {
|
if (a.str() != b.str()) {
|
||||||
std::cout << "failing in pfx""_""name : "
|
std::cout << "failing in pfx""_""name : "
|
||||||
<< a.str() << " : " << b.str() << std::endl;
|
<< a.str() << " : " << b.str() << std::endl;
|
||||||
// return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%enddef
|
%enddef
|
||||||
|
|
@ -461,7 +469,7 @@ macro(size_t, pfx, sizet)
|
||||||
{
|
{
|
||||||
%test_prim_types_stc(var_check, stc)
|
%test_prim_types_stc(var_check, stc)
|
||||||
%test_prim_types(var_check, var)
|
%test_prim_types(var_check, var)
|
||||||
var_check(namet, var, namet);
|
var_array_check(namet, var, namet);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -545,7 +553,7 @@ macro(size_t, pfx, sizet)
|
||||||
{
|
{
|
||||||
%test_prim_types(var_check, cct)
|
%test_prim_types(var_check, cct)
|
||||||
%test_prim_types(var_check, var)
|
%test_prim_types(var_check, var)
|
||||||
var_check(namet, var, namet);
|
var_array_check(namet, var, namet);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,27 @@ namespace Space {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(SWIG)
|
||||||
|
%exception Space::ABC::operator ABC %{
|
||||||
|
#if defined(__clang__)
|
||||||
|
// Workaround for: warning: conversion function converting 'Space::ABC' to itself will never be used
|
||||||
|
result = *arg1;
|
||||||
|
#else
|
||||||
|
$action
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Space {
|
namespace Space {
|
||||||
// non-templated class using itself in method and operator
|
// non-templated class using itself in method and operator
|
||||||
class ABC {
|
class ABC {
|
||||||
public:
|
public:
|
||||||
void method(ABC a) const {}
|
void method(ABC a) const {}
|
||||||
void method(Klass k) const {}
|
void method(Klass k) const {}
|
||||||
|
#if !defined(__clang__)
|
||||||
|
// Workaround for: warning: conversion function converting 'Space::ABC' to itself will never be used
|
||||||
operator ABC() const { ABC a; return a; }
|
operator ABC() const { ABC a; return a; }
|
||||||
|
#endif
|
||||||
operator Klass() const { Klass k; return k; }
|
operator Klass() const { Klass k; return k; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,15 @@ namespace Space {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%exception Space::ABC::operator ABC %{
|
||||||
|
#if defined(__clang__)
|
||||||
|
// Workaround for: warning: conversion function converting 'Space::ABC' to itself will never be used
|
||||||
|
result = *arg1;
|
||||||
|
#else
|
||||||
|
$action
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
namespace Space {
|
namespace Space {
|
||||||
// non-templated class using itself in method and operator
|
// non-templated class using itself in method and operator
|
||||||
class ABC {
|
class ABC {
|
||||||
|
|
@ -90,7 +99,10 @@ class ABC {
|
||||||
|
|
||||||
void method(ABC a) const {}
|
void method(ABC a) const {}
|
||||||
void method(Klass k) const {}
|
void method(Klass k) const {}
|
||||||
|
#if !defined(__clang__)
|
||||||
|
// Workaround for: warning: conversion function converting 'Space::ABC' to itself will never be used
|
||||||
operator ABC() const { ABC a; return a; }
|
operator ABC() const { ABC a; return a; }
|
||||||
|
#endif
|
||||||
operator Klass() const { Klass k; return k; }
|
operator Klass() const { Klass k; return k; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue