aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.h
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2005-05-02 04:22:45 +0000
committerMichael Matz <matz@gcc.gnu.org>2005-05-02 04:22:45 +0000
commitb2f97e4a12858733fc4977859febecd144acb8dd (patch)
tree81e0ec0700839598638506aadcfb471636db87e6 /gcc/c-common.h
parentf8f9fb4526bea97382af2024b7b268725d544239 (diff)
downloadgcc-b2f97e4a12858733fc4977859febecd144acb8dd.zip
gcc-b2f97e4a12858733fc4977859febecd144acb8dd.tar.gz
gcc-b2f97e4a12858733fc4977859febecd144acb8dd.tar.bz2
re PR c++/19542 (attribute(sentinel) has problems with C++ __null)
PR c++/19542 * c-common.c (c_common_nodes_and_builtins): Create global null_node. (warn_strict_null_sentinel): Define. (check_function_sentinel): Check for null_node as valid sentinel too. * c-common.h (c_tree_index): Added CTI_NULL. (null_node) Define global_tree[CTI_NULL]. (warn_strict_null_sentinel): Declare. * c-opts.c: (c_common_handle_option): Handle -Wstrict-null-sentinel. * c.opt: (Wstrict-null-sentinel): New C++ option. * doc/invoke.texi (C++ Options): Document -Wstrict-null-sentinel. * cp-tree.h (cp_tree_index): Remove CPTI_NULL, to be defined in C common frontend. (null_node): Remove. * lex.c (cxx_init): Move null_node initialisation to C common frontend. * g++.dg/warn/sentinel.C: New testcase for __null sentinels added. From-SVN: r99091
Diffstat (limited to 'gcc/c-common.h')
-rw-r--r--gcc/c-common.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 5c9330b..c43531b 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -159,6 +159,8 @@ enum c_tree_index
CTI_VOID_ZERO,
+ CTI_NULL,
+
CTI_MAX
};
@@ -203,6 +205,9 @@ struct c_common_identifier GTY(())
/* A node for `((void) 0)'. */
#define void_zero_node c_global_trees[CTI_VOID_ZERO]
+/* The node for C++ `__null'. */
+#define null_node c_global_trees[CTI_NULL]
+
extern GTY(()) tree c_global_trees[CTI_MAX];
/* In a RECORD_TYPE, a sorted array of the fields of the type, not a
@@ -570,6 +575,12 @@ extern int flag_threadsafe_statics;
extern int warn_implicit;
+/* Warn about using __null (as NULL in C++) as sentinel. For code compiled
+ with GCC this doesn't matter as __null is guaranteed to have the right
+ size. */
+
+extern int warn_strict_null_sentinel;
+
/* Maximum template instantiation depth. This limit is rather
arbitrary, but it exists to limit the time it takes to notice
infinite template instantiations. */