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 214186 - __GXX_EXPERIMENTAL_CXX0X__ not set
Summary: __GXX_EXPERIMENTAL_CXX0X__ not set
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
: 215388 219679 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-14 09:55 UTC by mpusz
Modified: 2013-05-27 11:29 UTC (History)
4 users (show)

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 mpusz 2012-06-14 09:55:54 UTC
All C++11 features in gcc are guarded with __GXX_EXPERIMENTAL_CXX0X__ preprocessor macro which is automatically defined by gcc when C++0x/C++11 mode is selected. Code Assistance does not define that macro in case of C++11 mode which causes a lot of invalid reported problems in the source code.
Comment 1 nnnnnk 2012-06-14 18:19:21 UTC
It seems that it's not needed if you use -std=c++11 flag instead of -std=c++Ox.
Comment 2 mpusz 2012-06-14 18:32:20 UTC
I will check that, but if I am not wrong gcc 4.6.3 which is still a default for Ubuntu does not support c++11 std flag yet.
Comment 3 Vladimir Voskresensky 2012-06-14 19:36:39 UTC
(In reply to comment #2)
> I will check that, but if I am not wrong gcc 4.6.3 which is still a default for
> Ubuntu does not support c++11 std flag yet.
We thought you use upcoming 4.8 :-)
http://netbeans.org/bugzilla/show_bug.cgi?id=214184#c2
Comment 4 mpusz 2012-06-14 19:40:13 UTC
I am using and checking different compilers in different versions :-P
BTW, does compilation flags setting in makefile (i.e. -std=c++11) has impact on Code Assistance preprocessor macros? If yes, than I am really impressed.
Comment 5 Vladimir Voskresensky 2012-06-14 19:46:22 UTC
(In reply to comment #4)
> I am using and checking different compilers in different versions :-P
> BTW, does compilation flags setting in makefile (i.e. -std=c++11) has impact on
> Code Assistance preprocessor macros? If yes, than I am really impressed.
If you clean&build at least once from IDE, then it should magically detect it.
Have a look nbproject/private/private.properties file content to make sure what was detected.
Comment 6 mpusz 2012-06-14 20:19:52 UTC
Strange. I do not have such a file. Here is my list of files:

mpusz@mpusz-ubuntu:~$ ls -R NetBeansProjects/ttcnSimple/nbproject/
NetBeansProjects/ttcnSimple/nbproject/:
configurations.xml  Package-Default.bash  private  project.xml

NetBeansProjects/ttcnSimple/nbproject/private:
configurations.xml  Default.properties  private.xml

Maybe that is why I have to click "Code Assistance" -> "Reparse Project" much too often in order to not see errors in the editor window.
Comment 7 Alexander Simon 2012-06-14 20:38:58 UTC
(In reply to comment #6)
> Strange. I do not have such a file. Here is my list of files:
> 
> mpusz@mpusz-ubuntu:~$ ls -R NetBeansProjects/ttcnSimple/nbproject/
> NetBeansProjects/ttcnSimple/nbproject/:
> configurations.xml  Package-Default.bash  private  project.xml
> 
> NetBeansProjects/ttcnSimple/nbproject/private:
> configurations.xml  Default.properties  private.xml
> 
> Maybe that is why I have to click "Code Assistance" -> "Reparse Project" much
> too often in order to not see errors in the editor window.

Vladimir mean nbproject/private/Default.properties
Comment 8 Vladimir Voskresensky 2012-06-14 20:42:09 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Strange. I do not have such a file. Here is my list of files:
> 
> Vladimir mean nbproject/private/Default.properties
Exactly. Thanks.
Comment 9 Alexander Simon 2012-06-15 07:01:42 UTC
Please, provide link on GNU documentation where predefined macros is defined.
Comment 10 mpusz 2012-06-15 07:25:03 UTC
Please see any of GCC C++11 headers. For example /usr/include/c++/4.6.3/tuple has:

#ifndef __GXX_EXPERIMENTAL_CXX0X__
# include <bits/c++0x_warning.h>
#else

..........

#endif
Comment 11 soldatov 2012-06-15 07:27:49 UTC
main question: why _EXPERIMENTAL_? Which plans on gcc 4.9 and more?
Comment 12 mpusz 2012-06-15 07:34:15 UTC
All C++11 STL features in GCC 4.6.X, 4.7 and 4.8 have such a preprocessor macro that if not defined leads you to a compilation error. I really do not know why they still name it experimental as C++11 is an official stardard now.

After your comments I tried to experiment a bit with the NB environment. I removed manually added macro in Code Assistance -> C++ Compiler -> Macro Definitions and after several rebuilds and Code Assistance -> Reparse Project it started to work without problems (no red errors reported beside ovveride that you fixed already and alternative function syntax). Well at least until the IDE shutdown. When I restart IDE I again have problems with red errors and have to reparse the project again.
Comment 13 Alexander Simon 2012-06-15 07:49:20 UTC
So I still do not see any reason to add code assistance rule:
"GNU compiler flags -std=c++11 and -std=c++Ox define predefined macros __GXX_EXPERIMENTAL_CXX0X__".
As work around you can add this macros in Tools->Options->C/C++->Code Assistance->GNU->C++ Compiler->Macro Definitions.
And file bag against GNU about using undocumented predefined macros.
Comment 14 mpusz 2012-06-15 07:53:25 UTC
"As work around you can add this macros in Tools->Options->C/C++->Code
Assistance->GNU->C++ Compiler->Macro Definitions." That is exactly what I did before you added C++11 standard selection option and that is why I suggested adding that to IDE in first place. Now it seems to work better. Thanks for your support.
Comment 15 Alexander Simon 2012-06-15 08:01:49 UTC
Please, reopen bug if you will find GNU documentation about such predefined macros.
Comment 16 soldatov 2012-08-09 09:12:51 UTC
(In reply to comment #10)
> Please see any of GCC C++11 headers. For example /usr/include/c++/4.6.3/tuple
> has:
> 
> #ifndef __GXX_EXPERIMENTAL_CXX0X__
> # include <bits/c++0x_warning.h>
> #else
> 
> ..........
> 
> #endif

__GXX_EXPERIMENTAL_CXX0X__ is temporary macro. Valid C++ header is

# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
....
# endif
Comment 17 Vladimir Voskresensky 2012-09-10 15:57:24 UTC
Alexander, let's analyzer output of -dM for different -std=... and update toolchain descriptor accordingly
Comment 18 Vladimir Voskresensky 2012-10-21 18:28:42 UTC
Alexander, for 7.3 we can use simple approach without compiler call.
On my system diff is (2 extra macros in output):
#define __GXX_EXPERIMENTAL_CXX0X__ 1
#define __STRICT_ANSI__ 1
Comment 19 Alexander Simon 2012-10-22 08:33:38 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/9b4b3a30122d
Comment 20 Quality Engineering 2012-10-23 12:06:55 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/9b4b3a30122d
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #214186 __GXX_EXPERIMENTAL_CXX0X__ not set
Comment 21 nnnnnk 2012-10-25 14:49:47 UTC
*** Bug 215388 has been marked as a duplicate of this bug. ***
Comment 22 nnnnnk 2012-10-25 14:51:16 UTC
*** Bug 218632 has been marked as a duplicate of this bug. ***
Comment 23 nnnnnk 2012-10-30 14:56:17 UTC
*** Bug 219679 has been marked as a duplicate of this bug. ***
Comment 24 AnAkIn 2013-05-25 11:58:21 UTC
The issue is back with recent versions of gcc (using 4.8.0). They've changed the C++11 headers to :

if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else

__cplusplus 201103L needs to be set in netbeans when C++11 is enabled to fix the issue.
Comment 25 Alexander Simon 2013-05-26 17:20:11 UTC
Please, file another issue.
Comment 26 Vladimir Voskresensky 2013-05-27 11:29:04 UTC
filed separate
https://netbeans.org/bugzilla/show_bug.cgi?id=230312