examples/l2fwd-cat: fix build

Message ID 20221005152347.330954-1-ktraynor@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series examples/l2fwd-cat: fix build |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Kevin Traynor Oct. 5, 2022, 3:23 p.m. UTC
  <ctype.h> and <errno.h> need to be included for the build
since they were removed from <rte_common.h>.

../examples/l2fwd-cat/cat.c: In function ‘parse_set’:
../examples/l2fwd-cat/cat.c:66:16:
warning: implicit declaration of function ‘isblank’
[-Wimplicit-function-declaration]
   66 |         while (isblank(*str))
      |                ^~~~~~~
../examples/l2fwd-cat/cat.c:18:1:
note: include ‘<ctype.h>’ or provide a declaration of ‘isblank’
   17 | #include "cat.h"
  +++ |+#include <ctype.h>
   18 |
../examples/l2fwd-cat/cat.c:70:15:
warning: implicit declaration of function ‘isdigit’
[-Wimplicit-function-declaration]
   70 |         if ((!isdigit(*str) && *str != '(') || *str == '\0')
      |               ^~~~~~~
../examples/l2fwd-cat/cat.c:70:15:
note: include ‘<ctype.h>’ or provide a declaration of ‘isdigit’
../examples/l2fwd-cat/cat.c:75:17:
error: ‘errno’ undeclared (first use in this function)
   75 |                 errno = 0;
      |                 ^~~~~
../examples/l2fwd-cat/cat.c:18:1:
note: ‘errno’ is defined in header ‘<errno.h>’;
did you forget to ‘#include <errno.h>’?
   17 | #include "cat.h"
  +++ |+#include <errno.h>

Fixes: 72b452c5f259 ("eal: remove unneeded includes from a public header")

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 examples/l2fwd-cat/cat.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

David Marchand Oct. 5, 2022, 3:28 p.m. UTC | #1
On Wed, Oct 5, 2022 at 5:24 PM Kevin Traynor <ktraynor@redhat.com> wrote:
>
> <ctype.h> and <errno.h> need to be included for the build
> since they were removed from <rte_common.h>.
>
> ../examples/l2fwd-cat/cat.c: In function ‘parse_set’:
> ../examples/l2fwd-cat/cat.c:66:16:
> warning: implicit declaration of function ‘isblank’
> [-Wimplicit-function-declaration]
>    66 |         while (isblank(*str))
>       |                ^~~~~~~
> ../examples/l2fwd-cat/cat.c:18:1:
> note: include ‘<ctype.h>’ or provide a declaration of ‘isblank’
>    17 | #include "cat.h"
>   +++ |+#include <ctype.h>
>    18 |
> ../examples/l2fwd-cat/cat.c:70:15:
> warning: implicit declaration of function ‘isdigit’
> [-Wimplicit-function-declaration]
>    70 |         if ((!isdigit(*str) && *str != '(') || *str == '\0')
>       |               ^~~~~~~
> ../examples/l2fwd-cat/cat.c:70:15:
> note: include ‘<ctype.h>’ or provide a declaration of ‘isdigit’
> ../examples/l2fwd-cat/cat.c:75:17:
> error: ‘errno’ undeclared (first use in this function)
>    75 |                 errno = 0;
>       |                 ^~~~~
> ../examples/l2fwd-cat/cat.c:18:1:
> note: ‘errno’ is defined in header ‘<errno.h>’;
> did you forget to ‘#include <errno.h>’?
>    17 | #include "cat.h"
>   +++ |+#include <errno.h>
>
> Fixes: 72b452c5f259 ("eal: remove unneeded includes from a public header")
>
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  
David Marchand Oct. 5, 2022, 4:57 p.m. UTC | #2
On Wed, Oct 5, 2022 at 5:24 PM Kevin Traynor <ktraynor@redhat.com> wrote:
>
> <ctype.h> and <errno.h> need to be included for the build
> since they were removed from <rte_common.h>.
>
> ../examples/l2fwd-cat/cat.c: In function ‘parse_set’:
> ../examples/l2fwd-cat/cat.c:66:16:
> warning: implicit declaration of function ‘isblank’
> [-Wimplicit-function-declaration]
>    66 |         while (isblank(*str))
>       |                ^~~~~~~
> ../examples/l2fwd-cat/cat.c:18:1:
> note: include ‘<ctype.h>’ or provide a declaration of ‘isblank’
>    17 | #include "cat.h"
>   +++ |+#include <ctype.h>
>    18 |
> ../examples/l2fwd-cat/cat.c:70:15:
> warning: implicit declaration of function ‘isdigit’
> [-Wimplicit-function-declaration]
>    70 |         if ((!isdigit(*str) && *str != '(') || *str == '\0')
>       |               ^~~~~~~
> ../examples/l2fwd-cat/cat.c:70:15:
> note: include ‘<ctype.h>’ or provide a declaration of ‘isdigit’
> ../examples/l2fwd-cat/cat.c:75:17:
> error: ‘errno’ undeclared (first use in this function)
>    75 |                 errno = 0;
>       |                 ^~~~~
> ../examples/l2fwd-cat/cat.c:18:1:
> note: ‘errno’ is defined in header ‘<errno.h>’;
> did you forget to ‘#include <errno.h>’?
>    17 | #include "cat.h"
>   +++ |+#include <errno.h>
>
> Fixes: 72b452c5f259 ("eal: remove unneeded includes from a public header")
>
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> ---
>  examples/l2fwd-cat/cat.c | 2 ++
>  1 file changed, 2 insertions(+)

There is another issue, caught when building this example out of the
meson build process (can be caught with
DPDK_BUILD_TEST_EXAMPLES=l2fwd-cat devtools/test-meson-builds.sh).
Not urgent, can you look at it?
(I added a rte_common.h inclusion in cat.h as a workaround, there may
be a bettter fix to do).


We could also enhance build coverage in GHA, since the
intel-cmt-cat/intel-cmd-cat-devel packages are available for
Ubuntu/Fedora distribs.
  
Thomas Monjalon Oct. 6, 2022, 10:33 a.m. UTC | #3
05/10/2022 17:28, David Marchand:
> On Wed, Oct 5, 2022 at 5:24 PM Kevin Traynor <ktraynor@redhat.com> wrote:
> >
> > <ctype.h> and <errno.h> need to be included for the build
> > since they were removed from <rte_common.h>.
> >
> > ../examples/l2fwd-cat/cat.c: In function ‘parse_set’:
> > ../examples/l2fwd-cat/cat.c:66:16:
> > warning: implicit declaration of function ‘isblank’
> > [-Wimplicit-function-declaration]
> >    66 |         while (isblank(*str))
> >       |                ^~~~~~~
> > ../examples/l2fwd-cat/cat.c:18:1:
> > note: include ‘<ctype.h>’ or provide a declaration of ‘isblank’
> >    17 | #include "cat.h"
> >   +++ |+#include <ctype.h>
> >    18 |
> > ../examples/l2fwd-cat/cat.c:70:15:
> > warning: implicit declaration of function ‘isdigit’
> > [-Wimplicit-function-declaration]
> >    70 |         if ((!isdigit(*str) && *str != '(') || *str == '\0')
> >       |               ^~~~~~~
> > ../examples/l2fwd-cat/cat.c:70:15:
> > note: include ‘<ctype.h>’ or provide a declaration of ‘isdigit’
> > ../examples/l2fwd-cat/cat.c:75:17:
> > error: ‘errno’ undeclared (first use in this function)
> >    75 |                 errno = 0;
> >       |                 ^~~~~
> > ../examples/l2fwd-cat/cat.c:18:1:
> > note: ‘errno’ is defined in header ‘<errno.h>’;
> > did you forget to ‘#include <errno.h>’?
> >    17 | #include "cat.h"
> >   +++ |+#include <errno.h>
> >
> > Fixes: 72b452c5f259 ("eal: remove unneeded includes from a public header")
> >
> > Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
  

Patch

diff --git a/examples/l2fwd-cat/cat.c b/examples/l2fwd-cat/cat.c
index 77154c8b7e..00e4cde48b 100644
--- a/examples/l2fwd-cat/cat.c
+++ b/examples/l2fwd-cat/cat.c
@@ -3,4 +3,6 @@ 
  */
 
+#include <ctype.h>
+#include <errno.h>
 #include <getopt.h>
 #include <inttypes.h>