diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2011-11-01 23:28:19 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-11-01 23:28:19 +0000 |
commit | 89401152c4451eec03fb63dad723edcaa89a2bd3 (patch) | |
tree | fa8cf61a13cc6e8d63e6a7ada7b5a330722a63fc /gcc/doc | |
parent | a8b5c4e82758a97a945d0e768112be8c85dbf86f (diff) | |
download | gcc-89401152c4451eec03fb63dad723edcaa89a2bd3.zip gcc-89401152c4451eec03fb63dad723edcaa89a2bd3.tar.gz gcc-89401152c4451eec03fb63dad723edcaa89a2bd3.tar.bz2 |
re PR c++/44277 ([C++0x] Add warning to facilitate nullptr conversion.)
/cp
2011-11-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44277
* cvt.c (cp_convert_to_pointer): Warn for zero as null pointer
constant.
* typeck.c (cp_truthvalue_conversion): Handle pointers and member
function pointers under c_inhibit_evaluation_warnings; use
nullptr_node for data member pointers.
(cp_build_binary_op): Tweak, just forward to cp_convert op1,
either a nullptr_node or an integer_zero_node.
(build_ptrmemfunc): Use nullptr_node.
* init.c (build_zero_init_1): Likewise.
/c-family
2011-11-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44277
* c.opt: Add Wzero-as-null-pointer-constant.
/gcc
2011-11-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44277
* doc/invoke.texi: Document -Wzero-as-null-pointer-constant.
/testsuite
2011-11-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44277
* g++.dg/warn/Wzero-as-null-pointer-constant-1.C: New.
* g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C: Likewise.
From-SVN: r180750
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2836b74..b68f607 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4142,6 +4142,12 @@ unsigned integers are disabled by default in C++ unless Do not warn for conversions between @code{NULL} and non-pointer types. @option{-Wconversion-null} is enabled by default. +@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} +@opindex Wzero-as-null-pointer-constant +@opindex Wno-zero-as-null-pointer-constant +Warn when a literal '0' is used as null pointer constant. This can +be useful to facilitate the conversion to @code{nullptr} in C++11. + @item -Wempty-body @opindex Wempty-body @opindex Wno-empty-body |