[PATCH] add support for strnlen (PR 81384)

Martin Sebor msebor@gmail.com
Wed Jun 6 15:14:00 GMT 2018


On 06/05/2018 04:19 PM, Jakub Jelinek wrote:
> On Tue, Jun 05, 2018 at 03:43:17PM -0600, Martin Sebor wrote:
>> --- a/gcc/builtins.def
>> +++ b/gcc/builtins.def
>> @@ -733,6 +733,7 @@ DEF_EXT_LIB_BUILTIN    (BUILT_IN_STRNCASECMP, "strncasecmp", BT_FN_INT_CONST_STR
>>  DEF_LIB_BUILTIN        (BUILT_IN_STRNCAT, "strncat", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
>>  DEF_LIB_BUILTIN        (BUILT_IN_STRNCMP, "strncmp", BT_FN_INT_CONST_STRING_CONST_STRING_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
>>  DEF_LIB_BUILTIN        (BUILT_IN_STRNCPY, "strncpy", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
>> +DEF_LIB_BUILTIN_CHKP   (BUILT_IN_STRNLEN, "strnlen", BT_FN_SIZE_CONST_STRING_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
>
> strnlen isn't a C89, C99 nor C11 function, so I think it should be
> DEF_EXT_LIB_BUILTIN like e.g. stpcpy, not DEF_LIB_BUILTIN.

Thanks.  Let me change that.

> And not really sure it is worth adding the CHKP stuff when it will be just
> more work for Martin Liska to remove it again.

Sure, let me take that out.

Is there anything else?

Martin



More information about the Gcc-patches mailing list