diff mbox

[1/6] New warnings -Wstring-plus-{char, int} (PR c++/62181)

Message ID 1497231098.27153.7.camel@stu.xidian.edu.cn
State New
Headers show

Commit Message

Xi Ruoyao June 12, 2017, 1:31 a.m. UTC
This patch moves prototype of char_type_p into c-common.h, so we can
use it in c-family/*.

gcc/ChangeLog:

2017-06-12  Xi Ruoyao  <ryxi@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        | 3 ++-
 gcc/cp/cp-tree.h        | 1 -
 gcc/cp/tree.c           | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 79072e6..82ed4f6 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 ba44406..8adfa9a 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"
@@ -3605,7 +3606,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
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 5dd6023..65c1b82 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6928,7 +6928,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 bb17278..d6c1785 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -4855,7 +4855,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)
-- 
2.7.1