This patch moves prototype of char_type_p into c-common.h, so we can use it in c-family/*.
gcc/ChangeLog: 2017-02-22 Xi Ruoyao <r...@stu.xidian.edu.cn> * c-family/c-common.h (char_type_p): New prototype * c/c-typeck.c (char_type_p): Make the function extern * cp/cp-tree.h (char_type_p): Remove prototype * cp/tree.c (char_type_p): Change the return type to bool --- gcc/c-family/c-common.h | 1 + gcc/c/c-typeck.c | 4 +++- gcc/cp/cp-tree.h | 1 - gcc/cp/tree.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 9c28809..72fba56 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -962,6 +962,7 @@ extern tree build_real_imag_expr (location_t, enum tree_code, tree); extern tree build_unary_op (location_t, enum tree_code, tree, bool); extern tree build_binary_op (location_t, enum tree_code, tree, tree, int); extern tree perform_integral_promotions (tree); +extern bool char_type_p (tree); /* These functions must be defined by each front-end which implements a variant of the C language. They are used by port files. */ diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index ed8ffe4..49b99b5 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see #include "gimplify.h" #include "tree-inline.h" #include "omp-general.h" +#include "c-family/c-common.h" #include "c-family/c-objc.h" #include "c-family/c-ubsan.h" #include "cilk.h" @@ -3597,7 +3598,7 @@ parser_build_unary_op (location_t loc, enum tree_code code, struct c_expr arg) /* Returns true if TYPE is a character type, *not* including wchar_t. */ -static bool +bool char_type_p (tree type) { return (type == char_type_node @@ -5766,6 +5767,7 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype, newrhs = in_late_binary_op ? save_expr (rhs) : c_save_expr (rhs); rhseval = newrhs; } + newrhs = build_binary_op (location, modifycode, lhs, newrhs, 1); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f53f744..49a36c2 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6685,7 +6685,6 @@ extern bool cv_qualified_p (const_tree); extern tree cv_unqualified (tree); extern special_function_kind special_function_p (const_tree); extern int count_trees (tree); -extern int char_type_p (tree); extern void verify_stmt_tree (tree); extern linkage_kind decl_linkage (tree); extern duration_kind decl_storage_duration (tree); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index d3c63b8..e6c17f8 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -4394,7 +4394,7 @@ special_function_p (const_tree decl) /* Returns nonzero if TYPE is a character type, including wchar_t. */ -int +bool char_type_p (tree type) { return (same_type_p (type, char_type_node) -- Xi Ruoyao <r...@stu.xidian.edu.cn> School of Aerospace Science and Technology, Xidian University