Re: [PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-22 Thread David Malcolm via Gcc-patches
On Fri, 2022-07-22 at 21:25 +0530, Immad Mir wrote: > This patch adds three new function attributes to GCC that > are used for static analysis of usage of file descriptors: > > 1) __attribute__ ((fd_arg(N))): The attributes may be applied to a > function that > takes an open file descriptor at ref

[PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-22 Thread Immad Mir via Gcc-patches
This patch adds three new function attributes to GCC that are used for static analysis of usage of file descriptors: 1) __attribute__ ((fd_arg(N))): The attributes may be applied to a function that takes an open file descriptor at refrenced argument N. It indicates that the passed filedescriptor

Re: [PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-20 Thread Mir Immad via Gcc-patches
> Sorry to nitpick -- I assume stmt here refers to a call stmt ? > In that case, I suppose it'd be better to use const gcall *stmt ? Thanks for the catch, Prathamesh. Immad. On Wed, Jul 20, 2022 at 11:59 PM Prathamesh Kulkarni < prathamesh.kulka...@linaro.org> wrote: > On Wed, 20 Jul 2022 at

Re: [PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-20 Thread Prathamesh Kulkarni via Gcc-patches
On Wed, 20 Jul 2022 at 23:31, Immad Mir via Gcc-patches wrote: > > This patch adds three new function attributes to GCC that > are used for static analysis of usage of file descriptors: > > 1) __attribute__ ((fd_arg(N))): The attributes may be applied to a function > that > takes on open file des

Re: [PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-20 Thread David Malcolm via Gcc-patches
On Wed, 2022-07-20 at 23:29 +0530, Immad Mir wrote: > This patch adds three new function attributes to GCC that > are used for static analysis of usage of file descriptors: Thanks for the updated patch. Some very minor spelling/grammar/whitespace nits... > > 1) __attribute__ ((fd_arg(N))): Th

[PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-20 Thread Immad Mir via Gcc-patches
This patch adds three new function attributes to GCC that are used for static analysis of usage of file descriptors: 1) __attribute__ ((fd_arg(N))): The attributes may be applied to a function that takes on open file descriptor at refrenced argument N. It indicates that the passed filedescriptor

Re: [PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-19 Thread David Malcolm via Gcc-patches
On Tue, 2022-07-19 at 14:18 -0400, David Malcolm wrote: > On Tue, 2022-07-19 at 21:36 +0530, Immad Mir wrote: > [...snip...] > > > > +void > > +fd_state_machine::check_for_fd_attrs ( > > +    sm_context *sm_ctxt, const supernode *node, const gimple > > *stmt, > > +    const tree callee_fndecl,

Re: [PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-19 Thread David Malcolm via Gcc-patches
On Tue, 2022-07-19 at 21:36 +0530, Immad Mir wrote: [...snip...] Thanks for the patch. It's nearly ready for trunk; I have some review comments below, mostly nits, but a couple of other issues... > gcc/ChangeLog: > * doc/extend.texi: Add fd_arg, fd_arg_read and fd_arg_write under >

[PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-19 Thread Immad Mir via Gcc-patches
This patch adds three new function attributes to GCC that are used for static analysis of usage of file descriptors: 1) __attribute__ ((fd_arg(N))): The attributes may be applied to a function that takes on open file descriptor at refrenced argument N. It indicates that the passed filedescriptor

Re: [PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-15 Thread David Malcolm via Gcc-patches
On Fri, 2022-07-15 at 21:08 +0530, Immad Mir wrote: Thanks for the patch. Various review comments: The patch is missing a ChangeLog. > --- > gcc/analyzer/sm-fd.cc| 257 --- > gcc/c-family/c-attribs.cc| 115 > gcc/doc/extend.texi

[PATCH] Adding three new function attributes for static analysis of file descriptors

2022-07-15 Thread Immad Mir via Gcc-patches
--- gcc/analyzer/sm-fd.cc| 257 --- gcc/c-family/c-attribs.cc| 115 gcc/doc/extend.texi | 19 ++ gcc/testsuite/gcc.dg/analyzer/fd-5.c | 53 ++ gcc/testsuite/gcc.dg/analyzer/fd-6.c | 14 ++ 5 files changed, 431