* c-common.c (flag_cpp0x): New.
* c-common.h (flag_cpp0x): New.
* c-cppbuiltin.c (c_cpp_builtins): If C++0x extensions are
supported, define __GXX_EXPERIMENTAL_CPP0X__.
* c-opts.c (set_std_cxx0x): New.
(c_common_handle_option): Handle -std=c++0x, -std=gnu++0x.
* c.opt (std=c++0x): Document.
(std=gnu++0x): Ditto.
* doc/cpp.texi: Document __GXX_EXPERIMENTAL_CPP0X__.
* doc/invoke.texi: Document -std=c++0x, -std=gnu++0x.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118386
138bc75d-0d04-0410-961f-
82ee72b054a4
int flag_check_new;
+/* Nonzero if we want to allow the use of experimental features that
+ are likely to become part of C++0x. */
+
+int flag_cpp0x = 0;
+
/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
initialization variables.
0: Old rules, set by -fno-for-scope.
extern int flag_check_new;
+/* Nonzero if we want to allow the use of experimental features that
+ are likely to become part of C++0x. */
+
+extern int flag_cpp0x;
+
/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
initialization variables.
0: Old rules, set by -fno-for-scope.
cpp_define (pfile, "__GXX_WEAK__=0");
if (warn_deprecated)
cpp_define (pfile, "__DEPRECATED");
+ if (flag_cpp0x)
+ cpp_define (pfile, "__GXX_EXPERIMENTAL_CPP0X__");
}
/* Note that we define this for C as well, so that we know if
__attribute__((cleanup)) will interface with EH. */
static void set_Wimplicit (int);
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
+static void set_std_cxx0x (int);
static void set_std_c89 (int, int);
static void set_std_c99 (int);
static void check_deps_environment_vars (void);
case OPT_fuse_cxa_atexit:
flag_use_cxa_atexit = value;
break;
-
+
case OPT_fuse_cxa_get_exception_ptr:
flag_use_cxa_get_exception_ptr = value;
break;
set_std_cxx98 (code == OPT_std_c__98 /* ISO */);
break;
+ case OPT_std_c__0x:
+ case OPT_std_gnu__0x:
+ if (!preprocessing_asm_p)
+ set_std_cxx0x (code == OPT_std_c__0x /* ISO */);
+ break;
+
case OPT_std_c89:
case OPT_std_iso9899_1990:
case OPT_std_iso9899_199409:
flag_iso = iso;
}
+/* Set the C++ 0x working draft "standard" (without GNU extensions if ISO). */
+static void
+set_std_cxx0x (int iso)
+{
+ cpp_set_lang (parse_in, iso ? CLK_CXX0X: CLK_GNUCXX0X);
+ flag_no_gnu_keywords = iso;
+ flag_no_nonansi_builtin = iso;
+ flag_iso = iso;
+ flag_cpp0x = 1;
+}
+
/* Handle setting implicit to ON. */
static void
set_Wimplicit (int on)
C++ ObjC++
Conform to the ISO 1998 C++ standard
+std=c++0x
+C++ ObjC++
+Conform to the ISO 1998 C++ standard, with extensions that are likely to
+become a part of the upcoming ISO C++ standard, dubbed C++0x. Note that the
+extensions enabled by this mode are experimental and may be removed in
+future releases of GCC.
+
std=c89
C ObjC
Conform to the ISO 1990 C standard
C++ ObjC++
Conform to the ISO 1998 C++ standard with GNU extensions
+std=gnu++0x
+C++ ObjC++
+Conform to the ISO 1998 C++ standard, with GNU extensions and
+extensions that are likely to become a part of the upcoming ISO C++
+standard, dubbed C++0x. Note that the extensions enabled by this mode
+are experimental and may be removed in future releases of GCC.
+
std=gnu89
C ObjC
Conform to the ISO 1990 C standard with GNU extensions
mechanism based on @code{setjmp} and @code{longjmp} for exception
handling.
+@item __GXX_EXPERIMENTAL_CPP0X__
+This macro is defined when compiling a C++ source file with the option
+@option{-std=c++0x} or @option{-std=gnu++0x}. It indicates that some
+features likely to be included in C++0x are available. Note that these
+features are experimental, and may change or be removed in future
+versions of GCC.
+
@item __GXX_WEAK__
This macro is defined when compiling a C++ source file. It has the
value 1 if the compiler will use weak symbols, COMDAT sections, or
@item gnu++98
The same as @option{-std=c++98} plus GNU extensions. This is the
default for C++ code.
+
+@item c++0x
+The working draft of the upcoming ISO C++0x standard. This option
+enables experimental features that are likely to be included in
+C++0x. The working draft is constantly changing, and any feature that is
+enabled by this flag may be removed from future versions of GCC if it is
+not part of the C++0x standard.
+
+@item gnu++0x
+The same as @option{-std=c++0x} plus GNU extensions. As with
+@option{-std=c++0x}, this option enables experimental features that may
+be removed in future versions of GCC.
@end table
Even when this option is not specified, you can still use some of the