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 212982 - code in header file turns white/grey and inactivates
Summary: code in header file turns white/grey and inactivates
Status: RESOLVED WORKSFORME
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.1.2
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-25 01:37 UTC by jadolfbr
Modified: 2012-05-28 17:26 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot of what the code looks like in the IDE after the greyout (648.91 KB, image/png)
2012-05-25 01:37 UTC, jadolfbr
Details
before corruption (2.04 KB, text/plain)
2012-05-26 14:50 UTC, jadolfbr
Details
after corruption (2.04 KB, text/plain)
2012-05-26 14:51 UTC, jadolfbr
Details
preprocessor states after opening cdrstructure.hh (326.49 KB, text/plain)
2012-05-28 15:48 UTC, jadolfbr
Details
head of antibodystructure.hh (897 bytes, text/plain)
2012-05-28 15:49 UTC, jadolfbr
Details
head of antibodystructure.cc (791 bytes, text/plain)
2012-05-28 15:49 UTC, jadolfbr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jadolfbr 2012-05-25 01:37:42 UTC
Created attachment 119850 [details]
Screenshot of what the code looks like in the IDE after the greyout

Code in header file spontaneously turns grey/white after clicking on it to edit.  The code can be edited, but not parsed.  Code assistance fails to recognize anything in the file. 

Restarting app did not help.  Reloading the source files into the project did not help.  However, when header is first opened to edit, the code looks fine.  Then, netbeans whites out everything.  Loading the file in Xcode showed no problems.
Comment 1 jadolfbr 2012-05-25 01:39:52 UTC
Other files being worked on in the project, header and source, are still ok.
Comment 2 Vladimir Voskresensky 2012-05-25 09:11:00 UTC
Could you try, please, NB 7.2 Beta? 
I've fixed some similar problems in trunk.

Thanks!
Comment 3 jadolfbr 2012-05-25 12:40:09 UTC
Tried 7.2, and the same issue persists.  It seems to be fine until netbeans begins to parse the project....
Comment 4 Vladimir Voskresensky 2012-05-25 17:59:12 UTC
Thanks. Can you, please, do in 7.2 the following:
- in Help->About have a look where your cache dir is located
- close IDE and remove ${cache}/cnd/model
- reopen IDE, wait parse finished and open "problematic" file, it should be OK.
- press Ctrl+Alt+Shift+M and choose to dump "Included Preprocessor States"
-- keep the output file (it's name is written on top of log)
- then do your activity which corrupts file... as soon as it is
- press Ctrl+Alt+Shift+M and choose to dump "Included Preprocessor States" again
-- keep the output file again

Attach here both files for analysis.

Thanks!
Vladimir.
Comment 5 jadolfbr 2012-05-26 14:50:57 UTC
Created attachment 119906 [details]
before corruption
Comment 6 jadolfbr 2012-05-26 14:51:59 UTC
Created attachment 119907 [details]
after corruption
Comment 7 jadolfbr 2012-05-26 14:54:05 UTC
Thanks for the help!  The corruption happens after opening the file, so attached is the output before and after opening the file; removing the cache before reopen of the IDE.
Comment 8 Vladimir Voskresensky 2012-05-28 14:39:10 UTC
Thanks. Could you, please, send me head lines of your files:
AntibodyStructure.cc and AntibodyStructure.h
Comment 9 Vladimir Voskresensky 2012-05-28 14:42:53 UTC
Also I need other dump: Ctrl+Alt+Shift+M and choose "Preprocessor States" when you have active file CDRStructure.hh

Thanks!
Comment 10 jadolfbr 2012-05-28 15:48:52 UTC
Created attachment 119947 [details]
preprocessor states after opening cdrstructure.hh
Comment 11 jadolfbr 2012-05-28 15:49:21 UTC
Created attachment 119948 [details]
head of antibodystructure.hh
Comment 12 jadolfbr 2012-05-28 15:49:45 UTC
Created attachment 119949 [details]
head of antibodystructure.cc
Comment 13 Vladimir Voskresensky 2012-05-28 17:03:20 UTC
thanks for info. Looks like IDE behaves correctly...
The problem is guard tokens with dots in your code like 
--------------
#ifndef path_to_file.hh
#define	path_to_file.hh

#endif
--------------
by default preprocessor sees here define and check of macro "path_to_file", not "path_to_file.hh", because by C/C++ standard macro is identifier.
In your exact case you have files cdrstructure.hh and cdrstructure.fwd.hh
which defines/checks "same" guard macros "INCLUDED_protocols_antibody_design_CDRStructure":
#define INCLUDED_protocols_antibody_design_CDRStructure.fwd.hh
&&
#ifndef INCLUDED_protocols_antibody_design_CDRStructure.hh

That's why all in code is grey.

In fact, depending on compiler you should see error or warning:
Error: There is extra text on this line.

I.e. the following has empty body from preprocessor point of view:
---------------
#ifndef NEWFILE.FWD.HH
#define	NEWFILE.FWD.HH

#ifndef NEWFILE.HH
#define	NEWFILE.HH

int i;

#endif
#endif
---------------

What is your compiler which supports dots in macro names? dot is not a valid identifier-part.

I'd advise you to change all dots to hyphens:
INCLUDED_protocols_antibody_design_CDRStructure_fwd_hh
Comment 14 Vladimir Voskresensky 2012-05-28 17:07:09 UTC
what IDE could do in such cases is to show warnings automatically to explain the situation and allow user to change the coding style.
Comment 15 Vladimir Voskresensky 2012-05-28 17:11:07 UTC
btw, I guess, if you ctrl+click on macro in line 16 of file CDRStructure.hh you should jump into the #define in file CDRStructure.fwd.hh
Comment 16 jadolfbr 2012-05-28 17:26:07 UTC
Thanks for all your help.  I had changed the default new file for header files so that it did the includes, hadn't compiled everything yet.  A warning in the IDE would be great if possible.  I had no idea what was going on when the file went grey.  Changing the dots to dashes returned the file to normal.  Thanks again.