diff mbox series

[libdrm] xf86drm: fix return type for drmIsMaster()

Message ID 20190208150207.25237-1-eric.engestrom@intel.com (mailing list archive)
State New, archived
Headers show
Series [libdrm] xf86drm: fix return type for drmIsMaster() | expand

Commit Message

Eric Engestrom Feb. 8, 2019, 3:02 p.m. UTC
Xserver has struct members named `bool`, which means the last commit
breaks its build with errors like this:

  error: two or more data types in declaration specifiers
  Bool bool;
       ^

Fix this by making it return a 0/1 integer, with the same semantic as
the boolean it was before.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=109587
Fixes: 17dfe3ac93217b43f93b "xf86drm: Add drmIsMaster()"
Cc: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
---
 xf86drm.c | 2 +-
 xf86drm.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Emil Velikov Feb. 8, 2019, 4:50 p.m. UTC | #1
On Fri, 8 Feb 2019 at 16:51, Daniel Stone <daniel@fooishbar.org> wrote:
>
> Hi Eric,
>
> On Fri, 8 Feb 2019 at 15:03, Eric Engestrom <eric.engestrom@intel.com> wrote:
> > Xserver has struct members named `bool`, which means the last commit
> > breaks its build with errors like this:
> >
> >   error: two or more data types in declaration specifiers
> >   Bool bool;
> >        ^
> >
> > Fix this by making it return a 0/1 integer, with the same semantic as
> > the boolean it was before.
>
> Don't you need to drop the stdbool.h include for this to fix compilation?
>
Thanks Eric. With Dan's comment
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

I really wonder if we cannot fix these trivial X nuisances? As-is
every project used has to either work around X mistakes :-(
Wrt libdrm that is fine, yet other projects might be less happy.

Thanks
-Emil
Daniel Stone Feb. 8, 2019, 4:51 p.m. UTC | #2
Hi Eric,

On Fri, 8 Feb 2019 at 15:03, Eric Engestrom <eric.engestrom@intel.com> wrote:
> Xserver has struct members named `bool`, which means the last commit
> breaks its build with errors like this:
>
>   error: two or more data types in declaration specifiers
>   Bool bool;
>        ^
>
> Fix this by making it return a 0/1 integer, with the same semantic as
> the boolean it was before.

Don't you need to drop the stdbool.h include for this to fix compilation?

Cheers,
Daniel
Eric Engestrom Feb. 8, 2019, 6:50 p.m. UTC | #3
On Friday, 2019-02-08 16:50:44 +0000, Emil Velikov wrote:
> On Fri, 8 Feb 2019 at 16:51, Daniel Stone <daniel@fooishbar.org> wrote:
> >
> > Hi Eric,
> >
> > On Fri, 8 Feb 2019 at 15:03, Eric Engestrom <eric.engestrom@intel.com> wrote:
> > > Xserver has struct members named `bool`, which means the last commit
> > > breaks its build with errors like this:
> > >
> > >   error: two or more data types in declaration specifiers
> > >   Bool bool;
> > >        ^
> > >
> > > Fix this by making it return a 0/1 integer, with the same semantic as
> > > the boolean it was before.
> >
> > Don't you need to drop the stdbool.h include for this to fix compilation?

Ahem... /me looks for his brown paper bag :]

> >
> Thanks Eric. With Dan's comment
> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
> 
> I really wonder if we cannot fix these trivial X nuisances? As-is
> every project used has to either work around X mistakes :-(
> Wrt libdrm that is fine, yet other projects might be less happy.

Agreed :/

The issue is that you still won't be able to have bools in libdrm,
because a new libdrm might be used with an old xserver...

> 
> Thanks
> -Emil
diff mbox series

Patch

diff --git a/xf86drm.c b/xf86drm.c
index 54695fcd5d1967574b00..05331c6d15bdd15b4be5 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2724,7 +2724,7 @@  drm_public int drmDropMaster(int fd)
         return drmIoctl(fd, DRM_IOCTL_DROP_MASTER, NULL);
 }
 
-drm_public bool drmIsMaster(int fd)
+drm_public int drmIsMaster(int fd)
 {
         /* Detect master by attempting something that requires master.
          *
diff --git a/xf86drm.h b/xf86drm.h
index b31ec9b5673a717bd6f3..9666a12c36bf28996157 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -746,7 +746,7 @@  extern void drmMsg(const char *format, ...) DRM_PRINTFLIKE(1, 2);
 
 extern int drmSetMaster(int fd);
 extern int drmDropMaster(int fd);
-extern bool drmIsMaster(int fd);
+extern int drmIsMaster(int fd);
 
 #define DRM_EVENT_CONTEXT_VERSION 4