#1274 C++ style comments in extern C

closed-accepted
perl (97)
5
2012-12-09
2012-09-24
Ben Reser
No

Over at the Subversion project we've noticed a failure on one of our build bots that recently was upgraded to SWIG 2.0.7. We end up with the following error:
core.c: In function 'boot_SVN___Core':
core.c:42819:5: error: expected expression before '/' token
core.c:42819:37: error: too many decimal points in number

Looking at like 42819 we find:
// Casts only needed for Perl < 5.10.

which is in the SWIG_init function which is preceded with:
#ifdef __cplusplus
extern "C"
#endif

The error can easily be fixed by applying the attached patch to Lib/perl5/perlinit.swg which just changes the comment to a C style comment /* */

We're likely going to work around this by just removing the -ansi flag from our build options for the Perl bindings, but we shouldn't have to, SWIG really should be producing valid code.

Discussion

  • Roman Donchenko

    Roman Donchenko - 2012-09-25

    extern "C" doesn't really have anything to do with it - the bug is simply that this line doesn't conform to C90, even though the rest of the file does.

     
  • William Fulton

    William Fulton - 2012-12-09
    • assigned_to: nobody --> wsfulton
    • status: open --> closed-accepted
     
  • William Fulton

    William Fulton - 2012-12-09

    Thanks, applied for swig-2.0.9.

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks