c-common.c (flag_cpp0x): New.
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. From-SVN: r118386
This commit is contained in:
parent
dfafdaa655
commit
966541e34d
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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. */
|
||||
|
|
20
gcc/c-opts.c
20
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)
|
||||
|
|
14
gcc/c.opt
14
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue