diff mbox

[1/1] libsepol: remove unused attribute on a used argument

Message ID 20170517205324.18805-1-nicolas.iooss@m4x.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Nicolas Iooss May 17, 2017, 8:53 p.m. UTC
Since commit 58962eb3d847 ("libsepol,checkpolicy: add binary module
support for xperms") function display_avrule() has been using its "p"
argument even though it was previously marked unused. This makes clang
report:

    policydb.c:3276:7: error: 'p' was marked unused but was used
    [-Werror,-Wused-but-marked-unused].
        if (p->policyvers < MOD_POLICYDB_VERSION_XPERMS_IOCTL) {
            ^

Remove the attribute to make the code consistent again.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsepol/src/policydb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Nicolas Iooss May 17, 2017, 8:57 p.m. UTC | #1
On Wed, May 17, 2017 at 10:53 PM, Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
> Since commit 58962eb3d847 ("libsepol,checkpolicy: add binary module
> support for xperms") function display_avrule() has been using its "p"
> argument even though it was previously marked unused. This makes clang
> report:

Of course it is function avrule_read() instead. I commited and sent
this patch too quickly. Would you like me to send a patch with a fixed
description?
Nicolas

>
>     policydb.c:3276:7: error: 'p' was marked unused but was used
>     [-Werror,-Wused-but-marked-unused].
>         if (p->policyvers < MOD_POLICYDB_VERSION_XPERMS_IOCTL) {
>             ^
>
> Remove the attribute to make the code consistent again.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> ---
>  libsepol/src/policydb.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
> index 069eb7e66540..b1530955aa39 100644
> --- a/libsepol/src/policydb.c
> +++ b/libsepol/src/policydb.c
> @@ -3212,8 +3212,7 @@ common_read, class_read, role_read, type_read, user_read,
>
>  /************** module reading functions below **************/
>
> -static avrule_t *avrule_read(policydb_t * p
> -                            __attribute__ ((unused)), struct policy_file *fp)
> +static avrule_t *avrule_read(policydb_t * p, struct policy_file *fp)
>  {
>         unsigned int i;
>         uint32_t buf[2], len;
> --
> 2.13.0
>
Stephen Smalley May 18, 2017, 12:32 p.m. UTC | #2
On Wed, 2017-05-17 at 22:57 +0200, Nicolas Iooss wrote:
> On Wed, May 17, 2017 at 10:53 PM, Nicolas Iooss <nicolas.iooss@m4x.or
> g> wrote:
> > Since commit 58962eb3d847 ("libsepol,checkpolicy: add binary module
> > support for xperms") function display_avrule() has been using its
> > "p"
> > argument even though it was previously marked unused. This makes
> > clang
> > report:
> 
> Of course it is function avrule_read() instead. I commited and sent
> this patch too quickly. Would you like me to send a patch with a
> fixed
> description?

No, not necessary, thanks.

> Nicolas
> 
> > 
> >     policydb.c:3276:7: error: 'p' was marked unused but was used
> >     [-Werror,-Wused-but-marked-unused].
> >         if (p->policyvers < MOD_POLICYDB_VERSION_XPERMS_IOCTL) {
> >             ^
> > 
> > Remove the attribute to make the code consistent again.
> > 
> > Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> > ---
> >  libsepol/src/policydb.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
> > index 069eb7e66540..b1530955aa39 100644
> > --- a/libsepol/src/policydb.c
> > +++ b/libsepol/src/policydb.c
> > @@ -3212,8 +3212,7 @@ common_read, class_read, role_read,
> > type_read, user_read,
> > 
> >  /************** module reading functions below **************/
> > 
> > -static avrule_t *avrule_read(policydb_t * p
> > -                            __attribute__ ((unused)), struct
> > policy_file *fp)
> > +static avrule_t *avrule_read(policydb_t * p, struct policy_file
> > *fp)
> >  {
> >         unsigned int i;
> >         uint32_t buf[2], len;
> > --
> > 2.13.0
> >
Stephen Smalley May 18, 2017, 12:59 p.m. UTC | #3
On Wed, 2017-05-17 at 22:53 +0200, Nicolas Iooss wrote:
> Since commit 58962eb3d847 ("libsepol,checkpolicy: add binary module
> support for xperms") function display_avrule() has been using its "p"
> argument even though it was previously marked unused. This makes
> clang
> report:
> 
>     policydb.c:3276:7: error: 'p' was marked unused but was used
>     [-Werror,-Wused-but-marked-unused].
>         if (p->policyvers < MOD_POLICYDB_VERSION_XPERMS_IOCTL) {
>             ^
> 
> Remove the attribute to make the code consistent again.

Applied with corrected description.

> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> ---
>  libsepol/src/policydb.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
> index 069eb7e66540..b1530955aa39 100644
> --- a/libsepol/src/policydb.c
> +++ b/libsepol/src/policydb.c
> @@ -3212,8 +3212,7 @@ common_read, class_read, role_read, type_read,
> user_read,
>  
>  /************** module reading functions below **************/
>  
> -static avrule_t *avrule_read(policydb_t * p
> -			     __attribute__ ((unused)), struct
> policy_file *fp)
> +static avrule_t *avrule_read(policydb_t * p, struct policy_file *fp)
>  {
>  	unsigned int i;
>  	uint32_t buf[2], len;
diff mbox

Patch

diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
index 069eb7e66540..b1530955aa39 100644
--- a/libsepol/src/policydb.c
+++ b/libsepol/src/policydb.c
@@ -3212,8 +3212,7 @@  common_read, class_read, role_read, type_read, user_read,
 
 /************** module reading functions below **************/
 
-static avrule_t *avrule_read(policydb_t * p
-			     __attribute__ ((unused)), struct policy_file *fp)
+static avrule_t *avrule_read(policydb_t * p, struct policy_file *fp)
 {
 	unsigned int i;
 	uint32_t buf[2], len;