tst_test.h: Include common headers to fix missing function declaration
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.
---
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(-)
include/tst_test.h +5 -13
@@ -1,18 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2015-2016 Cyril Hrubis <[email protected]> -* -* 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"
Signature · 1 line
2.20.1
PATCH 1/1 tst_test.h: Include common headers to fix missing function declaration
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
Quoted 53 lines
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 <[email protected]>Signed-off-by Petr Vorel <[email protected]>---
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(-)include/tst_test.h +2
-13@@ -1,18 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2015-2016 Cyril Hrubis <[email protected]> -* -* 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__
include/tst_test.h line 18
Quoted 6 lines
include/tst_test.h +3
-0@@ -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_test.h line 21
Quoted 3 lines
include/tst_test.h +0
-0#include "tst_common.h" #include "tst_res_flags.h"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190415/eb6df481/attachment.html>
PATCH 1/1 tst_test.h: Include common headers to fix missing function declaration
In reply to Petr VorelHi!
Quoted 32 lines
[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(-)include/tst_test.h +2
-13@@ -1,18 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2015-2016 Cyril Hrubis <[email protected]> -* -* 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__
include/tst_test.h line 18
Quoted 6 lines
include/tst_test.h +3
-0@@ -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?
Quoted 5 lines
include/tst_test.h +0
-0#include "tst_common.h" #include "tst_res_flags.h" Signature · 1 line
2.20.1
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 tst_test.h: Include common headers to fix missing function declaration
Hi Cyril,
Quoted 8 lines
include/tst_test.h line 18
Quoted 5 lines
#include <
unistd.h>
#include <limits.h>include/tst_test.h +3
-0+#include <string.h> +#include <strings.h> +#include <stdlib.h> Can we please get rid of the deprecated functions from
strings.hinstead 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
PATCH 1/1 tst_test.h: Include common headers to fix missing function declaration
Hi!
Quoted 5 lines
Quoted 2 lines
Can we please get rid of the deprecated functions from
strings.hinstead 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.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 tst_test.h: Include common headers to fix missing function declaration
Hi,
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Can we please get rid of the deprecated functions from
strings.hinstead 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