diff mbox series

[1/6] checkpolicy: include <ctype.h> for isprint(3)

Message ID 20240402152925.99781-1-cgoettsche@seltendoof.de (mailing list archive)
State Accepted
Commit 0ffe97479c8e
Delegated to: Petr Lautrbach
Headers show
Series [1/6] checkpolicy: include <ctype.h> for isprint(3) | expand

Commit Message

Christian Göttsche April 2, 2024, 3:29 p.m. UTC
From: Christian Göttsche <cgzones@googlemail.com>

Include the necessary header for isprint(3) to avoid an implicit
function declaration:

    policy_scan.l: In function ‘yyerror’:
    policy_scan.l:342:13: warning: implicit declaration of function ‘isprint’ [-Wimplicit-function-declaration]
      342 |         if (isprint((unsigned char)yytext[0])) {
          |             ^~~~~~~
    policy_scan.l:36:1: note: include ‘<ctype.h>’ or provide a declaration of ‘isprint’
       35 | #include "y.tab.h"
      +++ |+#include <ctype.h>
       36 | #endif

This does not currently break the build cause -Werror is stripped for
the parsing code to avoid breakage on old flex/bison versions that might
not generate warning free code.

Fixes: 39b3cc51350a ("checkpolicy: handle unprintable token")
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 checkpolicy/policy_scan.l | 1 +
 1 file changed, 1 insertion(+)

Comments

James Carter April 3, 2024, 7:35 p.m. UTC | #1
On Tue, Apr 2, 2024 at 11:29 AM Christian Göttsche
<cgoettsche@seltendoof.de> wrote:
>
> From: Christian Göttsche <cgzones@googlemail.com>
>
> Include the necessary header for isprint(3) to avoid an implicit
> function declaration:
>
>     policy_scan.l: In function ‘yyerror’:
>     policy_scan.l:342:13: warning: implicit declaration of function ‘isprint’ [-Wimplicit-function-declaration]
>       342 |         if (isprint((unsigned char)yytext[0])) {
>           |             ^~~~~~~
>     policy_scan.l:36:1: note: include ‘<ctype.h>’ or provide a declaration of ‘isprint’
>        35 | #include "y.tab.h"
>       +++ |+#include <ctype.h>
>        36 | #endif
>
> This does not currently break the build cause -Werror is stripped for
> the parsing code to avoid breakage on old flex/bison versions that might
> not generate warning free code.
>
> Fixes: 39b3cc51350a ("checkpolicy: handle unprintable token")
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

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

> ---
>  checkpolicy/policy_scan.l | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l
> index d7cf2896..62f28c11 100644
> --- a/checkpolicy/policy_scan.l
> +++ b/checkpolicy/policy_scan.l
> @@ -22,6 +22,7 @@
>
>  %{
>  #include <sys/types.h>
> +#include <ctype.h>
>  #include <limits.h>
>  #include <stdint.h>
>  #include <string.h>
> --
> 2.43.0
>
>
James Carter April 4, 2024, 4:22 p.m. UTC | #2
On Wed, Apr 3, 2024 at 3:35 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Tue, Apr 2, 2024 at 11:29 AM Christian Göttsche
> <cgoettsche@seltendoof.de> wrote:
> >
> > From: Christian Göttsche <cgzones@googlemail.com>
> >
> > Include the necessary header for isprint(3) to avoid an implicit
> > function declaration:
> >
> >     policy_scan.l: In function ‘yyerror’:
> >     policy_scan.l:342:13: warning: implicit declaration of function ‘isprint’ [-Wimplicit-function-declaration]
> >       342 |         if (isprint((unsigned char)yytext[0])) {
> >           |             ^~~~~~~
> >     policy_scan.l:36:1: note: include ‘<ctype.h>’ or provide a declaration of ‘isprint’
> >        35 | #include "y.tab.h"
> >       +++ |+#include <ctype.h>
> >        36 | #endif
> >
> > This does not currently break the build cause -Werror is stripped for
> > the parsing code to avoid breakage on old flex/bison versions that might
> > not generate warning free code.
> >
> > Fixes: 39b3cc51350a ("checkpolicy: handle unprintable token")
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> For these six patches:
> Acked-by: James Carter <jwcart2@gmail.com>
>
These six patches have been merged.
Thanks,
Jim

> > ---
> >  checkpolicy/policy_scan.l | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l
> > index d7cf2896..62f28c11 100644
> > --- a/checkpolicy/policy_scan.l
> > +++ b/checkpolicy/policy_scan.l
> > @@ -22,6 +22,7 @@
> >
> >  %{
> >  #include <sys/types.h>
> > +#include <ctype.h>
> >  #include <limits.h>
> >  #include <stdint.h>
> >  #include <string.h>
> > --
> > 2.43.0
> >
> >
diff mbox series

Patch

diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l
index d7cf2896..62f28c11 100644
--- a/checkpolicy/policy_scan.l
+++ b/checkpolicy/policy_scan.l
@@ -22,6 +22,7 @@ 
 
 %{
 #include <sys/types.h>
+#include <ctype.h>
 #include <limits.h>
 #include <stdint.h>
 #include <string.h>