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)
|
||||
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
|
||||
|
||||
guile_cpp: $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
|
||||
$(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO): $(SRCDIR_SRCS)
|
||||
guile_cpp: $(SRCDIR_SRCS)
|
||||
$(SWIG) -c++ -guile -Linkage passive $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
$(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:
|
||||
$(SWIG) -guile -external-runtime $(TARGET)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,17 @@
|
|||
#include <algorithm>
|
||||
#include <functional>
|
||||
#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 {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,13 @@
|
|||
#pragma SWIG nowarn=890 /* lots of Go name conflicts */
|
||||
#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 */
|
||||
%header
|
||||
%{
|
||||
|
|
@ -225,8 +232,8 @@ This testcase tests operators for defines
|
|||
#define A7 13 & 14
|
||||
#define A8 15 | 16
|
||||
#define A9 17 ^ 18
|
||||
#define A10 19 && 20
|
||||
#define A11 21 || 21
|
||||
#define A10 1 && 0
|
||||
#define A11 1 || 0
|
||||
#define A12 ~22
|
||||
#define A13 !23
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
%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++
|
||||
|
||||
// Simple constants
|
||||
|
|
@ -102,3 +109,4 @@ enum MyEnum {
|
|||
enum MyEnum {
|
||||
kValue = BIT(2)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -327,10 +327,19 @@ macro(size_t, pfx, sizet)
|
|||
if (a.str() != b.str()) {
|
||||
std::cout << "failing in pfx""_""name : "
|
||||
<< a.str() << " : " << b.str() << std::endl;
|
||||
// return 0;
|
||||
}
|
||||
}
|
||||
%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 */
|
||||
%define call_check(type, pfx, name)
|
||||
|
|
@ -342,7 +351,6 @@ macro(size_t, pfx, sizet)
|
|||
if (a.str() != b.str()) {
|
||||
std::cout << "failing in pfx""_""name : "
|
||||
<< a.str() << " : " << b.str() << std::endl;
|
||||
// return 0;
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
|
@ -461,7 +469,7 @@ macro(size_t, pfx, sizet)
|
|||
{
|
||||
%test_prim_types_stc(var_check, stc)
|
||||
%test_prim_types(var_check, var)
|
||||
var_check(namet, var, namet);
|
||||
var_array_check(namet, var, namet);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -545,7 +553,7 @@ macro(size_t, pfx, sizet)
|
|||
{
|
||||
%test_prim_types(var_check, cct)
|
||||
%test_prim_types(var_check, var)
|
||||
var_check(namet, var, namet);
|
||||
var_array_check(namet, var, namet);
|
||||
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 {
|
||||
// non-templated class using itself in method and operator
|
||||
class ABC {
|
||||
public:
|
||||
void method(ABC a) 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; }
|
||||
#endif
|
||||
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 {
|
||||
// non-templated class using itself in method and operator
|
||||
class ABC {
|
||||
|
|
@ -90,7 +99,10 @@ class ABC {
|
|||
|
||||
void method(ABC a) 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; }
|
||||
#endif
|
||||
operator Klass() const { Klass k; return k; }
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue