"Include what you use" for tests

Many of these tests implicitly required the target language library files to include the headers upstream.
This commit is contained in:
Seth R Johnson 2017-11-07 18:35:00 -05:00
commit feeb2516ae
17 changed files with 61 additions and 31 deletions

View file

@ -18,6 +18,7 @@
%{ %{
#define TESTCASE_THROW1(T1) #define TESTCASE_THROW1(T1)
#define TESTCASE_THROW2(T1, T2) #define TESTCASE_THROW2(T1, T2)
#include <string.h>
%} %}
%include <std_string.i> %include <std_string.i>

View file

@ -20,7 +20,6 @@
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <process.h> #include <process.h>
#include <stdio.h>
#else #else
#include <pthread.h> #include <pthread.h>
#include <errno.h> #include <errno.h>
@ -30,6 +29,7 @@
#endif #endif
#include <assert.h> #include <assert.h>
#include <stdio.h>
#include "swig_examples_lock.h" #include "swig_examples_lock.h"
class Foo; class Foo;

View file

@ -5,4 +5,8 @@
%cdata(int); %cdata(int);
%cdata(double); %cdata(double);
%{
#include <stdlib.h>
%}
void *malloc(size_t size); void *malloc(size_t size);

View file

@ -5,4 +5,8 @@
%cdata(int); %cdata(int);
%cdata(double); %cdata(double);
%{
#include <stdlib.h>
%}
void *malloc(size_t size); void *malloc(size_t size);

View file

@ -9,6 +9,8 @@
%} %}
%inline %{ %inline %{
#include <stdexcept>
#include <typeinfo>
struct E1 : public std::exception struct E1 : public std::exception
{ {
}; };

View file

@ -11,6 +11,7 @@ struct ExtendMe {
%{ %{
#include <map> #include <map>
#include <string.h>
std::map<ExtendMe*, char *> ExtendMeStringMap; std::map<ExtendMe*, char *> ExtendMeStringMap;
void ExtendMe_thing_set(ExtendMe *self, const char *val) { void ExtendMe_thing_set(ExtendMe *self, const char *val) {
char *old_val = ExtendMeStringMap[self]; char *old_val = ExtendMeStringMap[self];

View file

@ -1,4 +1,4 @@
#include <cstddef>
class C; class C;

View file

@ -2,6 +2,7 @@
%module namespace_typemap %module namespace_typemap
%{ %{
#include <string.h>
namespace test { namespace test {
/* A minimalistic string class */ /* A minimalistic string class */
class string_class { class string_class {

View file

@ -12,6 +12,10 @@
#endif #endif
%{
#include "stdlib.h"
%}
#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8) #if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8)
%extend hiA { %extend hiA {
hiA() { hiA() {

View file

@ -18,6 +18,7 @@
%{ %{
#include <iostream> #include <iostream>
#include <stdlib.h>
using namespace std; using namespace std;
%} %}

View file

@ -4,6 +4,8 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning(disable: 4996) // 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. #pragma warning(disable: 4996) // 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
#endif #endif
#include <string.h>
#include <stdlib.h>
%} %}
%rename(AsCharStarRef) operator char*&; %rename(AsCharStarRef) operator char*&;

View file

@ -3,6 +3,10 @@
%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED) Bar::operator->; // Overloaded method Bar::operator ->() ignored %warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED) Bar::operator->; // Overloaded method Bar::operator ->() ignored
%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED) Bar2::operator->; // Overloaded method Bar2::operator ->() ignored %warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED) Bar2::operator->; // Overloaded method Bar2::operator ->() ignored
%{
#include <stdlib.h>
%}
%inline %{ %inline %{
int CONST_ACCESS = 1; int CONST_ACCESS = 1;
int MUTABLE_ACCESS = 2; int MUTABLE_ACCESS = 2;

View file

@ -9,6 +9,8 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning(disable: 4996) // 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. #pragma warning(disable: 4996) // 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
#endif #endif
#include <stdlib.h>
#include <string.h>
%} %}
%ignore Name::operator=; %ignore Name::operator=;

View file

@ -3,6 +3,7 @@
%newobject copy_string; %newobject copy_string;
%inline %{ %inline %{
#include <stdlib.h>
#include <string.h> #include <string.h>
const char* copy_string(const char* str) { const char* copy_string(const char* str) {
size_t len = strlen(str); size_t len = strlen(str);

View file

@ -3,6 +3,7 @@
%{ %{
typedef char * TypedefString; typedef char * TypedefString;
#include <string.h>
%} %}

View file

@ -9,6 +9,7 @@
%inline %{ %inline %{
#include <string> #include <string>
#include <string.h>
struct Kerfuffle { struct Kerfuffle {
std::string StdString(std::string str) { std::string StdString(std::string str) {
return str; return str;

View file

@ -31,6 +31,7 @@
#define MS_NOOVERRIDE -1111 #define MS_NOOVERRIDE -1111
#include <stdlib.h>
%} %}