Re: [PATCH libdrm 1/2] xf86drm: add missing include <sys/sysmacros.h>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16 March 2017 at 17:00, Eric Engestrom <eric.engestrom@xxxxxxxxxx> wrote:
> On Thursday, 2017-03-16 15:09:15 +0000, Emil Velikov wrote:
>> On 16 March 2017 at 13:56, Eric Engestrom <eric.engestrom@xxxxxxxxxx> wrote:
>> > GCC 7 complains about major(), minor() and makedev():
>> >     warning: In the GNU C Library, "major" is defined by <sys/sysmacros.h>.
>> >     For historical compatibility, it is currently defined by <sys/types.h> as
>> >     well, but we plan to remove this soon. To use "major", include
>> >     <sys/sysmacros.h> directly. If you did not intend to use a system-defined
>> >     macro "major", you should undefine it after including <sys/types.h>.
>> >
>> This (and 2/2) should be handled by the
>> MAJOR_IN_MKDEV/MAJOR_IN_SYSMACROS blocks.
>>
>> Any ideas why those are not kicking it ?
>
> Didn't know about those, and didn't look closely enough to see them the
> first time around.
>
> From the AC_HEADER_MAJOR doc:
>   If ‘sys/types.h’ does not define major, minor, and makedev, but
>   ‘sys/mkdev.h’ does, define MAJOR_IN_MKDEV; otherwise, if
>   ‘sys/sysmacros.h’ does, define MAJOR_IN_SYSMACROS.
>
> The issue is that <sys/types.h> *does* define it for now, but prints
> a warning if <sys/sysmacros.h> isn't also included.
>
> Given the autoconf macro and #ifdef, it will always work, even once GCC
> does drop the macros from <sys/types.h>, but the current method will
> always result in a warning until then. (And there's no flag to turn the
> warning off either.)
>
> I guess "don't change the code and learn to ignore the wall of warnings"
> is the only course of action?
>
Sigh, I wonder if GCC devs considered the annoyance this will bring
and that some people actually do the "correct" thing :-\

As an alternative we can replace the AC_HEADER_MAJOR + MAJOR_IN_FOO
with AC_CHECK_HEADERS + HAVE....  It [hopefully] will work everywhere
and will squash the annoying warning(s).

-Emil
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux