<div dir="ltr"><div dir="ltr"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 2, 2021 at 4:57 PM Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com">emil.l.velikov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, 2 Feb 2021 at 23:25, James Park <<a href="mailto:james.park@lagfreegames.com" target="_blank">james.park@lagfreegames.com</a>> wrote:<br>
><br>
> On Tue, Feb 2, 2021 at 2:47 PM Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>> wrote:<br>
> ><br>
> > Currently, the drm_fourcc.h header depends on drm.h for __u32 and __u64.<br>
> > At the same time drm.h pulls a lot of unneeded symbols.<br>
> ><br>
> > Add new guard DRM_FOURCC_STANDALONE, which when set will use local<br>
> > declaration of said symbols.<br>
> ><br>
> > When used on linux - this is a trivial but only when building in strict c99<br>
> > mode. One is welcome to ignore the warning, silence it or use c11. If neither<br>
> > of the three is an option, then do _not_ set the new guard.<br>
> ><br>
> > Cc: James Park <<a href="mailto:james.park@lagfreegames.com" target="_blank">james.park@lagfreegames.com</a>><br>
> > Cc: Pekka Paalanen <<a href="mailto:pekka.paalanen@collabora.com" target="_blank">pekka.paalanen@collabora.com</a>><br>
> > Cc: Simon Ser <<a href="mailto:contact@emersion.fr" target="_blank">contact@emersion.fr</a>><br>
> > Signed-off-by: Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>><br>
> > ---<br>
> > As mentioned before - there's little point in having yet another header<br>
> > since keeping those in sync has been a PITA in the past.<br>
> > ---<br>
> > include/uapi/drm/drm_fourcc.h | 19 +++++++++++++++++++<br>
> > 1 file changed, 19 insertions(+)<br>
> ><br>
> > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h<br>
> > index 6f0628eb13a6..c1522902f6c9 100644<br>
> > --- a/include/uapi/drm/drm_fourcc.h<br>
> > +++ b/include/uapi/drm/drm_fourcc.h<br>
> > @@ -24,7 +24,26 @@<br>
> > #ifndef DRM_FOURCC_H<br>
> > #define DRM_FOURCC_H<br>
> ><br>
> > +/*<br>
> > + * Define DRM_FOURCC_STANDALONE you're interested only FOURCC and do not want<br>
> > + * to pull drm.h into your application.<br>
> > + */<br>
> > +#ifdef DRM_FOURCC_STANDALONE<br>
> > +#if defined(__linux__)<br>
> > +<br>
> > +#include <linux/types.h><br>
> > +<br>
> > +#else /* One of the BSDs */<br>
> > +<br>
> > +#include <stdint.h><br>
> > +typedef uint32_t __u32;<br>
> > +typedef uint64_t __u64;<br>
> > +<br>
> > +#endif /* __linux __ */<br>
> > +<br>
> > +#else<br>
> > #include "drm.h"<br>
> > +#endif /* DRM_FOURCC_STANDALONE */<br>
> ><br>
> > #if defined(__cplusplus)<br>
> > extern "C" {<br>
> > --<br>
> > 2.30.0<br>
> ><br>
><br>
> One of my earlier solutions similarly would have forced people to deal<br>
> with duplicate typedefs, and we arrived at the current solution<br>
> because we didn't want to burden anyone with that.<br>
<br>
As summed in the commit message the burden is only applicable when all<br>
of the following are set:<br>
- non-linux<br>
- force DRM_FOURCC_STANDALONE<br>
- c99 -pedantic<br>
<br>
Even then, we're talking about a compilation warning. So yeah - let's<br>
keep things short and sweet.<br>
<br>
Side note: AFAICT MSVC will not trigger a warning so your logs should be clean.<br>
<br>
-Emil<br></blockquote><div><br></div><div>I'm having trouble reading your commit message, this sentence in particular: "When used on linux - this is a trivial but only when building in strict c99 mode."</div><div><br></div><div>
This asymmetric copy/paste grosses me out so much. I don't think a patch like this should be opinionated about someone's build settings. Am I alone? Doesn't this bother anyone else?</div><div><br></div><div>- James</div></div></div>