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 220375 - -U directive is unsupported and handled incorrectly
Summary: -U directive is unsupported and handled incorrectly
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.3
Hardware: PC Linux
: P2 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-18 17:39 UTC by tbrunhoff
Modified: 2012-10-24 15:29 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 tbrunhoff 2012-10-18 17:39:29 UTC
For the version below, if I open project properties->Code assistance-->c++ compiler, and paste the command line defines (without opening the ... dialog), like -Dfoo -Dfumble=2, NB correctly turns these into discrete entries foo=1 and fumble=2. That's a good thing. However...

- if an undefine directive like -Uxxx is pasted, versions previous to the one below created a define for the name "-Uxxx".  The version below, *incorrectly* interprets -U as -D and creates an entry for a defined xxx.
- if non-cpp directives are pasted, such as -g -O, these are left unmodified.
- if I use the dialog, I can add defines like -g and -O
- if I use the dialog, there is no way to create an undefine entry.

I think the code assistance dialog would be much more usefi


Product Version: NetBeans IDE Dev (Build 201210170002)
Java: 1.7.0_05; Java HotSpot(TM) Client VM 23.1-b03
System: Linux version 3.4.9-2.fc16.x86_64 running on i386; UTF-8; en_US (nb)
User directory: /home/toddb/.netbeans/dev
Cache directory: /home/toddb/.cache/netbeans/dev
Comment 1 tbrunhoff 2012-10-18 17:43:24 UTC
I think the code assistance dialog would be much more useful if
- text pasted into the "include directories" discarded everything but valid pathnames or pathnames prefixed with -I
- text pasted into the "processor definitions" considered only valid variable names ([a-zA-Z0-9]*) or assignments or arguments that begin with -D or -U.

It would seem that the -U directive may require much more work.
Comment 2 Alexander Simon 2012-10-19 12:48:39 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/dfb8692be150
Comment 3 Quality Engineering 2012-10-20 01:30:11 UTC
Integrated into 'main-golden', will be available in build *201210200002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/dfb8692be150
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #220375 -U directive is unsupported and handled incorrectly
Comment 4 Quality Engineering 2012-10-23 12:07:32 UTC
Integrated into 'main-golden', will be available in build *201210231040* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/5a1634e4b1e8
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #220375 -U directive is unsupported and handled incorrectly
- additional fix for -I (recount relative path from item dir to project dir)
Comment 5 tbrunhoff 2012-10-23 22:48:57 UTC
I am running the version below (cited by QE above), and it doesn't look fixed. I see no way to add a undefined directive, and if I write a -U__linux__ into the list of defines by hand, I see nothing in the list of the ide's defines that acknowledge it. And in fact there is code that remains defined that, if __linux__ were undefined, would be grey.

Product Version: NetBeans IDE Dev (Build 201210231040)
Java: 1.7.0_05; Java HotSpot(TM) Client VM 23.1-b03
System: Linux version 3.4.9-2.fc16.x86_64 running on i386; UTF-8; en_US (nb)
User directory: /home/toddb/.netbeans/dev
Cache directory: /home/toddb/.cache/netbeans/dev
Comment 6 tbrunhoff 2012-10-23 22:50:28 UTC
... and I removed ~/.cache/netbeans/dev/cnd/model
Comment 7 Alexander Simon 2012-10-24 05:00:38 UTC
(In reply to comment #5)
> I am running the version below (cited by QE above), and it doesn't look fixed.
> I see no way to add a undefined directive, and if I write a -U__linux__ into
> the list of defines by hand, I see nothing in the list of the ide's defines
> that acknowledge it. And in fact there is code that remains defined that, if
> __linux__ were undefined, would be grey.
You should write -U__linux__ into the list of undefines.
Comment 8 Vladimir Voskresensky 2012-10-24 09:21:52 UTC
Todd, you should see now the dedicated property for undefined. 
Do you see it your version of IDE?
Comment 9 tbrunhoff 2012-10-24 14:27:41 UTC
Sorry, I completely missed the new property line for undefines. Thanks!
Comment 10 Vladimir Voskresensky 2012-10-24 15:14:23 UTC
Todd, although we made this property visible, can we understand why do you need it? 
We expect that magic with auto detection of compiled files and associated options for projects from existing sources should be the best way to have the most accurate code model. When do you need to manipulate it manually,?
Especially after fixed bug 
http://netbeans.org/bugzilla/show_bug.cgi?id=220601

Thanks!
Vladimir.
Comment 11 tbrunhoff 2012-10-24 15:29:03 UTC
> Todd, although we made this property visible, can we understand why do you need
> it? ...Especially after fixed bug 
> http://netbeans.org/bugzilla/show_bug.cgi?id=220601

For me, I am trying to get real work done, and without 220601 (which I will try out today, thank you), configuring a project so that its not full of red syntax errors is fairly painful. I've ended up writing scripts to generate xml to insert in the configurations.xml. Without the auto config working, one of the fastest ways to get projects working was to just paste the -D directives into the dialog. And that's when I ran into the problem with -U.

So really, if the auto config works reliably, then I would likely ignore the -D properties and the -U properties in the ide.

Thanks for being so accomodating!