Re: [PATCH] add missing attribute nonnull to stdio functions (PR 78673 and 17308)

2016-12-14 Thread Jakub Jelinek
On Wed, Dec 07, 2016 at 08:24:33PM -0700, Martin Sebor wrote: > @@ -8622,15 +8635,17 @@ rewrite_call_expr (location_t loc, tree exp, int > skip, tree fndecl, int n, ...) > } > > /* Validate a single argument ARG against a tree code CODE representing > - a type. */ > + a type. When NONNUL

Re: [PATCH] add missing attribute nonnull to stdio functions (PR 78673 and 17308)

2016-12-13 Thread Jeff Law
On 12/07/2016 08:24 PM, Martin Sebor wrote: You're right! Good chatch! I missed that there are two ways to represent the same thing. For example, these two declarations void __attribute ((nonnull (1, 2))) f (void); void __attribute ((nonnull (1))) __attribute ((nonnull (2))) f (void

Re: [PATCH] add missing attribute nonnull to stdio functions (PR 78673 and 17308)

2016-12-07 Thread Martin Sebor
+bitmap +get_nonnull_args (const_tree callexpr) +{ + tree fn = CALL_EXPR_FN (callexpr); + if (!fn || TREE_CODE (fn) != ADDR_EXPR) +return NULL; + + tree fndecl = TREE_OPERAND (fn, 0); + tree fntype = TREE_TYPE (fndecl); + tree attrs = TYPE_ATTRIBUTES (fntype); + if (!attrs) +return N

Re: [PATCH] add missing attribute nonnull to stdio functions (PR 78673 and 17308)

2016-12-06 Thread Jeff Law
On 12/05/2016 03:56 PM, Martin Sebor wrote: The new -Wformat-length warning pass detects and diagnoses non- constant null format strings. This is in addition to (but not in conflict with) -Wformat which is limited to detecting only null constants. A recently posted patch of mine also adds the d

[PATCH] add missing attribute nonnull to stdio functions (PR 78673 and 17308)

2016-12-05 Thread Martin Sebor
The new -Wformat-length warning pass detects and diagnoses non- constant null format strings. This is in addition to (but not in conflict with) -Wformat which is limited to detecting only null constants. A recently posted patch of mine also adds the detection of null pointer arguments to the %s