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 177610 - #error stops code assistance, syntax highlighting, etc...
Summary: #error stops code assistance, syntax highlighting, etc...
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 6.x
Hardware: PC All
: P4 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-25 09:47 UTC by _ gordonp
Modified: 2011-04-27 13:45 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 _ gordonp 2009-11-25 09:47:21 UTC
I have a .h file which is only intended to be included by C++ files. I've
added the following protection:

    #ifndev __cplusplus
    #error Cannot be included into C sources!
    #endif

The #error line is displayed in the editor as an error and there is no
syntax highlighing below.

Hmmm! It gets stranger!

I added an obvious syntax error after the #error line to see if it would
be recognized as a syntax error. Not only was it shown as an error, but
the original syntax error on #error disappeared (the whole line went grey)
and the rest of the file was correctly displayed with syntax highlighting.

Once I removed the added error, the file was correctly displayed! (This is
why I'm filing a P4 instead of a P2).
Comment 1 Vladimir Voskresensky 2009-11-26 01:52:31 UTC
#ifndev __cplusplus
      ^
#ifndef ?

is it just a misprint?
Comment 2 _ gordonp 2009-11-30 09:21:37 UTC
>> ifndev __cplusplus
...
> is it just a misprint?

Yes. The actual code has it right.
Comment 3 tomrud 2011-03-23 09:43:06 UTC
(In reply to comment #0)
Some examples on how #error directive can be used is shown here:
http://www.netrino.com/node/138

Personally I use it as a high priority TODO since the code doesn't compile until #error is removed.

It should not be an indication to NetBeans: "Stop here, there is nothing of interest below this point"

> I added an obvious syntax error after the #error line to see if it would
> be recognized as a syntax error. Not only was it shown as an error, but
> the original syntax error on #error disappeared (the whole line went grey)
> and the rest of the file was correctly displayed with syntax highlighting.

I can't repeat this behavior on my system
NetBeans IDE 6.9.1 (Build 201007282301)
on
SUSE Linux Enterprise Desktop 11 (i586)