[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGA
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE() |
Date: |
Fri, 13 Mar 2020 08:50:45 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Vladimir Sementsov-Ogievskiy <address@hidden> writes:
[...]
> +// Warn several Error * definitions.
> +@check1 disable optional_qualifier exists@
> +identifier fn = rule1.fn, local_err, local_err2;
> +@@
> +
> + fn(..., Error ** ____, ...)
> + {
> + ...
> + Error *local_err = NULL;
> + ... when any
> + Error *local_err2 = NULL;
> + ... when any
> + }
> +
> +@ script:python @
> +fn << check1.fn;
> +@@
> +
> +print('Warning: function {} has several definitions of '
> + 'Error * local variable'.format(fn))
Printing the positions like you do in the next rule is useful when
examining these warnings.
> +
> +// Warn several propagations in control flow.
> +@check2 disable optional_qualifier exists@
> +identifier fn = rule1.fn;
> +symbol errp;
> +position p1, p2;
> +@@
> +
> + fn(..., Error ** ____, ...)
> + {
> + ...
> +(
> + error_propagate_prepend(errp, ...);@p1
> +|
> + error_propagate(errp, ...);@p1
> +)
> + ...
> +(
> + error_propagate_prepend(errp, ...);@p2
> +|
> + error_propagate(errp, ...);@p2
> +)
> + ... when any
> + }
> +
> +@ script:python @
> +fn << check2.fn;
> +p1 << check2.p1;
> +p2 << check2.p2;
> +@@
> +
> +print('Warning: function {} propagates to errp several times in '
> + 'one control flow: at {}:{} and then at {}:{}'.format(
> + fn, p1[0].file, p1[0].line, p2[0].file, p2[0].line))
[...]
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), (continued)
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Vladimir Sementsov-Ogievskiy, 2020/03/17
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Markus Armbruster, 2020/03/17
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Vladimir Sementsov-Ogievskiy, 2020/03/17
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Markus Armbruster, 2020/03/19
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Vladimir Sementsov-Ogievskiy, 2020/03/19
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Markus Armbruster, 2020/03/20
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Vladimir Sementsov-Ogievskiy, 2020/03/20
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Markus Armbruster, 2020/03/20
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Vladimir Sementsov-Ogievskiy, 2020/03/17
- Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Markus Armbruster, 2020/03/19
Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(),
Markus Armbruster <=
Re: [PATCH v9 02/10] scripts: Coccinelle script to use ERRP_AUTO_PROPAGATE(), Markus Armbruster, 2020/03/13
Re: [PATCH v9 00/10] error: auto propagated local_err part I, Markus Armbruster, 2020/03/12