netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libipt_ULOG.c - include strings.h for the definition of ffs()
@ 2020-04-21  8:15 Maciej Żenczykowski
  2020-04-21 10:40 ` Pablo Neira Ayuso
  2020-04-28  0:04 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 5+ messages in thread
From: Maciej Żenczykowski @ 2020-04-21  8:15 UTC (permalink / raw)
  To: Maciej Żenczykowski, Pablo Neira Ayuso, Florian Westphal
  Cc: Linux Network Development Mailing List,
	Netfilter Development Mailing List

From: Maciej Żenczykowski <maze@google.com>

This resolves compiler warnings:

extensions/libext4_srcs/gen/gensrcs/external/iptables/extensions/libipt_ULOG.c:89:32: error: implicit declaration of function 'ffs' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  printf(" --ulog-nlgroup %d", ffs(loginfo->nl_group));
                               ^
extensions/libext4_srcs/gen/gensrcs/external/iptables/extensions/libipt_ULOG.c:105:9: error: implicit declaration of function 'ffs' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  ffs(loginfo->nl_group));
  ^

Test: builds with less warnings
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 extensions/libipt_ULOG.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/extensions/libipt_ULOG.c b/extensions/libipt_ULOG.c
index fafb220b..5163eea3 100644
--- a/extensions/libipt_ULOG.c
+++ b/extensions/libipt_ULOG.c
@@ -11,6 +11,7 @@
  */
 #include <stdio.h>
 #include <string.h>
+#include <strings.h>
 #include <xtables.h>
 /* For 64bit kernel / 32bit userspace */
 #include <linux/netfilter_ipv4/ipt_ULOG.h>
-- 
2.26.1.301.g55bc3eb7cb9-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] libipt_ULOG.c - include strings.h for the definition of ffs()
  2020-04-21  8:15 [PATCH] libipt_ULOG.c - include strings.h for the definition of ffs() Maciej Żenczykowski
@ 2020-04-21 10:40 ` Pablo Neira Ayuso
  2020-04-21 14:01   ` Maciej Żenczykowski
  2020-04-28  0:04 ` Pablo Neira Ayuso
  1 sibling, 1 reply; 5+ messages in thread
From: Pablo Neira Ayuso @ 2020-04-21 10:40 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Maciej Żenczykowski, Florian Westphal,
	Linux Network Development Mailing List,
	Netfilter Development Mailing List

On Tue, Apr 21, 2020 at 01:15:07AM -0700, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> This resolves compiler warnings:
> 
> extensions/libext4_srcs/gen/gensrcs/external/iptables/extensions/libipt_ULOG.c:89:32: error: implicit declaration of function 'ffs' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>   printf(" --ulog-nlgroup %d", ffs(loginfo->nl_group));
>                                ^
> extensions/libext4_srcs/gen/gensrcs/external/iptables/extensions/libipt_ULOG.c:105:9: error: implicit declaration of function 'ffs' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>   ffs(loginfo->nl_group));
>   ^
> 
> Test: builds with less warnings

For the record, what compiler is triggering this? Or you use different
-W options there?

I don't see these with gcc 9.3 here.

> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
>  extensions/libipt_ULOG.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/extensions/libipt_ULOG.c b/extensions/libipt_ULOG.c
> index fafb220b..5163eea3 100644
> --- a/extensions/libipt_ULOG.c
> +++ b/extensions/libipt_ULOG.c
> @@ -11,6 +11,7 @@
>   */
>  #include <stdio.h>
>  #include <string.h>
> +#include <strings.h>
>  #include <xtables.h>
>  /* For 64bit kernel / 32bit userspace */
>  #include <linux/netfilter_ipv4/ipt_ULOG.h>
> -- 
> 2.26.1.301.g55bc3eb7cb9-goog
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libipt_ULOG.c - include strings.h for the definition of ffs()
  2020-04-21 10:40 ` Pablo Neira Ayuso
@ 2020-04-21 14:01   ` Maciej Żenczykowski
  2020-04-21 14:03     ` Maciej Żenczykowski
  0 siblings, 1 reply; 5+ messages in thread
From: Maciej Żenczykowski @ 2020-04-21 14:01 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Florian Westphal, Linux Network Development Mailing List,
	Netfilter Development Mailing List

Must be some version of clang - presumably with
-Wimplicit-function-declaration turned on.
I'm honestly not sure quite how to check, but it is whatever is the
default in aosp on master.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libipt_ULOG.c - include strings.h for the definition of ffs()
  2020-04-21 14:01   ` Maciej Żenczykowski
@ 2020-04-21 14:03     ` Maciej Żenczykowski
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej Żenczykowski @ 2020-04-21 14:03 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Florian Westphal, Linux Network Development Mailing List,
	Netfilter Development Mailing List

note: I guess it could also be bionic vs libc header files...
but per man ffs:
http://man7.org/linux/man-pages/man3/ffs.3.html

       #include <strings.h>
       int ffs(int i);

       #include <string.h>
       int ffsl(long int i);
       int ffsll(long long int i);

strings.h is the right header file.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libipt_ULOG.c - include strings.h for the definition of ffs()
  2020-04-21  8:15 [PATCH] libipt_ULOG.c - include strings.h for the definition of ffs() Maciej Żenczykowski
  2020-04-21 10:40 ` Pablo Neira Ayuso
@ 2020-04-28  0:04 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2020-04-28  0:04 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Maciej Żenczykowski, Florian Westphal,
	Linux Network Development Mailing List,
	Netfilter Development Mailing List

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-28  0:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21  8:15 [PATCH] libipt_ULOG.c - include strings.h for the definition of ffs() Maciej Żenczykowski
2020-04-21 10:40 ` Pablo Neira Ayuso
2020-04-21 14:01   ` Maciej Żenczykowski
2020-04-21 14:03     ` Maciej Żenczykowski
2020-04-28  0:04 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).