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 147406 - "true" and "false" show as syntax errors with gcc c99
Summary: "true" and "false" show as syntax errors with gcc c99
Status: RESOLVED INVALID
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Thomas Preisler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-16 19:04 UTC by _ gordonp
Modified: 2010-06-01 23:45 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gordonp 2008-09-16 19:04:03 UTC
While fixing a gdb module issue regarding bool types, I compiled a C file with -std=c99 and
bool, true, and false keywords/macros. Syntax highlighting showed true and false as errors,
even though they're part of the c99 standard.
Comment 1 Vladimir Kvashin 2008-09-16 20:05:49 UTC
I'd like to note that this involves both code model and project system.
Code model should "understand" such keywords in the case file is C99.
So we have to 
- extend NativeFileItem interface to include C99 language flavour
- make NativeFileItem implementation provide correct flavor for such files
- process this on code model site
Comment 2 andreagualano 2009-09-24 09:24:59 UTC
According to the C99 standard, the only boolean related keyword is "_Bool", which Netbeans IDE 6.7 seems to understand.

The standard defines the header file stdbool.h, containing the following macros:
#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1

The IDE apparently has trouble finding this standard header so "bool", "true" and "false", which are macros, are not
defined.
Comment 3 andreagualano 2009-09-24 09:34:34 UTC
After further investigation, it appears that on my system (Ubuntu 9.04) "stdbool.h" is located under
/usr/lib/gcc/i486-linux-gnu/4.3/include or /usr/lib/gcc/i486-linux-gnu/4.3.3/include but by default Netbeans IDE
searches /usr/lib/gcc/i486-linux-gnu/4.3.2/include

$ ls -l /usr/lib/gcc/i486-linux-gnu/
total 4
drwxr-xr-x 4 root root 4096 2009-04-29 10:29 4.3
lrwxrwxrwx 1 root root    3 2009-02-19 15:57 4.3.3 -> 4.3
$ gcc --version
gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Changing the directory under Tools|Options|C/C++|Code Assistance makes it work.
Comment 4 Vladimir Voskresensky 2009-09-24 10:10:12 UTC
if #include directive is not resolved => it is red underlined. 
Hovering with mouse and pressed Ctrl+Alt will show searched paths in the order.
This paths are taken from Project properties and Toolchain's include path Tools|Options|C/C++|Code Assistance
Comment 5 Thomas Preisler 2009-11-17 11:42:39 UTC
So you are saying that the include paths in Tools|Options|C/C++|Code Assistance are incomplete? Is that what this bug is?
Comment 6 andreagualano 2009-11-18 02:04:31 UTC
I'm not sure.
I think the include paths are generated correctly the first time the C++ plugin is installed, and then are kept unchanged forever, even when upgrading to a new IDE version.
On the other hand, the GCC specific include paths under /usr/lib/gcc/i486-linux-gnu (as opposed to the global includes like /usr/include and /usr/local/include) do change each time the GCC version changes, which happens quite frequently, so the IDE setting gets out of sync with the actual paths.
I have only experimented on Ubuntu, but this is probably the same on other Linux distros and maybe elsewhere.
Perhaps the IDE setting should track the "gcc --version" value.
Comment 7 Thomas Preisler 2010-06-01 23:45:10 UTC
Not clear from reading this bug report exactly what the bug is. Please try new Netbeans 6.9 and open a new bug report with clear description of what the problem is and how to reproduce it.