#324 swig clears Perl environment too agressively

closed-fixed
nobody
None
5
2012-08-05
2012-07-19
Adam Tkac
No

swig clears Perl environment too agressively, especially it undefines "bool" definition. Due to this, following code snipplet is not compilable against Perl 5.16 and later:

#include "perl.h"
#include <stdbool.h>

bool some_function() {}

Compilation fails because swig-2.0.7/Lib/perl5/noembed.h is included after perl.h (which also pulls in stdbool.h header) but before stdbool.h. The noembed.h undefines bool but since stdbool.h was already included by perl.h, it is not included again. Due to this bool remains undefined.

Check https://bugzilla.redhat.com/show_bug.cgi?id=841245 for more details.

Attached patch solves this issue.

Discussion

  • Adam Tkac

    Adam Tkac - 2012-07-19

    Proposed patch

     
  • William Fulton

    William Fulton - 2012-08-05
    • status: open --> closed-fixed
     
  • William Fulton

    William Fulton - 2012-08-05

    Thanks for patch. I've modified to only undefine if the macro is defined by stdbool.h...

    #ifdef bool
    /* Leave if macro is from C99 stdbool.h */
    #ifndef __bool_true_false_are_defined
    #undef bool
    #endif
    #endif

    Will be in swig-2.0.8.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks