summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth R Johnson <johnsonsr@ornl.gov>2018-03-23 15:04:00 -0400
committerSeth R Johnson <johnsonsr@ornl.gov>2019-01-06 09:08:12 -0500
commitc041ac6d1cda407baa338bd016c0a68f2f0c6834 (patch)
tree9597444b426c2e4e49345a5a0c0ad4b96c87cd07
parentfeeb2516aedfc19fdc1eefe233dec9bc5593fe2b (diff)
downloadswig-c041ac6d1cda407baa338bd016c0a68f2f0c6834.tar.gz
Move <string.h> fragment to swigfragments
-rw-r--r--Examples/test-suite/char_strings.i5
-rw-r--r--Examples/test-suite/threads_exception.i1
-rw-r--r--Examples/test-suite/varargs.i4
-rw-r--r--Lib/cdata.i2
-rw-r--r--Lib/swig.swg4
-rw-r--r--Lib/swigfragments.swg4
6 files changed, 14 insertions, 6 deletions
diff --git a/Examples/test-suite/char_strings.i b/Examples/test-suite/char_strings.i
index 9a87df4e3..aa3b125ce 100644
--- a/Examples/test-suite/char_strings.i
+++ b/Examples/test-suite/char_strings.i
@@ -11,6 +11,7 @@ below.
%{
#include <stdio.h>
+#include <string.h>
#define OTHERLAND_MSG "Little message from the safe world."
#define CPLUSPLUS_MSG "A message from the deep dark world of C++, where anything is possible."
@@ -150,11 +151,11 @@ const char global_const_char_array2[sizeof(CPLUSPLUS_MSG)+1] = CPLUSPLUS_MSG;
%inline {
struct Formatpos;
struct OBFormat;
-
+
static int GetNextFormat(Formatpos& itr, const char*& str,OBFormat*& pFormat) {
return 0;
}
-
+
}
diff --git a/Examples/test-suite/threads_exception.i b/Examples/test-suite/threads_exception.i
index 4708633db..776e84231 100644
--- a/Examples/test-suite/threads_exception.i
+++ b/Examples/test-suite/threads_exception.i
@@ -13,6 +13,7 @@
%}
%{
+#include <string.h>
struct A {};
%}
diff --git a/Examples/test-suite/varargs.i b/Examples/test-suite/varargs.i
index dd56cb073..b4143da7c 100644
--- a/Examples/test-suite/varargs.i
+++ b/Examples/test-suite/varargs.i
@@ -7,6 +7,10 @@
%varargs(int mode = 0) Foo::statictest(const char*fmt, ...);
%varargs(2, int mode = 0) test_plenty(const char*fmt, ...);
+%{
+#include <string.h>
+%}
+
%inline %{
char *test(const char *fmt, ...) {
return (char *) fmt;
diff --git a/Lib/cdata.i b/Lib/cdata.i
index e058fe28b..e82843b3a 100644
--- a/Lib/cdata.i
+++ b/Lib/cdata.i
@@ -4,6 +4,8 @@
* SWIG library file containing macros for manipulating raw C data as strings.
* ----------------------------------------------------------------------------- */
+%include <swigfragments.swg>
+
%{
typedef struct SWIGCDATA {
char *data;
diff --git a/Lib/swig.swg b/Lib/swig.swg
index c215e8d89..d719a139c 100644
--- a/Lib/swig.swg
+++ b/Lib/swig.swg
@@ -442,10 +442,6 @@ namespace std {
* Default char * and C array typemaps
* ----------------------------------------------------------------------------- */
-%fragment("<string.h>", "runtime") %{
-#include <string.h>
-%}
-
/* Set up the typemap for handling new return strings */
#ifdef __cplusplus
diff --git a/Lib/swigfragments.swg b/Lib/swigfragments.swg
index 63bb6c8f4..a2b467bce 100644
--- a/Lib/swigfragments.swg
+++ b/Lib/swigfragments.swg
@@ -29,6 +29,10 @@
#include <math.h>
%}
+%fragment("<string.h>", "header") %{
+#include <string.h>
+%}
+
%fragment("<stddef.h>", "header") %{
#include <stddef.h>
%}