[1/1] tst_test.h: Include common headers to fix missing function declaration
diff mbox series

Message ID 20190414130329.14607-1-pvorel@suse.cz
State Changes Requested
Delegated to: Petr Vorel
Headers show
Series
  • [1/1] tst_test.h: Include common headers to fix missing function declaration
Related show

Commit Message

Petr Vorel April 14, 2019, 1:03 p.m. UTC
This fixes build errors caused by -Werror-implicit-function-declaration
defined for android. Due often missing when using common memory and
string related functions added <string.h>, <strings.h> and <stdlib.h>.

Including headers here seems to be better than handling implicit
function declaration error every now and then.

+ update copyright, use SPDX-License-Identifier.

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

IMHO better than previous patches [1] [2] to handle this.
I decided to include also <strings.h> (there other non-deprecated
functions besides to deprecated bzero) and <stdlib.h> (for malloc).

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/patch/1084064/
[2] https://patchwork.ozlabs.org/patch/1084370/
---
 include/tst_test.h | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

Comments

阮正旺 April 15, 2019, 2:13 a.m. UTC | #1
Hi Petr,


-------- Original Message --------
From: Petr Vorel
Sent: Sun, 14 Apr 2019 15:03:29 +0200
To: Ltp
Cc: Petr Vorel, Sandeep Patil, Steve Muckle, Zhengwang Ruan, Cyril Hrubis
Subject: [PATCH 1/1] tst_test.h: Include common headers to fix missing 
function declaration
> This fixes build errors caused by -Werror-implicit-function-declaration
> defined for android. Due often missing when using common memory and
> string related functions added <string.h>, <strings.h> and <stdlib.h>.
>
> Including headers here seems to be better than handling implicit
> function declaration error every now and then.
>
> + update copyright, use SPDX-License-Identifier.
>
> Suggested-by: Zhengwang Ruan <ruanzw@xiaopeng.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi,
>
> IMHO better than previous patches [1] [2] to handle this.
> I decided to include also <strings.h> (there other non-deprecated
> functions besides to deprecated bzero) and <stdlib.h> (for malloc).
>
> Kind regards,
> Petr
>
> [1] https://patchwork.ozlabs.org/patch/1084064/
> [2] https://patchwork.ozlabs.org/patch/1084370/
> ---
>   include/tst_test.h | 18 +++++-------------
>   1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/include/tst_test.h b/include/tst_test.h
> index cf2447fe3..69629caff 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -1,18 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
>   /*
>    * Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
> - *
> - * This program is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + * Copyright (c) Linux Test Project, 2016-2019
>    */
>   
>   #ifndef TST_TEST_H__
> @@ -24,6 +13,9 @@
>   
>   #include <unistd.h>
>   #include <limits.h>
> +#include <string.h>
> +#include <strings.h>
> +#include <stdlib.h>

Looks better now. :-)


Regards,

Zhengwang

>   
>   #include "tst_common.h"
>   #include "tst_res_flags.h"
<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: Sun, 14 Apr 2019 15:03:29 +0200<br>
      To: Ltp<br>
      Cc: Petr Vorel, Sandeep Patil, Steve Muckle, Zhengwang Ruan, Cyril
      Hrubis<br>
      Subject: [PATCH 1/1] tst_test.h: Include common headers to fix
      missing function declaration<br>
    </div>
    <blockquote type="cite"
      cite="mid:20190414130329.14607-1-pvorel@suse.cz">
      <pre class="moz-quote-pre" wrap="">This fixes build errors caused by -Werror-implicit-function-declaration
defined for android. Due often missing when using common memory and
string related functions added &lt;string.h&gt;, &lt;strings.h&gt; and &lt;stdlib.h&gt;.

Including headers here seems to be better than handling implicit
function declaration error every now and then.

+ update copyright, use SPDX-License-Identifier.

Suggested-by: Zhengwang Ruan <a class="moz-txt-link-rfc2396E" href="mailto:ruanzw@xiaopeng.com">&lt;ruanzw@xiaopeng.com&gt;</a>
Signed-off-by: Petr Vorel <a class="moz-txt-link-rfc2396E" href="mailto:pvorel@suse.cz">&lt;pvorel@suse.cz&gt;</a>
---
Hi,

IMHO better than previous patches [1] [2] to handle this.
I decided to include also &lt;strings.h&gt; (there other non-deprecated
functions besides to deprecated bzero) and &lt;stdlib.h&gt; (for malloc).

Kind regards,
Petr

[1] <a class="moz-txt-link-freetext" href="https://patchwork.ozlabs.org/patch/1084064/">https://patchwork.ozlabs.org/patch/1084064/</a>
[2] <a class="moz-txt-link-freetext" href="https://patchwork.ozlabs.org/patch/1084370/">https://patchwork.ozlabs.org/patch/1084370/</a>
---
 include/tst_test.h | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/include/tst_test.h b/include/tst_test.h
index cf2447fe3..69629caff 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -1,18 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015-2016 Cyril Hrubis <a class="moz-txt-link-rfc2396E" href="mailto:chrubis@suse.cz">&lt;chrubis@suse.cz&gt;</a>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <a class="moz-txt-link-rfc2396E" href="http://www.gnu.org/licenses/">&lt;http://www.gnu.org/licenses/&gt;</a>.
+ * Copyright (c) Linux Test Project, 2016-2019
  */
 
 #ifndef TST_TEST_H__
@@ -24,6 +13,9 @@
 
 #include &lt;unistd.h&gt;
 #include &lt;limits.h&gt;
+#include &lt;string.h&gt;
+#include &lt;strings.h&gt;
+#include &lt;stdlib.h&gt;</pre>
    </blockquote>
    <p>Looks better now. :-)</p>
    <p><br>
    </p>
    <p>Regards,</p>
    <p>Zhengwang<br>
    </p>
    <blockquote type="cite"
      cite="mid:20190414130329.14607-1-pvorel@suse.cz">
      <pre class="moz-quote-pre" wrap="">
 
 #include "tst_common.h"
 #include "tst_res_flags.h"
</pre>
    </blockquote>
  </body>
</html>
Cyril Hrubis April 15, 2019, 11:39 a.m. UTC | #2
Hi!
> [1] https://patchwork.ozlabs.org/patch/1084064/
> [2] https://patchwork.ozlabs.org/patch/1084370/
> ---
>  include/tst_test.h | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/include/tst_test.h b/include/tst_test.h
> index cf2447fe3..69629caff 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -1,18 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
>  /*
>   * Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
> - *
> - * This program is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + * Copyright (c) Linux Test Project, 2016-2019
>   */
>  
>  #ifndef TST_TEST_H__
> @@ -24,6 +13,9 @@
>  
>  #include <unistd.h>
>  #include <limits.h>
> +#include <string.h>
> +#include <strings.h>
> +#include <stdlib.h>

Can we please get rid of the deprecated functions from strings.h instead
of simply including it?

>  #include "tst_common.h"
>  #include "tst_res_flags.h"
> -- 
> 2.20.1
>
Petr Vorel April 15, 2019, 12:06 p.m. UTC | #3
Hi Cyril,

> >  #include <unistd.h>
> >  #include <limits.h>
> > +#include <string.h>
> > +#include <strings.h>
> > +#include <stdlib.h>

> Can we please get rid of the deprecated functions from strings.h instead
> of simply including it?
Sure, I'll do it sooner or later :). I guess you're against <stdlib.h> as well
(I found only one file needing it so far), so I'll include just <string.h>
(which usage is massive), ok?

Kind regards,
Petr
Cyril Hrubis April 15, 2019, 12:40 p.m. UTC | #4
Hi!
> > Can we please get rid of the deprecated functions from strings.h instead
> > of simply including it?
> Sure, I'll do it sooner or later :). I guess you're against <stdlib.h> as well
> (I found only one file needing it so far), so I'll include just <string.h>
> (which usage is massive), ok?

Agreed.
Petr Vorel April 15, 2019, 1:51 p.m. UTC | #5
Hi,

> > > Can we please get rid of the deprecated functions from strings.h instead
> > > of simply including it?
> > Sure, I'll do it sooner or later :). I guess you're against <stdlib.h> as well
> > (I found only one file needing it so far), so I'll include just <string.h>
> > (which usage is massive), ok?

> Agreed.
Thanks for your review, merged!

Kind regards,
Petr

Patch
diff mbox series

diff --git a/include/tst_test.h b/include/tst_test.h
index cf2447fe3..69629caff 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -1,18 +1,7 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) Linux Test Project, 2016-2019
  */
 
 #ifndef TST_TEST_H__
@@ -24,6 +13,9 @@ 
 
 #include <unistd.h>
 #include <limits.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
 
 #include "tst_common.h"
 #include "tst_res_flags.h"