hzzc1987 / jnaerator

Automatically exported from code.google.com/p/jnaerator
0 stars 0 forks source link

Incorrect enum name when preceeded by uint32 typedef and comment #82

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
Create a file "example.h" containing:
#include <stdint.h>

typedef uint32_t myIntType;

// If this comment is removed it works!
typedef enum {
   A = 1,
   B = 2
} myEnum;

2.
Run jnaerator using this config file:
-v
-nocpp
-nocomp
-noJar
-noLibBundle
-limitComments
-noMangling
-runtime JNAerator
example.h

What is the expected output? What do you see instead?

In generated .java file expect enum type to be named myEnum, instead it is 
named myIntType:

public static interface myIntType {
                public static final int A = 1;
                public static final int B = 2;
        };

If the comment in the .h file is removed all is OK!

What version of the product are you using? On what operating system?
Occurs with both 0.9.5 (standalone jar) and 0.9.6 (maven plugin)

Is the problem still present in the latest SVN version ? (you can easily
build from sources with these instructions :
http://code.google.com/p/javacl/wiki/Build)

Not tried yet

Please provide any additional information below.
With the -v switch the message 
"Inferred enum name : myIntType" is displayed in the error case, no such 
message is displayed in the OK case (comment removed).
The problem does not occur either if the uint32_t typedef is replaced with 
uint16_t.

Browsing the source shows that the problem appears to be in the objective C 
specific visitor - not sure why this is being used on plain C code...

Original issue reported on code.google.com by mfuz...@gmail.com on 24 Feb 2011 at 9:55

GoogleCodeExporter commented 8 years ago
Hello,

Thanks a lot for your report.
This is clearly a bug of a mechanism meant to be used for the following pattern 
((ab)used throughout Cocoa) :
{{{

enum {
    A, B, C
};
typedef NSUInteger NSMyEnum;

}}}

Will investigate ASAP :-)
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 25 Feb 2011 at 12:14

GoogleCodeExporter commented 8 years ago
Hello,

This is now fixed 
(http://code.google.com/p/nativelibs4java/source/detail?r=1798), both in the 
Maven snapshot (0.9.7-SNAPSHOT) and in the WebStart version.

Thanks again for your report.
Cheers
--
zOlive 

Original comment by olivier.chafik@gmail.com on 18 Mar 2011 at 6:43