All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm 1/2] xf86drm: add missing include <sys/sysmacros.h>
@ 2017-03-16 13:56 Eric Engestrom
  2017-03-16 13:56 ` [PATCH libdrm 2/2] libkms: " Eric Engestrom
  2017-03-16 15:09 ` [PATCH libdrm 1/2] xf86drm: " Emil Velikov
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Engestrom @ 2017-03-16 13:56 UTC (permalink / raw)
  To: dri-devel

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>.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 xf86drm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xf86drm.c b/xf86drm.c
index 88f86ed5..8f8dfb6e 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -48,6 +48,7 @@
 #include <limits.h>
 #include <signal.h>
 #include <time.h>
+#include <sys/sysmacros.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #define stat_t struct stat
-- 
Cheers,
  Eric

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH libdrm 2/2] libkms: add missing include <sys/sysmacros.h>
  2017-03-16 13:56 [PATCH libdrm 1/2] xf86drm: add missing include <sys/sysmacros.h> Eric Engestrom
@ 2017-03-16 13:56 ` Eric Engestrom
  2017-03-16 15:09 ` [PATCH libdrm 1/2] xf86drm: " Emil Velikov
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Engestrom @ 2017-03-16 13:56 UTC (permalink / raw)
  To: dri-devel

GCC 7 complains about major() and minor():
    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>.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 libkms/linux.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libkms/linux.c b/libkms/linux.c
index 0b50777e..e063e2be 100644
--- a/libkms/linux.c
+++ b/libkms/linux.c
@@ -39,6 +39,7 @@
 #include <xf86drm.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/sysmacros.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #ifdef MAJOR_IN_MKDEV
-- 
Cheers,
  Eric

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH libdrm 1/2] xf86drm: add missing include <sys/sysmacros.h>
  2017-03-16 13:56 [PATCH libdrm 1/2] xf86drm: add missing include <sys/sysmacros.h> Eric Engestrom
  2017-03-16 13:56 ` [PATCH libdrm 2/2] libkms: " Eric Engestrom
@ 2017-03-16 15:09 ` Emil Velikov
  2017-03-16 17:00   ` Eric Engestrom
  1 sibling, 1 reply; 5+ messages in thread
From: Emil Velikov @ 2017-03-16 15:09 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: ML dri-devel

On 16 March 2017 at 13:56, Eric Engestrom <eric.engestrom@imgtec.com> 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 ?
-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH libdrm 1/2] xf86drm: add missing include <sys/sysmacros.h>
  2017-03-16 15:09 ` [PATCH libdrm 1/2] xf86drm: " Emil Velikov
@ 2017-03-16 17:00   ` Eric Engestrom
  2017-03-16 19:05     ` Emil Velikov
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Engestrom @ 2017-03-16 17:00 UTC (permalink / raw)
  To: Emil Velikov; +Cc: ML dri-devel

On Thursday, 2017-03-16 15:09:15 +0000, Emil Velikov wrote:
> On 16 March 2017 at 13:56, Eric Engestrom <eric.engestrom@imgtec.com> 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?

Cheers,
  Eric
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH libdrm 1/2] xf86drm: add missing include <sys/sysmacros.h>
  2017-03-16 17:00   ` Eric Engestrom
@ 2017-03-16 19:05     ` Emil Velikov
  0 siblings, 0 replies; 5+ messages in thread
From: Emil Velikov @ 2017-03-16 19:05 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: ML dri-devel

On 16 March 2017 at 17:00, Eric Engestrom <eric.engestrom@imgtec.com> wrote:
> On Thursday, 2017-03-16 15:09:15 +0000, Emil Velikov wrote:
>> On 16 March 2017 at 13:56, Eric Engestrom <eric.engestrom@imgtec.com> 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-16 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-16 13:56 [PATCH libdrm 1/2] xf86drm: add missing include <sys/sysmacros.h> Eric Engestrom
2017-03-16 13:56 ` [PATCH libdrm 2/2] libkms: " Eric Engestrom
2017-03-16 15:09 ` [PATCH libdrm 1/2] xf86drm: " Emil Velikov
2017-03-16 17:00   ` Eric Engestrom
2017-03-16 19:05     ` Emil Velikov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.