Skip to contentSkip to conversation

replace inline with static inline for gcc 5.x

PATCH New [email protected] 1 participant 2 messages Sep 14, 2015 – Sep 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 replace inline with static inline for gcc 5.x

From: Kai Kang <[email protected]>

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

---
 testcases/kernel/controllers/libcontrollers/libcontrollers.c | 2 +-
 testcases/kernel/syscalls/kill/kill10.c                      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/controllers/libcontrollers/libcontrollers.c +1 -1
index 844c5bc..75766fc 100644
@@ -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);
testcases/kernel/syscalls/kill/kill10.c +1 -1
index 982d9da..0c51a91 100644
@@ -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;
Signature · 1 line
2.4.1
author
#1 lore raw

PATCH 1/1 replace inline with static inline for gcc 5.x

Please ignore this patch, V2 will be sent.

Sorry for inconvenience.

--Kai

Quoted 48 lines · On 2015?09?14? 18:11, [email protected] wrote:

From: Kai Kang <[email protected]>

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

---
  testcases/kernel/controllers/libcontrollers/libcontrollers.c | 2 +-
  testcases/kernel/syscalls/kill/kill10.c                      | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/controllers/libcontrollers/libcontrollers.c +1 -1
index 844c5bc..75766fc 100644
@@ -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);
testcases/kernel/syscalls/kill/kill10.c +1 -1
index 982d9da..0c51a91 100644
@@ -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;
Signature · 2 lines
Regards,
Neil | Kai Kang