This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1270557 - Swig fails to parse macros as types
Swig fails to parse macros as types
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: swig (Show other bugs)
22
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Jitka Plesnikova
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-11 01:38 EDT by Antoine Catton
Modified: 2016-07-19 15:19 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-19 15:19:47 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Antoine Catton 2015-10-11 01:38:24 EDT
Description of problem:

Can't "pip install M2Crypto" because swig fails to parse C macros in function definitions like this:

%inline %{
int func(MACRO(argument) *arg) {
  return 0;
}
%}

Version-Release number of selected component (if applicable):

$ swig -version 
SWIG Version 3.0.7
$ sudo dnf info swig
Installed Packages
Name        : swig
Arch        : x86_64
Epoch       : 0
Version     : 3.0.7
Release     : 3.fc22
Size        : 5.4 M
Repo        : @System
From repo   : updates

How reproducible:

Every single time.

Steps to Reproduce:
1. $ cat foo.h
#define FOO(name)  struct foo_##name

FOO(bar) {int foo; int bar;};

2. $ cat foo.i
%{
#include "foo.h"
%}
%include "foo.h"

%inline %{
int func(FOO(bar) *foobar)
{
    return 1;
}
%}
3. $ swig -python -I. -modern -includeall -module foo foo.i
foo.i:7: Error: Syntax error in input(1).
zsh: exit 1     swig -python -I. -modern -includeall -module foo foo.i

Actual results:

foo.i:7: Error: Syntax error in input(1).
zsh: exit 1     swig -python -I. -modern -includeall -module foo foo.i

Expected results:

Compiles the python module.

Additional info:

I cloned, compiled and tried with the commit b093d4 of <https://github.com/swig/swig> and it worked.
Comment 1 Jitka Plesnikova 2015-10-16 06:34:59 EDT
I am not able to reproduce the issue. 
I had fresh install Fedora 22 machine with swig and everything worked fine.

swig-3.0.7-3.fc22.x86_64

$ swig -v -python -I. -modern -includeall -module foo foo.i
Language subdirectory: python
Search paths:
   ./
   ./
   ./swig_lib/python/
   /usr/share/swig/3.0.7/python/
   ./swig_lib/
   /usr/share/swig/3.0.7/
Preprocessing...
Starting language-specific parse...
Processing unnamed structs...
Processing types...
C++ analysis...
Generating wrappers...

$ ls
foo.h  foo.i  foo.py  foo_wrap.c
Comment 2 Antoine Catton 2015-10-16 19:29:54 EDT
Jitka,

Thanks for your reply,

That is very interesting. I'm only able to reproduce this error in non-verbose mode. Try to run it without the "-v".

I did run it with "-v" and yes it worked like it did for you. That is a weird bug.
Comment 3 Jitka Plesnikova 2015-10-19 07:58:13 EDT
I tested it also without "-v" and it worked properly

$ ls
foo.h  foo.i
$ swig -python -I. -modern -includeall -module foo foo.i
$ ls
foo.h  foo.i  foo.py  foo_wrap.c
Comment 4 Fedora End Of Life 2016-07-19 15:19:47 EDT
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.