diff mbox series

[1/2] libsepol/tests: use more strict compiler options

Message ID 20221114194031.12245-1-cgzones@googlemail.com (mailing list archive)
State Accepted
Commit c54dd0fab718
Headers show
Series [1/2] libsepol/tests: use more strict compiler options | expand

Commit Message

Christian Göttsche Nov. 14, 2022, 7:40 p.m. UTC
Use the more strict C compiler warnings from the root Makefile.

Also fail on warnings from the m4 macro processor.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libsepol/tests/Makefile            | 19 +++++++++++++++++--
 libsepol/tests/test-linker-roles.c |  2 +-
 2 files changed, 18 insertions(+), 3 deletions(-)

Comments

James Carter Nov. 17, 2022, 9:25 p.m. UTC | #1
On Mon, Nov 14, 2022 at 2:42 PM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> Use the more strict C compiler warnings from the root Makefile.
>
> Also fail on warnings from the m4 macro processor.
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

For these two patches:
Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libsepol/tests/Makefile            | 19 +++++++++++++++++--
>  libsepol/tests/test-linker-roles.c |  2 +-
>  2 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/libsepol/tests/Makefile b/libsepol/tests/Makefile
> index a72c327d..273373b0 100644
> --- a/libsepol/tests/Makefile
> +++ b/libsepol/tests/Makefile
> @@ -1,9 +1,24 @@
>  ENV ?= env
> -M4 ?= m4
> +M4 ?= m4 -E -E
>  MKDIR ?= mkdir
>  EXE ?= libsepol-tests
>
> -CFLAGS += -g3 -gdwarf-2 -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter -Werror
> +CFLAGS += -g3 -gdwarf-2 -O0 \
> +       -Werror -Wall -Wextra \
> +       -Wfloat-equal \
> +       -Wformat=2 \
> +       -Winit-self \
> +       -Wmissing-format-attribute \
> +       -Wmissing-noreturn \
> +       -Wmissing-prototypes \
> +       -Wnull-dereference \
> +       -Wpointer-arith \
> +       -Wshadow \
> +       -Wstrict-prototypes \
> +       -Wundef \
> +       -Wunused \
> +       -Wwrite-strings \
> +       -fno-common
>
>  # Statically link libsepol on the assumption that we are going to
>  # be testing internal functions.
> diff --git a/libsepol/tests/test-linker-roles.c b/libsepol/tests/test-linker-roles.c
> index 2b17dffd..b35bdbe6 100644
> --- a/libsepol/tests/test-linker-roles.c
> +++ b/libsepol/tests/test-linker-roles.c
> @@ -53,7 +53,7 @@
>
>  /* this simply tests whether the passed in role only has its own
>   * value in its dominates ebitmap */
> -static void only_dominates_self(policydb_t * p, role_datum_t * role)
> +static void only_dominates_self(policydb_t * p __attribute__ ((unused)), role_datum_t * role)
>  {
>         ebitmap_node_t *tnode;
>         unsigned int i;
> --
> 2.38.1
>
James Carter Nov. 21, 2022, 8:57 p.m. UTC | #2
On Thu, Nov 17, 2022 at 4:25 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Mon, Nov 14, 2022 at 2:42 PM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > Use the more strict C compiler warnings from the root Makefile.
> >
> > Also fail on warnings from the m4 macro processor.
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> For these two patches:
> Acked-by: James Carter <jwcart2@gmail.com>
>
These two patches have been merged.
Thanks,
Jim

> > ---
> >  libsepol/tests/Makefile            | 19 +++++++++++++++++--
> >  libsepol/tests/test-linker-roles.c |  2 +-
> >  2 files changed, 18 insertions(+), 3 deletions(-)
> >
> > diff --git a/libsepol/tests/Makefile b/libsepol/tests/Makefile
> > index a72c327d..273373b0 100644
> > --- a/libsepol/tests/Makefile
> > +++ b/libsepol/tests/Makefile
> > @@ -1,9 +1,24 @@
> >  ENV ?= env
> > -M4 ?= m4
> > +M4 ?= m4 -E -E
> >  MKDIR ?= mkdir
> >  EXE ?= libsepol-tests
> >
> > -CFLAGS += -g3 -gdwarf-2 -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter -Werror
> > +CFLAGS += -g3 -gdwarf-2 -O0 \
> > +       -Werror -Wall -Wextra \
> > +       -Wfloat-equal \
> > +       -Wformat=2 \
> > +       -Winit-self \
> > +       -Wmissing-format-attribute \
> > +       -Wmissing-noreturn \
> > +       -Wmissing-prototypes \
> > +       -Wnull-dereference \
> > +       -Wpointer-arith \
> > +       -Wshadow \
> > +       -Wstrict-prototypes \
> > +       -Wundef \
> > +       -Wunused \
> > +       -Wwrite-strings \
> > +       -fno-common
> >
> >  # Statically link libsepol on the assumption that we are going to
> >  # be testing internal functions.
> > diff --git a/libsepol/tests/test-linker-roles.c b/libsepol/tests/test-linker-roles.c
> > index 2b17dffd..b35bdbe6 100644
> > --- a/libsepol/tests/test-linker-roles.c
> > +++ b/libsepol/tests/test-linker-roles.c
> > @@ -53,7 +53,7 @@
> >
> >  /* this simply tests whether the passed in role only has its own
> >   * value in its dominates ebitmap */
> > -static void only_dominates_self(policydb_t * p, role_datum_t * role)
> > +static void only_dominates_self(policydb_t * p __attribute__ ((unused)), role_datum_t * role)
> >  {
> >         ebitmap_node_t *tnode;
> >         unsigned int i;
> > --
> > 2.38.1
> >
diff mbox series

Patch

diff --git a/libsepol/tests/Makefile b/libsepol/tests/Makefile
index a72c327d..273373b0 100644
--- a/libsepol/tests/Makefile
+++ b/libsepol/tests/Makefile
@@ -1,9 +1,24 @@ 
 ENV ?= env
-M4 ?= m4
+M4 ?= m4 -E -E
 MKDIR ?= mkdir
 EXE ?= libsepol-tests
 
-CFLAGS += -g3 -gdwarf-2 -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter -Werror
+CFLAGS += -g3 -gdwarf-2 -O0 \
+	-Werror -Wall -Wextra \
+	-Wfloat-equal \
+	-Wformat=2 \
+	-Winit-self \
+	-Wmissing-format-attribute \
+	-Wmissing-noreturn \
+	-Wmissing-prototypes \
+	-Wnull-dereference \
+	-Wpointer-arith \
+	-Wshadow \
+	-Wstrict-prototypes \
+	-Wundef \
+	-Wunused \
+	-Wwrite-strings \
+	-fno-common
 
 # Statically link libsepol on the assumption that we are going to
 # be testing internal functions.
diff --git a/libsepol/tests/test-linker-roles.c b/libsepol/tests/test-linker-roles.c
index 2b17dffd..b35bdbe6 100644
--- a/libsepol/tests/test-linker-roles.c
+++ b/libsepol/tests/test-linker-roles.c
@@ -53,7 +53,7 @@ 
 
 /* this simply tests whether the passed in role only has its own 
  * value in its dominates ebitmap */
-static void only_dominates_self(policydb_t * p, role_datum_t * role)
+static void only_dominates_self(policydb_t * p __attribute__ ((unused)), role_datum_t * role)
 {
 	ebitmap_node_t *tnode;
 	unsigned int i;