diff options
author | dgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-01 16:29:06 +0000 |
---|---|---|
committer | dgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-01 16:29:06 +0000 |
commit | 0fe6eeac395902234683a7d5bd824d19d89060c9 (patch) | |
tree | 875c5fa5548c28bdbec98cd7f7e0e301a08a6248 /gcc | |
parent | 093aec7c290ad028466ef761fe4fff8934f85439 (diff) | |
download | ppe42-gcc-0fe6eeac395902234683a7d5bd824d19d89060c9.tar.gz ppe42-gcc-0fe6eeac395902234683a7d5bd824d19d89060c9.zip |
2006-11-01 Douglas Gregor <doug.gregor@gmail.com>
* 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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-common.c | 5 | ||||
-rw-r--r-- | gcc/c-common.h | 5 | ||||
-rw-r--r-- | gcc/c-cppbuiltin.c | 2 | ||||
-rw-r--r-- | gcc/c-opts.c | 20 | ||||
-rw-r--r-- | gcc/c.opt | 14 | ||||
-rw-r--r-- | gcc/doc/cpp.texi | 7 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 12 |
7 files changed, 64 insertions, 1 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index a901aba2f50..47cda1b6413 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -401,6 +401,11 @@ int flag_access_control = 1; 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. diff --git a/gcc/c-common.h b/gcc/c-common.h index f6f36e0114f..40d8b963719 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -521,6 +521,11 @@ extern int flag_access_control; 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. diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index c6e5c6d34f8..dc0c3438dca 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -409,6 +409,8 @@ c_cpp_builtins (cpp_reader *pfile) 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. */ diff --git a/gcc/c-opts.c b/gcc/c-opts.c index b74ce773088..1abb374c476 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -109,6 +109,7 @@ static size_t include_cursor; 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); @@ -789,7 +790,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) 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; @@ -913,6 +914,12 @@ c_common_handle_option (size_t scode, const char *arg, int value) 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: @@ -1509,6 +1516,17 @@ set_std_cxx98 (int iso) 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) diff --git a/gcc/c.opt b/gcc/c.opt index 0aa0a3ad30c..01cb779dc31 100644 --- a/gcc/c.opt +++ b/gcc/c.opt @@ -842,6 +842,13 @@ std=c++98 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 @@ -858,6 +865,13 @@ std=gnu++98 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 diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index 13b92f306e5..5a7513667f4 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -2094,6 +2094,13 @@ This macro is defined, with value 1, if the compiler uses the old 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 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a77f9f2dc43..c62c02c31cd 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1199,6 +1199,18 @@ The 1998 ISO C++ standard plus amendments. @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 |