aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-11-07 10:01:52 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-11-07 10:01:52 +0000
commit5486d91300d0540215978ecde30870e1a337910c (patch)
tree0745360532b642227c4b092f57f659a9b65ff873 /gcc/builtins.c
parenteb0b164e5f7b8fff929e73fdd0a15a6d769ebc1c (diff)
downloadgcc-5486d91300d0540215978ecde30870e1a337910c.zip
gcc-5486d91300d0540215978ecde30870e1a337910c.tar.gz
gcc-5486d91300d0540215978ecde30870e1a337910c.tar.bz2
Move c_getstr to fold-const.c
Upcoming patches to fold-const-call.c want to use c_getstr, which is currently defined in builtins.c. The function doesn't really do anything related to built-ins, and I'd rather not make fold-const-call.c depend on builtins.c and builtins.c depend on fold-const-call.c, so this patch moves the function to fold-const.c instead. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * builtins.h (c_getstr): Move to... * fold-const.h (c_getstr): ...here. * builtins.c (c_getstr): Move to... * fold-const.c (c_getstr): ...here. From-SVN: r229919
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 8f0717c..69c56e7 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -616,27 +616,6 @@ c_strlen (tree src, int only_value)
return ssize_int (strlen (ptr + offset));
}
-/* Return a char pointer for a C string if it is a string constant
- or sum of string constant and integer constant. */
-
-const char *
-c_getstr (tree src)
-{
- tree offset_node;
-
- src = string_constant (src, &offset_node);
- if (src == 0)
- return 0;
-
- if (offset_node == 0)
- return TREE_STRING_POINTER (src);
- else if (!tree_fits_uhwi_p (offset_node)
- || compare_tree_int (offset_node, TREE_STRING_LENGTH (src) - 1) > 0)
- return 0;
-
- return TREE_STRING_POINTER (src) + tree_to_uhwi (offset_node);
-}
-
/* Return a constant integer corresponding to target reading
GET_MODE_BITSIZE (MODE) bits from string constant STR. */