fix example max macro/template and external max macro conflicts
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7449 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
285ecebd14
commit
eef3f9169d
8 changed files with 49 additions and 0 deletions
|
|
@ -19,6 +19,12 @@ FIELD(b, NEXT_CONST);
|
|||
} MyStruct_t;
|
||||
%}
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
// bug #994301
|
||||
%inline %{
|
||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
%module member_template
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
||||
|
||||
%inline %{
|
||||
template<class T> T max(T x, T y, T z) { return (x > y) ? x : y; }
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@
|
|||
/* activate all the name warnings */
|
||||
%warnfilter(+315,+321,-403);
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
%inline
|
||||
{
|
||||
class string; // csharp keyword
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@
|
|||
%warnfilter(801) test3::vector<long>; /* Ruby, wrong class name */
|
||||
%warnfilter(801) vector<test4::Integer>; /* Ruby, wrong class name */
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
%{
|
||||
namespace test {
|
||||
template<typename T> T max(T a, T b) { return (a > b) ? a : b; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
%module overload_template
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
|
||||
int foo() {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@
|
|||
|
||||
/* Let's just grab the original header file here */
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
|
||||
template<class T> T max(const T a, const T b) { return a>b ? a : b; }
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@
|
|||
|
||||
|
||||
/* Let's just grab the original header file here */
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
/* Testing technique for wrapping macros */
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
/* Here, some macros to wrap */
|
||||
%inline %{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue