gcc 5.2.0: fix linking issues caused by inline keyword 63/47663/2 accepted/tizen/common/20170102.152246 accepted/tizen/ivi/20170102.223051 accepted/tizen/mobile/20170102.223000 accepted/tizen/tv/20170102.223016 accepted/tizen/wearable/20170102.223034 submit/tizen/20170102.072028
authorPatrick Ohly <patrick.ohly@intel.com>
Mon, 7 Sep 2015 18:40:49 +0000 (20:40 +0200)
committerSunmin Lee <sunm.lee@samsung.com>
Wed, 6 Jul 2016 06:43:54 +0000 (23:43 -0700)
Under gcc 5.2.0, using the inline keyword on function declarations in
a header file without also providing the implementation leads first to
warnings, then during linking of a library using the functions to an
error:

 In file included from shared-api.c:48:0:
 init.h:27:13: warning: inline function 'initialize' declared but never defined
  inline void initialize(struct tzplatform_context *context);
 ...
 init.c:426:29: warning: 'metafilepath' is static but used in inline function 'initialize' which is not static
                  keyname(i), metafilepath);
 ...
 ./.libs/libtzplatform-config-2.0.so: undefined reference to `initialize'
 ./.libs/libtzplatform-config-2.0.so: undefined reference to `hashid'
 ./.libs/libtzplatform-config-2.0.so: undefined reference to `get_uid'
 collect2: error: ld returned 1 exit status
 Makefile:573: recipe for target 'tzplatform-get' failed

This kind of inlining cannot have worked before; probably older gcc
simply ignored the keyword (untested). Therefore removing the keyword
is the quickest way to get the code to compile again as before. A more
intrusive change would be needed if inlining is really important.

Change-Id: Ic88350071ddb2df6bf571ed60b3cf6d443aba742
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
src/context.c
src/context.h
src/hashing.c
src/hashing.h
src/init.c
src/init.h

index 4b1e49d..85c417b 100644 (file)
@@ -42,7 +42,7 @@
 #include "context.h"
 
 
-inline uid_t get_uid(struct tzplatform_context *context)
+uid_t get_uid(struct tzplatform_context *context)
 {
     uid_t result;
 
@@ -54,7 +54,7 @@ inline uid_t get_uid(struct tzplatform_context *context)
 }
 
 #if _FOREIGN_HAS_(EUID)
-inline uid_t get_euid(struct tzplatform_context *context)
+uid_t get_euid(struct tzplatform_context *context)
 {
     uid_t result;
 
@@ -67,7 +67,7 @@ inline uid_t get_euid(struct tzplatform_context *context)
 #endif
 
 #if _FOREIGN_HAS_(GID)
-inline gid_t get_gid(struct tzplatform_context *context)
+gid_t get_gid(struct tzplatform_context *context)
 {
     return getgid();
 }
index 2612f19..9353168 100644 (file)
@@ -46,14 +46,14 @@ struct tzplatform_context {
     const char *values[_TZPLATFORM_VARIABLES_COUNT_];
 };
 
-inline uid_t get_uid(struct tzplatform_context *context);
+uid_t get_uid(struct tzplatform_context *context);
 
 #if _FOREIGN_HAS_(EUID)
-inline uid_t get_euid(struct tzplatform_context *context);
+uid_t get_euid(struct tzplatform_context *context);
 #endif
 
 #if _FOREIGN_HAS_(GID)
-inline gid_t get_gid(struct tzplatform_context *context);
+gid_t get_gid(struct tzplatform_context *context);
 #endif
 
 #endif
index c22b4c0..e74464d 100644 (file)
@@ -35,7 +35,7 @@
 
 static const char *var_names[_TZPLATFORM_VARIABLES_COUNT_];
 
-inline int hashid(const char *text, unsigned int len)
+int hashid(const char *text, unsigned int len)
 {
     const struct varassoc *vara = hashvar(text, len);
     return vara ? vara->id : -1;
index 5ce816e..f20f3e9 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef HASHING_H
 #define HASHING_H
 
-inline int hashid(const char *text, unsigned int len);
+int hashid(const char *text, unsigned int len);
 const char *keyname(int id);
 
 #endif
index 76868cc..4edf520 100644 (file)
@@ -363,7 +363,7 @@ static int putcb( struct parsing *parsing,
 }
 
 /* initialize the environment */
-inline void initialize(struct tzplatform_context *context)
+void initialize(struct tzplatform_context *context)
 {
     struct buffer buffer;
     struct parsing parsing;
index 446431c..6ed0f15 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef INIT_H
 #define INIT_H
 
-inline void initialize(struct tzplatform_context *context);
+void initialize(struct tzplatform_context *context);
 
 #endif