Re: [RFC] Add function attribute: null_terminated_string_arg(PARAM_IDX)

2023-10-26 Thread David Malcolm
On Thu, 2023-10-19 at 10:02 -0400, David Malcolm wrote: > This patch adds a new function attribute to GCC for marking that an > argument is expected to be a null-terminated string. > > For example, consider: > >   void test_a (const char *p) >     __attribute__((null_terminated_string_arg (1)));

Re: [RFC] Add function attribute: null_terminated_string_arg(PARAM_IDX)

2023-10-19 Thread David Malcolm
On Thu, 2023-10-19 at 16:13 +0200, Andreas Schwab wrote: > On Okt 19 2023, David Malcolm wrote: [...] > > +   /* First, check for a null-terminated string *without* > > +  emitting emitting warnings (via a null context), to > > -emitting > Thanks; I've fixed this in my working copy

Re: [RFC] Add function attribute: null_terminated_string_arg(PARAM_IDX)

2023-10-19 Thread Andreas Schwab
On Okt 19 2023, David Malcolm wrote: > +void > +region_model:: > +check_one_function_attr_null_terminated_string_arg (const gcall *call, > + tree callee_fndecl, > + region_model_context *ctxt, > +

[RFC] Add function attribute: null_terminated_string_arg(PARAM_IDX)

2023-10-19 Thread David Malcolm
This patch adds a new function attribute to GCC for marking that an argument is expected to be a null-terminated string. For example, consider: void test_a (const char *p) __attribute__((null_terminated_string_arg (1))); which would indicate to humans and compilers that argument 1 of "test