Skip to contentSkip to conversation

xf86drmMode.h: inline -> __inline for use with gcc -std=c89 -pedantic

PATCH Applied Daniel Kurtz 3 participants 7 messages Mar 25, 2015 – Apr 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xf86drmMode.h: inline -> __inline for use with gcc -std=c89 -pedantic

Unfortunately, there are some users of libdrm installed headers that like to be built with -std=c89 -pedantic, which does not like "inline".

However, __inline works.

---
 xf86drmMode.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xf86drmMode.h +1 -1
index 856a6bb..2d30184 100644
@@ -240,7 +240,7 @@ typedef struct _drmModeProperty {
 	uint32_t *blob_ids; /* store the blob IDs */
 } drmModePropertyRes, *drmModePropertyPtr;
 
-static inline int drm_property_type_is(drmModePropertyPtr property,
+static __inline int drm_property_type_is(drmModePropertyPtr property,
 		uint32_t type)
 {
 	/* instanceof for props.. handles extended type vs original types: */
Signature · 6 lines
2.2.0.rc0.207.ga3a616c

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Hi Daniel,

Quoted 16 lines · Daniel Kurtz

Unfortunately, there are some users of libdrm installed headers that like to be built with -std=c89 -pedantic, which does not like "inline".

However, __inline works.

---
 xf86drmMode.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xf86drmMode.h +0 -0
index 856a6bb..2d30184 100644

xf86drmMode.h typedef struct _drmModeProperty { · line 243

Quoted 5 lines
xf86drmMode.h +1 -1
@@ -240,7 +240,7 @@ typedef struct _drmModeProperty {
 	uint32_t *blob_ids; /* store the blob IDs */
 } drmModePropertyRes, *drmModePropertyPtr;
 
-static inline int drm_property_type_is(drmModePropertyPtr property,
+static __inline int drm_property_type_is(drmModePropertyPtr property,

Can you share the name of those users ?

From a quick look clang and gcc are ok with this change, although some versions of the Sun compiler are not. Considering that most programs try to use c99 and later, might I suggest that you add a trivial wrapper in your program ? Something along the lines of

#ifndef inline
#define inline __inline
#endif

-Emil

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Hi Emil,

Quoted 27 lines · Emil Velikov

Hi Daniel,

Quoted 16 lines · Daniel Kurtz

Unfortunately, there are some users of libdrm installed headers that like to be built with -std=c89 -pedantic, which does not like "inline".

However, __inline works.

---
 xf86drmMode.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xf86drmMode.h +0 -0
index 856a6bb..2d30184 100644

xf86drmMode.h typedef struct _drmModeProperty { · line 243

Quoted 5 lines
xf86drmMode.h +1 -1
@@ -240,7 +240,7 @@ typedef struct _drmModeProperty {
      uint32_t *blob_ids; /* store the blob IDs */
 } drmModePropertyRes, *drmModePropertyPtr;
 
-static inline int drm_property_type_is(drmModePropertyPtr property,
+static __inline int drm_property_type_is(drmModePropertyPtr property,

Can you share the name of those users ?

Quoted 8 lines

From a quick look clang and gcc are ok with this change, although some versions of the Sun compiler are not. Considering that most programs try to use c99 and later, might I suggest that you add a trivial wrapper in your program ? Something along the lines of

#ifndef inline
#define inline __inline
#endif

It isn't a program, its a third party EGL/GLES driver, so, no I can't really do this easily.

Alternatively can we:
(1) move the wrapper to xf86drmMode.h itself, or
(2) move this inline helper function out of xf86drmMode.h and into
the two libdrm tests that use it (or a shared test helper .h [0])
(3) remove the inline and make drm_property_type_is a non-inline
function in xf86drmMode.c

[0] I think Thierry already has a patch set that rearranges the tests to use some shared headers. Perhaps this will work well once his set lands.

-Dan

Quoted 4 lines

-Emil

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 35 lines · Daniel Kurtz

Hi Emil,

Quoted 32 lines · Emil Velikov

Hi Daniel,

Quoted 16 lines · Daniel Kurtz

Unfortunately, there are some users of libdrm installed headers that like to be built with -std=c89 -pedantic, which does not like "inline".

However, __inline works.

---
 xf86drmMode.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xf86drmMode.h +0 -0
index 856a6bb..2d30184 100644

xf86drmMode.h typedef struct _drmModeProperty { · line 243

Quoted 5 lines
xf86drmMode.h +1 -1
@@ -240,7 +240,7 @@ typedef struct _drmModeProperty {
      uint32_t *blob_ids; /* store the blob IDs */
 } drmModePropertyRes, *drmModePropertyPtr;
 
-static inline int drm_property_type_is(drmModePropertyPtr property,
+static __inline int drm_property_type_is(drmModePropertyPtr property,

Can you share the name of those users ?

From a quick look clang and gcc are ok with this change, although some versions of the Sun compiler are not. Considering that most programs try to use c99 and later, might I suggest that you add a trivial wrapper in your program ? Something along the lines of

Quoted 7 lines
Quoted 3 lines

#ifndef inline
#define inline __inline
#endif

It isn't a program, its a third party EGL/GLES driver, so, no I can't really do this easily.

I see... due to various agreements you're not allowed to make any changes. Be that to the code or the build (-Dinline...).

Quoted 11 lines

Alternatively can we:
(1) move the wrapper to xf86drmMode.h itself, or
(2) move this inline helper function out of xf86drmMode.h and into
the two libdrm tests that use it (or a shared test helper .h [0])
(3) remove the inline and make drm_property_type_is a non-inline
function in xf86drmMode.c

[0] I think Thierry already has a patch set that rearranges the tests to use some shared headers. Perhaps this will work well once his set lands.

Fwiw I would opt for 1 or 3 (leaning towards 1), as 2 might lead to:
- Everyone coming up with their own "helper", or
- Ignoring DRM_MODE_PROP_EXTENDED_TYPE checking
drmModePropertyPtr::flags, thus causing all sorts of chaos.

Randy, Niveditha, Stuart,

Does the compiler(s) used to build libdrm and friends support __inline ?

Thanks,
Emil

P.S. [0] Seems to be missing but I do recall the series :)

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 19 lines
Quoted 9 lines

Alternatively can we:
(1) move the wrapper to xf86drmMode.h itself, or
(2) move this inline helper function out of xf86drmMode.h and into
the two libdrm tests that use it (or a shared test helper .h [0])
(3) remove the inline and make drm_property_type_is a non-inline
function in xf86drmMode.c

Quoted 4 lines

[0] I think Thierry already has a patch set that rearranges the tests to use some shared headers. Perhaps this will work well once his set lands.

Fwiw I would opt for 1 or 3 (leaning towards 1), as 2 might lead to:
- Everyone coming up with their own "helper", or
- Ignoring DRM_MODE_PROP_EXTENDED_TYPE checking drmModePropertyPtr::flags, thus causing all sorts of chaos.

Quoted 3 lines

Randy, Niveditha, Stuart,

Does the compiler(s) used to build libdrm and friends support __inline ?

It should. I can't be 100% sure as there was just recently a new
compiler release, but I would also suspect if this support was broken or dropped, then lots of stuff would break.

Cheers!

	---- Randy

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by
#5 lore raw

On 26/03/15 16:57, [email protected] wrote:
[...]

Quoted 17 lines
Quoted 17 lines
Quoted 11 lines

Alternatively can we:
(1) move the wrapper to xf86drmMode.h itself, or
(2) move this inline helper function out of xf86drmMode.h and into
the two libdrm tests that use it (or a shared test helper .h [0])
(3) remove the inline and make drm_property_type_is a non-inline
function in xf86drmMode.c

[0] I think Thierry already has a patch set that rearranges the tests to use some shared headers. Perhaps this will work well once his set lands.

Fwiw I would opt for 1 or 3 (leaning towards 1), as 2 might lead to:
- Everyone coming up with their own "helper", or
- Ignoring DRM_MODE_PROP_EXTENDED_TYPE checking drmModePropertyPtr::flags, thus causing all sorts of chaos.

Quoted 9 lines
Quoted 3 lines

Randy, Niveditha, Stuart,

Does the compiler(s) used to build libdrm and friends support __inline ?

It should. I can't be 100% sure as there was just recently a new
compiler release, but I would also suspect if this support was broken or dropped, then lots of stuff would break.

Thanks for the information Randy.

Daniel
Based Randy's input we can go with the original solution :-) Will leave the patch around for a week or so, for others to comment, before pushing it. If someone else beats me to it, feel free to add:

Cheers,
Emil

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel