drm: add extern C guard for the UAPI headers

Submitted by Emil Velikov on April 21, 2016, 7:41 p.m.

Details

Reviewer None
Submitted April 21, 2016, 7:41 p.m.
Last Updated May 11, 2016, 4:51 a.m.
Revision 1

Cover Letter(s)

Revision 1
      Hi all,

As some of you may know there some subtle distinction between C and C++ 
structs, thus one should wrap/annotate them roughly like below.


...
#if defined(__cplusplus)
extern "C" {
#endif

struct foo {
    int bar;
    ...
};

...

#if defined(__cplusplus)
}
#endif


In order to work around the lack of these users can wrap the header 
inclusion in the same way. For example:


...
#if defined(__cplusplus)
extern "C" {
#endif

#include <i915_drm.h>

#if defined(__cplusplus)
}
#endif


Yet we should avoid this approach, as it might cause issues [1] [2] [3]. 
Thus here is a series which systematically updates all the UAPI headers 
in one go.

I would prefer if we get this merged in one go. Daniel, is it possible 
to go through drm-misc ? The series is already based on it.

Maintainers, does this sound reasonable, can we get a few acks ?


Thanks
Emil

[1] http://developers.redhat.com/blog/2016/02/29/why-cstdlib-is-more-complicated-than-you-might-think/
[2] https://isocpp.org/wiki/faq/mixing-c-and-cpp
[3] http://www.oracle.com/technetwork/articles/servers-storage-dev/mixingcandcpluspluscode-305840.html

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Brian Paul <brianp@vmware.com>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Erik Faye-Lund <kusmabite@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>


Emil Velikov (24):
  drm/amdgpu: add extern C guard for the UAPI header
  drm/armada: add extern C guard for the UAPI header
  drm: add extern C guard for the UAPI headers
  drm/etnaviv: add extern C guard for the UAPI header
  drm/exynos: add extern C guard for the UAPI header
  drm/i810: add extern C guard for the UAPI header
  drm/i915: add extern C guard for the UAPI header
  drm/mga: add extern C guard for the UAPI header
  drm/msm: add extern C guard for the UAPI header
  drm/nouveau: add extern C guard for the UAPI header
  drm/nouveau: drop drm/ prefix from include
  drm/omap: add extern C guard for the UAPI header
  drm/qxl: add extern C guard for the UAPI header
  drm/qxl: remove XXX comment from the UAPI header
  drm/r128: add extern C guard for the UAPI header
  drm/radeon: add extern C guard for the UAPI header
  drm/savage: add extern C guard for the UAPI header
  drm/sis: add extern C guard for the UAPI header
  drm/sis: add missing include drm.h for the UAPI header
  drm/tegra: add extern C guard for the UAPI header
  drm/vc4: add extern C guard for the UAPI header
  drm/via: add extern C guard for the UAPI header
  drm/virgl: add extern C guard for the UAPI header
  drm/vmwgfx: add extern C guard for the UAPI header

 include/uapi/drm/amdgpu_drm.h  |  8 ++++++++
 include/uapi/drm/armada_drm.h  |  8 ++++++++
 include/uapi/drm/drm.h         | 16 ++++++++++++++++
 include/uapi/drm/drm_fourcc.h  |  8 ++++++++
 include/uapi/drm/drm_mode.h    |  8 ++++++++
 include/uapi/drm/drm_sarea.h   |  8 ++++++++
 include/uapi/drm/etnaviv_drm.h |  8 ++++++++
 include/uapi/drm/exynos_drm.h  |  8 ++++++++
 include/uapi/drm/i810_drm.h    |  8 ++++++++
 include/uapi/drm/i915_drm.h    |  8 ++++++++
 include/uapi/drm/mga_drm.h     |  8 ++++++++
 include/uapi/drm/msm_drm.h     |  8 ++++++++
 include/uapi/drm/nouveau_drm.h | 10 +++++++++-
 include/uapi/drm/omap_drm.h    |  8 ++++++++
 include/uapi/drm/qxl_drm.h     |  9 ++++++++-
 include/uapi/drm/r128_drm.h    |  8 ++++++++
 include/uapi/drm/radeon_drm.h  |  8 ++++++++
 include/uapi/drm/savage_drm.h  |  8 ++++++++
 include/uapi/drm/sis_drm.h     | 10 ++++++++++
 include/uapi/drm/tegra_drm.h   |  8 ++++++++
 include/uapi/drm/vc4_drm.h     |  8 ++++++++
 include/uapi/drm/via_drm.h     |  8 ++++++++
 include/uapi/drm/virtgpu_drm.h |  8 ++++++++
 include/uapi/drm/vmwgfx_drm.h  |  9 +++++++++
 24 files changed, 204 insertions(+), 2 deletions(-)
    

Revisions

Patches download mbox

# Name Submitter State A F R T
[01/24] drm/amdgpu: add extern C guard for the UAPI header Emil Velikov New
[02/24] drm/armada: add extern C guard for the UAPI header Emil Velikov New
[03/24] drm: add extern C guard for the UAPI headers Emil Velikov New
[04/24] drm/etnaviv: add extern C guard for the UAPI header Emil Velikov New
[05/24] drm/exynos: add extern C guard for the UAPI header Emil Velikov New
[06/24] drm/i810: add extern C guard for the UAPI header Emil Velikov New
[07/24] drm/i915: add extern C guard for the UAPI header Emil Velikov New
[08/24] drm/mga: add extern C guard for the UAPI header Emil Velikov New
[09/24] drm/msm: add extern C guard for the UAPI header Emil Velikov New
[10/24] drm/nouveau: add extern C guard for the UAPI header Emil Velikov New
[11/24] drm/nouveau: drop drm/ prefix from include Emil Velikov New
[12/24] drm/omap: add extern C guard for the UAPI header Emil Velikov New
[13/24] drm/qxl: add extern C guard for the UAPI header Emil Velikov New
[14/24] drm/qxl: remove XXX comment from the UAPI header Emil Velikov New
[15/24] drm/r128: add extern C guard for the UAPI header Emil Velikov New
[16/24] drm/radeon: add extern C guard for the UAPI header Emil Velikov New
[17/24] drm/savage: add extern C guard for the UAPI header Emil Velikov New
[18/24] drm/sis: add extern C guard for the UAPI header Emil Velikov New
[19/24] drm/sis: add missing include drm.h for the UAPI header Emil Velikov New
[20/24] drm/tegra: add extern C guard for the UAPI header Emil Velikov New
[21/24] drm/vc4: add extern C guard for the UAPI header Emil Velikov New
[22/24] drm/via: add extern C guard for the UAPI header Emil Velikov New
[23/24] drm/virgl: add extern C guard for the UAPI header Emil Velikov New
[24/24] drm/vmwgfx: add extern C guard for the UAPI header Emil Velikov New