diff mbox series

[v1] Fix build error caused by -Werror-implicit-function-declaration for Android

Message ID 1554992323-14338-1-git-send-email-ruanzw@xiaopeng.com
State Accepted
Delegated to: Petr Vorel
Headers show
Series [v1] Fix build error caused by -Werror-implicit-function-declaration for Android | expand

Commit Message

阮正旺 April 11, 2019, 2:18 p.m. UTC
Fix build errors caused by -Werror-implicit-function-declaration by add missing
<string.h> and <strings.h> for Android.

Signed-off-by: Zhengwang Ruan <ruanzw@xiaopeng.com>
---
 include/tst_numa.h                                            | 2 ++
 include/tst_test.h                                            | 1 +
 testcases/kernel/syscalls/copy_file_range/copy_file_range01.c | 1 +
 testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c             | 2 +-
 testcases/kernel/syscalls/epoll_wait/epoll_wait01.c           | 1 +
 5 files changed, 6 insertions(+), 1 deletion(-)

Comments

Enji Cooper April 11, 2019, 3:16 p.m. UTC | #1
> On Apr 11, 2019, at 07:18, Zhengwang Ruan <ruanzw@xiaopeng.com> wrote:
> 
> Fix build errors caused by -Werror-implicit-function-declaration by add missing
> <string.h> and <strings.h> for Android.

Comment next time: it would be a good idea a to note what functions were missing.

> Signed-off-by: Zhengwang Ruan <ruanzw@xiaopeng.com>

Reviewed-by: Enji Cooper <yaneurabeya@gmail.com>

> ---
> include/tst_numa.h                                            | 2 ++
> include/tst_test.h                                            | 1 +
> testcases/kernel/syscalls/copy_file_range/copy_file_range01.c | 1 +
> testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c             | 2 +-
> testcases/kernel/syscalls/epoll_wait/epoll_wait01.c           | 1 +
> 5 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/tst_numa.h b/include/tst_numa.h
> index a4cd1be..4f98066 100644
> --- a/include/tst_numa.h
> +++ b/include/tst_numa.h
> @@ -7,6 +7,8 @@
> #ifndef TST_NUMA_H__
> #define TST_NUMA_H__
> 
> +#include <string.h>
> +
> /**
>  * Numa nodemap.
>  */
> diff --git a/include/tst_test.h b/include/tst_test.h
> index cf2447f..25b9763 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -24,6 +24,7 @@
> 
> #include <unistd.h>
> #include <limits.h>
> +#include <string.h>
> 
> #include "tst_common.h"
> #include "tst_res_flags.h"
> diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
> index 2bca8a4..61a6042 100644
> --- a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
> +++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
> @@ -15,6 +15,7 @@
> #define _GNU_SOURCE
> #include <stdio.h>
> #include <errno.h>
> +#include <stdlib.h>
> #include "tst_test.h"
> #include "tst_safe_stdio.h"
> #include "lapi/syscalls.h"
> diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
> index e837913..4df55b5 100644
> --- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
> +++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
> @@ -31,7 +31,7 @@
> 
> #include <sys/epoll.h>
> #include <poll.h>
> -#include <string.h>
> +#include <strings.h>

Just a general question: did you test the non-Android case?

> #include <errno.h>
> #include "tst_test.h"
> 
> diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
> index 0ded127..6099b84 100644
> --- a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
> +++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
> @@ -26,6 +26,7 @@
> #include <sys/epoll.h>
> #include <poll.h>
> #include <string.h>
> +#include <strings.h>
> #include <errno.h>
> 
> #include "tst_test.h"
> -- 
> 2.7.4
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel April 11, 2019, 11:33 p.m. UTC | #2
Hi,

> Fix build errors caused by -Werror-implicit-function-declaration by add missing
> <string.h> and <strings.h> for Android.

> Signed-off-by: Zhengwang Ruan <ruanzw@xiaopeng.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Suggested-by: Petr Vorel <pvorel@suse.cz>

See also
http://lists.linux.it/pipermail/ltp/2019-April/011655.html

Kind regards,
Petr
阮正旺 April 12, 2019, 2:07 a.m. UTC | #3
Hi Cooper,


-------- Original Message --------
From: Enji Cooper
Sent: Thu, 11 Apr 2019 08:16:00 -0700
To: Zhengwang Ruan
Cc: Ltp
Subject: Re: [LTP] [PATCH v1] Fix build error caused by 
-Werror-implicit-function-declaration for Android
>> On Apr 11, 2019, at 07:18, Zhengwang Ruan <ruanzw@xiaopeng.com> wrote:
>>
>> Fix build errors caused by -Werror-implicit-function-declaration by add missing
>> <string.h> and <strings.h> for Android.
> Comment next time: it would be a good idea a to note what functions were missing.
>
>> Signed-off-by: Zhengwang Ruan <ruanzw@xiaopeng.com>
> Reviewed-by: Enji Cooper <yaneurabeya@gmail.com>
>
>> ---
>> include/tst_numa.h                                            | 2 ++
>> include/tst_test.h                                            | 1 +
>> testcases/kernel/syscalls/copy_file_range/copy_file_range01.c | 1 +
>> testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c             | 2 +-
>> testcases/kernel/syscalls/epoll_wait/epoll_wait01.c           | 1 +
>> 5 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/tst_numa.h b/include/tst_numa.h
>> index a4cd1be..4f98066 100644
>> --- a/include/tst_numa.h
>> +++ b/include/tst_numa.h
>> @@ -7,6 +7,8 @@
>> #ifndef TST_NUMA_H__
>> #define TST_NUMA_H__
>>
>> +#include <string.h>
>> +
>> /**
>>   * Numa nodemap.
>>   */
>> diff --git a/include/tst_test.h b/include/tst_test.h
>> index cf2447f..25b9763 100644
>> --- a/include/tst_test.h
>> +++ b/include/tst_test.h
>> @@ -24,6 +24,7 @@
>>
>> #include <unistd.h>
>> #include <limits.h>
>> +#include <string.h>
>>
>> #include "tst_common.h"
>> #include "tst_res_flags.h"
>> diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
>> index 2bca8a4..61a6042 100644
>> --- a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
>> +++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
>> @@ -15,6 +15,7 @@
>> #define _GNU_SOURCE
>> #include <stdio.h>
>> #include <errno.h>
>> +#include <stdlib.h>
>> #include "tst_test.h"
>> #include "tst_safe_stdio.h"
>> #include "lapi/syscalls.h"
>> diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
>> index e837913..4df55b5 100644
>> --- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
>> +++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
>> @@ -31,7 +31,7 @@
>>
>> #include <sys/epoll.h>
>> #include <poll.h>
>> -#include <string.h>
>> +#include <strings.h>
> Just a general question: did you test the non-Android case?

Yes, I have tested it using the default gcc on my Ubuntu 16.04 host.


Kind Regards,

Zhengwang

>
>> #include <errno.h>
>> #include "tst_test.h"
>>
>> diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
>> index 0ded127..6099b84 100644
>> --- a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
>> +++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
>> @@ -26,6 +26,7 @@
>> #include <sys/epoll.h>
>> #include <poll.h>
>> #include <string.h>
>> +#include <strings.h>
>> #include <errno.h>
>>
>> #include "tst_test.h"
>> -- 
>> 2.7.4
>>
>>
>> -- 
>> Mailing list info: https://lists.linux.it/listinfo/ltp
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body smarttemplateinserted="true">
    <div id="smartTemplate4-template">
      <p>Hi Cooper, <br>
      </p>
    </div>
    <br>
    <div id="smartTemplate4-quoteHeader">-------- Original Message --------<br>
      From: Enji Cooper<br>
      Sent: Thu, 11 Apr 2019 08:16:00 -0700<br>
      To: Zhengwang Ruan<br>
      Cc: Ltp<br>
      Subject: Re: [LTP] [PATCH v1] Fix build error caused by
      -Werror-implicit-function-declaration for Android<br>
    </div>
    <blockquote type="cite"
      cite="mid:F2D8419F-5149-4D85-BBBC-53B268A38065@gmail.com">
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">On Apr 11, 2019, at 07:18, Zhengwang Ruan <a class="moz-txt-link-rfc2396E" href="mailto:ruanzw@xiaopeng.com">&lt;ruanzw@xiaopeng.com&gt;</a> wrote:

Fix build errors caused by -Werror-implicit-function-declaration by add missing
&lt;string.h&gt; and &lt;strings.h&gt; for Android.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Comment next time: it would be a good idea a to note what functions were missing.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Signed-off-by: Zhengwang Ruan <a class="moz-txt-link-rfc2396E" href="mailto:ruanzw@xiaopeng.com">&lt;ruanzw@xiaopeng.com&gt;</a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Reviewed-by: Enji Cooper <a class="moz-txt-link-rfc2396E" href="mailto:yaneurabeya@gmail.com">&lt;yaneurabeya@gmail.com&gt;</a>

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">---
include/tst_numa.h                                            | 2 ++
include/tst_test.h                                            | 1 +
testcases/kernel/syscalls/copy_file_range/copy_file_range01.c | 1 +
testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c             | 2 +-
testcases/kernel/syscalls/epoll_wait/epoll_wait01.c           | 1 +
5 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/tst_numa.h b/include/tst_numa.h
index a4cd1be..4f98066 100644
--- a/include/tst_numa.h
+++ b/include/tst_numa.h
@@ -7,6 +7,8 @@
#ifndef TST_NUMA_H__
#define TST_NUMA_H__

+#include &lt;string.h&gt;
+
/**
 * Numa nodemap.
 */
diff --git a/include/tst_test.h b/include/tst_test.h
index cf2447f..25b9763 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -24,6 +24,7 @@

#include &lt;unistd.h&gt;
#include &lt;limits.h&gt;
+#include &lt;string.h&gt;

#include "tst_common.h"
#include "tst_res_flags.h"
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
index 2bca8a4..61a6042 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
@@ -15,6 +15,7 @@
#define _GNU_SOURCE
#include &lt;stdio.h&gt;
#include &lt;errno.h&gt;
+#include &lt;stdlib.h&gt;
#include "tst_test.h"
#include "tst_safe_stdio.h"
#include "lapi/syscalls.h"
diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
index e837913..4df55b5 100644
--- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
+++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
@@ -31,7 +31,7 @@

#include &lt;sys/epoll.h&gt;
#include &lt;poll.h&gt;
-#include &lt;string.h&gt;
+#include &lt;strings.h&gt;
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Just a general question: did you test the non-Android case?</pre>
    </blockquote>
    <p>Yes, I have tested it using the default gcc on my Ubuntu 16.04
      host.</p>
    <p><br>
    </p>
    <p>Kind Regards,</p>
    <p>Zhengwang<br>
    </p>
    <blockquote type="cite"
      cite="mid:F2D8419F-5149-4D85-BBBC-53B268A38065@gmail.com">
      <pre class="moz-quote-pre" wrap="">

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">#include &lt;errno.h&gt;
#include "tst_test.h"

diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
index 0ded127..6099b84 100644
--- a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
+++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
@@ -26,6 +26,7 @@
#include &lt;sys/epoll.h&gt;
#include &lt;poll.h&gt;
#include &lt;string.h&gt;
+#include &lt;strings.h&gt;
#include &lt;errno.h&gt;

#include "tst_test.h"
阮正旺 April 12, 2019, 3:41 p.m. UTC | #4
Hi Petr,


-------- Original Message --------
From: Petr Vorel
Sent: Fri, 12 Apr 2019 01:33:30 +0200
To: Zhengwang Ruan
Cc: Ltp
Subject: Re: [LTP] [PATCH v1] Fix build error caused by 
-Werror-implicit-function-declaration for Android
> Hi,
>
>> Fix build errors caused by -Werror-implicit-function-declaration by add missing
>> <string.h> and <strings.h> for Android.
>> Signed-off-by: Zhengwang Ruan <ruanzw@xiaopeng.com>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Suggested-by: Petr Vorel <pvorel@suse.cz>
>
> See also
> http://lists.linux.it/pipermail/ltp/2019-April/011655.html
>
> Kind regards,
> Petr

Back to this thread, do you prefer this patch and accept it  now? :-)


Kind Regards,

Zhengwang
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body smarttemplateinserted="true">
    <div id="smartTemplate4-template">
      <p> Hi Petr,<br>
      </p>
    </div>
    <br>
    <div id="smartTemplate4-quoteHeader">-------- Original Message --------<br>
      From: Petr Vorel<br>
      Sent: Fri, 12 Apr 2019 01:33:30 +0200<br>
      To: Zhengwang Ruan<br>
      Cc: Ltp<br>
      Subject: Re: [LTP] [PATCH v1] Fix build error caused by
      -Werror-implicit-function-declaration for Android<br>
    </div>
    <blockquote type="cite" cite="mid:20190411233330.GA381@x230">
      <pre class="moz-quote-pre" wrap="">Hi,

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Fix build errors caused by -Werror-implicit-function-declaration by add missing
&lt;string.h&gt; and &lt;strings.h&gt; for Android.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Signed-off-by: Zhengwang Ruan <a class="moz-txt-link-rfc2396E" href="mailto:ruanzw@xiaopeng.com">&lt;ruanzw@xiaopeng.com&gt;</a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">Reviewed-by: Petr Vorel <a class="moz-txt-link-rfc2396E" href="mailto:pvorel@suse.cz">&lt;pvorel@suse.cz&gt;</a>
Suggested-by: Petr Vorel <a class="moz-txt-link-rfc2396E" href="mailto:pvorel@suse.cz">&lt;pvorel@suse.cz&gt;</a>

See also
<a class="moz-txt-link-freetext" href="http://lists.linux.it/pipermail/ltp/2019-April/011655.html">http://lists.linux.it/pipermail/ltp/2019-April/011655.html</a>

Kind regards,
Petr
</pre>
    </blockquote>
    <p>Back to this thread, do you prefer this patch and accept it  now?
      :-)</p>
    <p><br>
    </p>
    <p>Kind Regards,</p>
    <p>Zhengwang<br>
    </p>
  </body>
</html>
Petr Vorel April 15, 2019, 1:49 p.m. UTC | #5
Hi all,

> Fix build errors caused by -Werror-implicit-function-declaration by add missing
> <string.h> and <strings.h> for Android.

> Signed-off-by: Zhengwang Ruan <ruanzw@xiaopeng.com>
In the end merged this one (after rebase), which fixes android build for now and
added a ticket for replacing deprecated functions from <strings.h>

https://github.com/linux-test-project/ltp/issues/521

Zhengwang, thanks for your work and testing.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/include/tst_numa.h b/include/tst_numa.h
index a4cd1be..4f98066 100644
--- a/include/tst_numa.h
+++ b/include/tst_numa.h
@@ -7,6 +7,8 @@ 
 #ifndef TST_NUMA_H__
 #define TST_NUMA_H__
 
+#include <string.h>
+
 /**
  * Numa nodemap.
  */
diff --git a/include/tst_test.h b/include/tst_test.h
index cf2447f..25b9763 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -24,6 +24,7 @@ 
 
 #include <unistd.h>
 #include <limits.h>
+#include <string.h>
 
 #include "tst_common.h"
 #include "tst_res_flags.h"
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
index 2bca8a4..61a6042 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
@@ -15,6 +15,7 @@ 
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
+#include <stdlib.h>
 #include "tst_test.h"
 #include "tst_safe_stdio.h"
 #include "lapi/syscalls.h"
diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
index e837913..4df55b5 100644
--- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
+++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
@@ -31,7 +31,7 @@ 
 
 #include <sys/epoll.h>
 #include <poll.h>
-#include <string.h>
+#include <strings.h>
 #include <errno.h>
 #include "tst_test.h"
 
diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
index 0ded127..6099b84 100644
--- a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
+++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
@@ -26,6 +26,7 @@ 
 #include <sys/epoll.h>
 #include <poll.h>
 #include <string.h>
+#include <strings.h>
 #include <errno.h>
 
 #include "tst_test.h"