From 52e59d530d6fcb42981deb20c45e2f88ab956651 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 12 Mar 2011 21:37:35 +0000 Subject: [PATCH] gcc-4.5 warning fix git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12529 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/default_arg_values.i | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Examples/test-suite/default_arg_values.i b/Examples/test-suite/default_arg_values.i index e52375073..47ca2d12f 100644 --- a/Examples/test-suite/default_arg_values.i +++ b/Examples/test-suite/default_arg_values.i @@ -1,10 +1,18 @@ %module default_arg_values -%inline %{ +%{ +struct Display { + // Some compilers warn about 'float v = NULL', so only SWIG sees this peculiarity + // Bad Python wrappers were being generated when NULL used for primitive type + float draw1(float v = 0) { return v; } + float draw2(float *v = 0) { return v ? *v : 0; } +}; +float* createPtr(float v) { static float val; val = v; return &val; } +%} + struct Display { // Bad Python wrappers were being generated when NULL used for primitive type float draw1(float v = NULL) { return v; } float draw2(float *v = NULL) { return v ? *v : 0; } }; float* createPtr(float v) { static float val; val = v; return &val; } -%}