This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254133 - C++11 enums with visibility makes netbeans think the syntax is incorrect
Summary: C++11 enums with visibility makes netbeans think the syntax is incorrect
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: petrk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-04 16:33 UTC by stormbyte
Modified: 2016-07-13 01:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description stormbyte 2015-08-04 16:33:37 UTC
Combining C++11 typed enums and visibility attributes, will make netbeans to think the whole syntax is incorrect.

You can test with this sample code:

#define PUBLIC	__attribute__ ((visibility ("default")))
#define PRIVATE	__attribute__ ((visibility ("hidden")))

enum LogLevel:unsigned short PUBLIC {
				LogLevel_Emergency	= 0,	// system is unusable
				LogLevel_Alert		= 1,	// action must be taken immediately
				LogLevel_Critical	= 2,	// critical conditions
				LogLevel_Error		= 3,	// error conditions
				LogLevel_Warning	= 4,	// warning conditions
				LogLevel_Notice		= 5,	// normal, but significant, condition
				LogLevel_Info		= 6,	// informational message
				LogLevel_Debug		= 7	// debug-level message
};

And see the items and the enum name marked in red. If you remove the macro PUBLIC, it is detected correctly though.
Comment 1 stormbyte 2015-08-04 16:37:43 UTC
Note that by saying that removing the PUBLIC macro makes the error go away, I am implying that I enabled c++11 parsing in my project.
Comment 2 stormbyte 2015-08-04 22:24:25 UTC
I have to say that it works however for code like:

enum PUBLIC LogLevel:unsigned short

However, both versions are valid C++11 code, so both should be accepted by code parser.
Comment 3 petrk 2016-07-12 12:21:35 UTC
Fixed in http://hg.netbeans.org/cnd-main/rev/834a6d1fddc5
Comment 4 Quality Engineering 2016-07-13 01:50:06 UTC
Integrated into 'main-silver', will be available in build *201607130002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/834a6d1fddc5
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #254133 - C++11 enums with visibility makes netbeans think the syntax is incorrect