aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>2018-10-03 20:55:10 -0600
committerJeff Law <law@gcc.gnu.org>2018-10-03 20:55:10 -0600
commit0863decda9aef33b8073c13f6d27826b881e6280 (patch)
tree56b96595c17f69c273072996d93b7f56cdf8b0e5 /gcc/tree.c
parent74ac60743f6cb84921477c6526b53fc9250ec4c1 (diff)
downloadgcc-0863decda9aef33b8073c13f6d27826b881e6280.zip
gcc-0863decda9aef33b8073c13f6d27826b881e6280.tar.gz
gcc-0863decda9aef33b8073c13f6d27826b881e6280.tar.bz2
gimple-ssa-sprintf.c (format_string): Do not hardcode size of target's wchar_t.
* gimple-ssa-sprintf.c (format_string): Do not hardcode size of target's wchar_t. * tree.c (get_typenode_from_name): Moved from fortran/trans-types.c. * tree.h (get_typenode_from_name): Prototype. * trans-types.c (get_typenode_from_name): Moved into gcc/tree.c. From-SVN: r264833
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 748ece6..d7dca77 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -14408,6 +14408,43 @@ expr_type_first_operand_type_p (tree_code code)
}
}
+/* Return a typenode for the "standard" C type with a given name. */
+tree
+get_typenode_from_name (const char *name)
+{
+ if (name == NULL || *name == '\0')
+ return NULL_TREE;
+
+ if (strcmp (name, "char") == 0)
+ return char_type_node;
+ if (strcmp (name, "unsigned char") == 0)
+ return unsigned_char_type_node;
+ if (strcmp (name, "signed char") == 0)
+ return signed_char_type_node;
+
+ if (strcmp (name, "short int") == 0)
+ return short_integer_type_node;
+ if (strcmp (name, "short unsigned int") == 0)
+ return short_unsigned_type_node;
+
+ if (strcmp (name, "int") == 0)
+ return integer_type_node;
+ if (strcmp (name, "unsigned int") == 0)
+ return unsigned_type_node;
+
+ if (strcmp (name, "long int") == 0)
+ return long_integer_type_node;
+ if (strcmp (name, "long unsigned int") == 0)
+ return long_unsigned_type_node;
+
+ if (strcmp (name, "long long int") == 0)
+ return long_long_integer_type_node;
+ if (strcmp (name, "long long unsigned int") == 0)
+ return long_long_unsigned_type_node;
+
+ gcc_unreachable ();
+}
+
/* List of pointer types used to declare builtins before we have seen their
real declaration.