Skip to contentSkip to conversation

libipt_ULOG.c - include strings.h for the definition of ffs()

PATCH Applied Maciej Żenczykowski 2 participants 5 messages Apr 21, 2020 – Apr 28, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libipt_ULOG.c - include strings.h for the definition of ffs()

From: Maciej Żenczykowski <[email protected]>

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

---
 extensions/libipt_ULOG.c | 1 +
 1 file changed, 1 insertion(+)
extensions/libipt_ULOG.c +1 -0
index fafb220b..5163eea3 100644
@@ -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>
Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
#1 lore raw
Quoted 4 lines · Maciej Żenczykowski

From: Maciej Żenczykowski <[email protected]>

This resolves compiler warnings:

Quoted 8 lines

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.

Quoted 20 lines
---
 extensions/libipt_ULOG.c | 1 +
 1 file changed, 1 insertion(+)
extensions/libipt_ULOG.c +1 -0
index fafb220b..5163eea3 100644
@@ -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>
Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
#2 lore raw

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.