public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] replace inline with static inline for gcc 5.x
@ 2015-09-14 10:11 kai.kang
  2015-09-15  7:40 ` Kang Kai
  0 siblings, 1 reply; 4+ messages in thread
From: kai.kang @ 2015-09-14 10:11 UTC (permalink / raw)
  To: ltp

From: Kai Kang <kai.kang@windriver.com>

gcc 5.x defaults to -std=gnu11 instead of -std=gnu89 which causes
semantics for inline functions changes.

GNU89 inline: Same as C99 extern inline.

So the standalone 'inline' causes error such as:

git/testcases/kernel/syscalls/kill/kill10.c:355: undefined reference to `k_sigaction'

Replace inline with static inline to fix this issue.

Ref:
https://gcc.gnu.org/gcc-5/porting_to.html

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 testcases/kernel/controllers/libcontrollers/libcontrollers.c | 2 +-
 testcases/kernel/syscalls/kill/kill10.c                      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.c b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
index 844c5bc..75766fc 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.c
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
@@ -158,7 +158,7 @@ int read_file(char *filepath, int action, unsigned int *value)
  * Prints error message and returns -1
  */
 
-inline void error_function(char *msg1, char *msg2)
+static inline void error_function(char *msg1, char *msg2)
 {
 	fprintf(stdout, "ERROR: %s ", msg1);
 	fprintf(stdout, "%s\n", msg2);
diff --git a/testcases/kernel/syscalls/kill/kill10.c b/testcases/kernel/syscalls/kill/kill10.c
index 982d9da..0c51a91 100644
--- a/testcases/kernel/syscalls/kill/kill10.c
+++ b/testcases/kernel/syscalls/kill/kill10.c
@@ -185,7 +185,7 @@ int child_checklist_total = 0;
 int checklist_cmp(const void *a, const void *b);
 void checklist_reset(int bit);
 
-inline int k_sigaction(int sig, struct sigaction *sa, struct sigaction *osa);
+static inline int k_sigaction(int sig, struct sigaction *sa, struct sigaction *osa);
 
 char *TCID = "kill10";
 int TST_TOTAL = 1;
-- 
2.4.1


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

* [LTP] [PATCH] replace inline with static inline for gcc 5.x
  2015-09-14 10:11 [LTP] [PATCH] replace inline with static inline for gcc 5.x kai.kang
@ 2015-09-15  7:40 ` Kang Kai
  0 siblings, 0 replies; 4+ messages in thread
From: Kang Kai @ 2015-09-15  7:40 UTC (permalink / raw)
  To: ltp

Please ignore this patch, V2 will be sent.

Sorry for inconvenience.

--Kai

On 2015?09?14? 18:11, kai.kang@windriver.com wrote:
> From: Kai Kang <kai.kang@windriver.com>
>
> gcc 5.x defaults to -std=gnu11 instead of -std=gnu89 which causes
> semantics for inline functions changes.
>
> GNU89 inline: Same as C99 extern inline.
>
> So the standalone 'inline' causes error such as:
>
> git/testcases/kernel/syscalls/kill/kill10.c:355: undefined reference to `k_sigaction'
>
> Replace inline with static inline to fix this issue.
>
> Ref:
> https://gcc.gnu.org/gcc-5/porting_to.html
>
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
>   testcases/kernel/controllers/libcontrollers/libcontrollers.c | 2 +-
>   testcases/kernel/syscalls/kill/kill10.c                      | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.c b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
> index 844c5bc..75766fc 100644
> --- a/testcases/kernel/controllers/libcontrollers/libcontrollers.c
> +++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
> @@ -158,7 +158,7 @@ int read_file(char *filepath, int action, unsigned int *value)
>    * Prints error message and returns -1
>    */
>   
> -inline void error_function(char *msg1, char *msg2)
> +static inline void error_function(char *msg1, char *msg2)
>   {
>   	fprintf(stdout, "ERROR: %s ", msg1);
>   	fprintf(stdout, "%s\n", msg2);
> diff --git a/testcases/kernel/syscalls/kill/kill10.c b/testcases/kernel/syscalls/kill/kill10.c
> index 982d9da..0c51a91 100644
> --- a/testcases/kernel/syscalls/kill/kill10.c
> +++ b/testcases/kernel/syscalls/kill/kill10.c
> @@ -185,7 +185,7 @@ int child_checklist_total = 0;
>   int checklist_cmp(const void *a, const void *b);
>   void checklist_reset(int bit);
>   
> -inline int k_sigaction(int sig, struct sigaction *sa, struct sigaction *osa);
> +static inline int k_sigaction(int sig, struct sigaction *sa, struct sigaction *osa);
>   
>   char *TCID = "kill10";
>   int TST_TOTAL = 1;


-- 
Regards,
Neil | Kai Kang


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

* [LTP] [PATCH] replace inline with static inline for gcc 5.x
  2015-09-16 10:13 [LTP] [PATCH] V2: " kai.kang
@ 2015-09-16 10:13 ` kai.kang
  2015-09-16 11:30   ` Cyril Hrubis
  0 siblings, 1 reply; 4+ messages in thread
From: kai.kang @ 2015-09-16 10:13 UTC (permalink / raw)
  To: ltp

From: Kai Kang <kai.kang@windriver.com>

gcc 5.x defaults to -std=gnu11 instead of -std=gnu89 which causes
semantics for inline functions changes.

GNU89 inline: Same as C99 extern inline.

So the standalone 'inline' causes error such as:

git/testcases/kernel/syscalls/kill/kill10.c:355: undefined reference to `k_sigaction'

Replace inline with static inline to fix this issue.

Ref:
https://gcc.gnu.org/gcc-5/porting_to.html

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 testcases/kernel/controllers/libcontrollers/libcontrollers.c | 2 +-
 testcases/kernel/controllers/libcontrollers/libcontrollers.h | 2 +-
 testcases/kernel/syscalls/kill/kill10.c                      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.c b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
index 844c5bc..75766fc 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.c
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
@@ -158,7 +158,7 @@ int read_file(char *filepath, int action, unsigned int *value)
  * Prints error message and returns -1
  */
 
-inline void error_function(char *msg1, char *msg2)
+static inline void error_function(char *msg1, char *msg2)
 {
 	fprintf(stdout, "ERROR: %s ", msg1);
 	fprintf(stdout, "%s\n", msg2);
diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.h b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index bd8e2d8..cdde9f9 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -70,7 +70,7 @@ enum{
 	GET_TASKS
 };
 
-inline void error_function(char *msg1, char *msg2);
+static inline void error_function(char *msg1, char *msg2);
 
 int read_shares_file(char *filepath);
 
diff --git a/testcases/kernel/syscalls/kill/kill10.c b/testcases/kernel/syscalls/kill/kill10.c
index 982d9da..33dbcd3 100644
--- a/testcases/kernel/syscalls/kill/kill10.c
+++ b/testcases/kernel/syscalls/kill/kill10.c
@@ -185,7 +185,7 @@ int child_checklist_total = 0;
 int checklist_cmp(const void *a, const void *b);
 void checklist_reset(int bit);
 
-inline int k_sigaction(int sig, struct sigaction *sa, struct sigaction *osa);
+static inline int k_sigaction(int sig, struct sigaction *sa, struct sigaction *osa);
 
 char *TCID = "kill10";
 int TST_TOTAL = 1;
@@ -756,7 +756,7 @@ void checklist_reset(int bit)
 
 }
 
-inline int k_sigaction(int sig, struct sigaction *sa, struct sigaction *osa)
+static inline int k_sigaction(int sig, struct sigaction *sa, struct sigaction *osa)
 {
 	int ret;
 	if ((ret = sigaction(sig, sa, osa)) == -1) {
-- 
2.4.1


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

* [LTP] [PATCH] replace inline with static inline for gcc 5.x
  2015-09-16 10:13 ` [LTP] [PATCH] " kai.kang
@ 2015-09-16 11:30   ` Cyril Hrubis
  0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2015-09-16 11:30 UTC (permalink / raw)
  To: ltp

Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

end of thread, other threads:[~2015-09-16 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14 10:11 [LTP] [PATCH] replace inline with static inline for gcc 5.x kai.kang
2015-09-15  7:40 ` Kang Kai
  -- strict thread matches above, loose matches on Subject: below --
2015-09-16 10:13 [LTP] [PATCH] V2: " kai.kang
2015-09-16 10:13 ` [LTP] [PATCH] " kai.kang
2015-09-16 11:30   ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox