Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues
Bug 934 - jacidl fails when having '#' character inside string in included idl files
Summary: jacidl fails when having '#' character inside string in included idl files
Status: NEW
Alias: None
Product: JacORB
Classification: Unclassified
Component: IDL compiler (show other bugs)
Version: 3.1
Hardware: All All
: P2 major
Assignee: Mailinglist to track bugs
URL:
: 933 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-17 15:24 CEST by Kuba Gasiorowski
Modified: 2012-10-17 21:46 CEST (History)
1 user (show)

See Also:


Attachments
IDL files to reproduce the bug (1.02 KB, application/x-zip-compressed)
2012-10-17 15:25 CEST, Kuba Gasiorowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kuba Gasiorowski 2012-10-17 15:24:16 CEST
Hello,
according to the IDL standard, the #... is interpreted as a preprocessor directive only if is the first character (excluding spaces) in the line:
'Lines beginning with # (also called "directives") communicate with this preprocessor. White space may appear before the #.'
jacidl fails when processing files which contains the string like:

const string<100> structs1_str = "@(#)base0 2012/10/17" ;

in nested IDL files (in single files error does not occur), trying wrongly interpret the string after '#' as preprocessor directive:

   [jacidl] processing idl file: c:\Apps\jacidl_bug\base0.idl
   [jacidl] processing idl file: c:\Apps\jacidl_bug\base1.idl
   [jacidl] processing idl file: c:\Apps\jacidl_bug\structs0.idl
   [jacidl] processing idl file: c:\Apps\jacidl_bug\structs1.idl
   [jacidl] 2012-10-17 15:18:27 org.jacorb.idl.util.IDLLogger error
   [jacidl] SEVERE: C:\Apps\jacidl_bug\base0.idl, line: 4(41): Unrecognized preprocessor directive )base0
   [jacidl]     const string<100> base0_str = "@(#)base0
   [jacidl] 2012-10-17 15:18:27 org.jacorb.idl.util.IDLLogger error
   [jacidl] SEVERE: c:\Apps\jacidl_bug\structs1.idl, line: 69(1): 1 error(s).
   [jacidl]

BUILD FAILED
c:\Apps\jacidl_bug\build.xml:18: org.jacorb.idl.ParseException: Parse error : Lexer errors
        at org.jacorb.idl.CUP$actions.CUP$do_action(parser.java:4345)
        at org.jacorb.idl.parser.do_action(parser.java:990)
        at org.jacorb.idl.runtime.lr_parser.parse(lr_parser.java:531)
        at org.jacorb.idl.JacIDL.execute(JacIDL.java:502)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at org.apache.tools.ant.Target.performTasks(Target.java:413)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:811)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 0 seconds
2012-10-17 15:18:27 org.jacorb.idl.util.IDLLogger error
SEVERE: C:\Apps\jacidl_bug\base0.idl, line: 4(41): Unrecognized preprocessor directive )base0

        const string<100> base0_str = "@(#)base0
2012-10-17 15:18:27 org.jacorb.idl.util.IDLLogger error
SEVERE: c:\Apps\jacidl_bug\structs1.idl, line: 69(1): 1 error(s).

I haven't found any workaround except of removing '#' from the strings.

Sample IDL files to reproduce the error attached.
Comment 1 Kuba Gasiorowski 2012-10-17 15:25:15 CEST
Created attachment 401 [details]
IDL files to reproduce the bug

IDL files to reproduce the bug
Comment 2 Nick Cross 2012-10-17 17:18:32 CEST
*** Bug 933 has been marked as a duplicate of this bug. ***
Comment 3 Nick Cross 2012-10-17 21:46:59 CEST
I suspect it might actually be processing of multiple file inclusions (specifically the same file multiple times) and the error is a side affect of that.