#40 Add #line directives to generated C/C++ wrappers

open
nobody
None
5
2008-03-28
2006-08-25
mrbazmondo
No

When a compile error occurs in generated C code which
was embedded in a source.i file the compiler directs
the user at the gernerated source_wrap.c code rather
than the source.i file. This can be resolved by
placing a #line directive into the generated
source_wrap.c code just before the emmbedded C code
in pasted in:
#line n "source.i"

bison does this. Why doesn't SWIG?

An example of bison doing this can be found at:
http://www.graphviz.org/pub/graphviz/CURRENT/doxygen/h
tml/graph_2y_8tab_8c-source.html

Discussion

  • William Fulton

    William Fulton - 2006-09-01

    Logged In: YES
    user_id=242951

    Is this suggestion for code that is embedded in between %{
    %} braces or something more? Maybe %inline too? However, I
    don't see this as being practical for code that comes from
    typemaps. If the feature were done for %{ or %inline, there
    is then an inconsistency as usually most of the code comes
    from typemaps. Also, how do you turn the #line preprocessor
    directive off - this is needed so that normal line number
    reporting is used after the end of the inserted code from
    the %{ %} block.

     
  • Olly Betts

    Olly Betts - 2008-03-28
    • summary: C #line directives --> Add #line directives to generated C/C++ wrappers
     
  • Olly Betts

    Olly Betts - 2008-03-28

    Logged In: YES
    user_id=14972
    Originator: NO

    I believe the only way to "turn off" a #line directive is to track the current filename and true line number and write a #line directive with those in to override the previous #line.

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks