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 215051 - Preprocessor does not work properly
Summary: Preprocessor does not work properly
Status: REOPENED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-02 06:43 UTC by shirojirou
Modified: 2012-09-26 01:53 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
AAA is defined, and also BBB is defined too. (2.14 KB, image/png)
2012-07-02 06:43 UTC, shirojirou
Details
tool chain , lib and app (22.66 KB, application/zip)
2012-07-31 07:47 UTC, shirojirou
Details
lib and cpp (18.34 KB, application/zip)
2012-09-20 05:53 UTC, shirojirou
Details
Update again (18.41 KB, application/zip)
2012-09-26 01:53 UTC, shirojirou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description shirojirou 2012-07-02 06:43:34 UTC
Created attachment 121639 [details]
AAA is defined, and also BBB is defined too.

It is hard to explain...

Please look at the attachment.
AAA is defined, and also BBB is defined too.

This is happened when two project are opened.
One is library, and the other is executable application.
If library project is set as "Cygwin" and the other is set as "VisualC",
Preprocessor elif does not work correctly.
Comment 1 shirojirou 2012-07-26 02:52:56 UTC
Ooops... 7.2 is released with this bug...
I can't upgrade to 7.2, until 7.1.2, there is no such bug...
Comment 2 Alexander Simon 2012-07-26 07:09:39 UTC
shirojirou,

Does bug exist if you select both projects and perform "Project->Code Assistance->Reparse Project"?
Does cleaning of ${Cache directory}/cnd help to resolve bug?
Where is problem fragment located (header in library)? 
Does executable application have dependency on library (Project Properties->linker->Libraries)?

Thanks,
Alexander
Comment 3 shirojirou 2012-07-31 07:47:48 UTC
Created attachment 122561 [details]
tool chain , lib and app

Thank you for your comment and sorry for answering lately.

>Does bug exist if you select both projects and perform "Project->Code
Assistance->Reparse Project"?

Yes.

>Does cleaning of ${Cache directory}/cnd help to resolve bug?

No.

>Where is problem fragment located (header in library)? 

Library header files are affected by the application condition.

>Does executable application have dependency on library (Project
Properties->linker->Libraries)?

Yes.

I tried to do this from scratch, I attached lib, app and toolchain.
Please import toolchain.zip to Netbeans7.2 and open the projects.
Comment 4 Alexander Simon 2012-07-31 09:12:11 UTC
(In reply to comment #3)
> Created attachment 122561 [details]
> tool chain , lib and app
Thank you for example.
But I see that IDE behavior is absolutely right:
Active blocks in test.h: #define A3 and #define CCC
Inactive blocks in test.h: #define B3 and #define WWW
because macro _WIN32 is undefined because there is no compilations unit that include test.h with defined macros _WIN32.
If you add following c++ source file in the attached CppStaticLibrary:

#include "test.h"

all blocks in the test.h will be active.

Alexander
Comment 5 Alexander Pepin 2012-09-17 12:45:59 UTC
No bug in IDE, isn't it?
Comment 6 shirojirou 2012-09-19 02:26:03 UTC
I'm sorry, I didn't notice Alexander Simon 2012-07-31 comment.

It will happen, when I changed project property...
It is hard to reenact this bug, but my company project always occurs.
I can't believe why no one claims this bug.
There is no this bug until 7.1, so I stick to use 7.1 forever...
Comment 7 Vladimir Voskresensky 2012-09-19 07:43:43 UTC
I will have a look what's wrong
Comment 8 Vladimir Voskresensky 2012-09-19 07:49:19 UTC
There was a regression in 7.2 (see issue #217711) in preprocessor which was fixed in trunk. Could you, please, backup your project metafiles (nbproject folder), then open using daily
http://bits.netbeans.org/dev/nightly/
and see if bug is reproducible.

Thanks!
Vladimir.
Comment 9 shirojirou 2012-09-20 05:53:09 UTC
Created attachment 124611 [details]
lib and cpp

I upload the projects again.
Comment 10 shirojirou 2012-09-20 05:54:15 UTC
I tried nighty build, but it was same result.

I find how to reenact this bug.

1) Open the both projects, and activate test.h tab.
2) Change the CppApplication_1 project to cygwin.
3) Select CppStaticLibrary_1 and reevaluate the project.

Now you see the bug!
Comment 11 shirojirou 2012-09-20 05:55:32 UTC
I tried nighty build, but it was same result.

I find how to reenact this bug.

1) Open the both projects, and activate test.h tab.
2) Change the CppApplication_1 project to cygwin.
3) Select CppStaticLibrary_1 and reevaluate the project.

Now you see the bug!
Comment 12 Vladimir Voskresensky 2012-09-21 10:38:46 UTC
Alexander, are you able to reproduce?
Comment 13 shirojirou 2012-09-26 01:53:05 UTC
Created attachment 124918 [details]
Update again

I update project again...

I tried to change Java 64bit to 32bit(1.7.0.07), but it was same result.

1)Open the CppApplication_1, CppStaticLibrary_1 and CppStaticLibrary_1/test.h.

In this time, only WWW is available.

2)Change CppApplication_1 [property] -> [build] -> [tool collection Cygwin]
3)CppStaticLibrary_1 [code assistance] -> [re-evaluate project]

Now CCC is also available.

I use japanese version, so I'm not sure the command name.