[New-bugs-announce] [issue30013] Compiling warning in Modules/posixmodule.c

Louie Lu report at bugs.python.org
Fri Apr 7 05:56:44 EDT 2017


New submission from Louie Lu:

Using gcc-6.3.1 20170306 on Linux 4.10.1, it gave the warning:

gcc -pthread -c -Wno-unused-result -Wsign-compare -g -Og -Wall -Wstrict-prototypes    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration   -I. -I./Include    -DPy_BUILD_CORE -o Python/pyctype.o Python/pyctype.c
:./Modules/posixmodule.c: In function ‘os_major_impl’:
./Modules/posixmodule.c:8584:13: 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>.
     return major(device);
             ^~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                       
./Modules/posixmodule.c: In function ‘os_minor_impl’:
./Modules/posixmodule.c:8601:13: warning: In the GNU C Library, "minor" 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 "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>.
     return minor(device);
             ^~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                       
./Modules/posixmodule.c: In function ‘os_makedev_impl’:
./Modules/posixmodule.c:8619:13: warning: In the GNU C Library, "makedev" 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 "makedev", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including <sys/types.h>.
     return makedev(major, minor);
             ^~~~~~~~~~~~~~~~~~~~~          


The problem introduce in glibc 2.25, going to deprecate the definition of 'major', 'minor', and 'makedev' by  sys/types.h. And the autoconf didn't change the behavior of `AC_HEADER_MAJOR`, see:

https://lists.gnu.org/archive/html/autoconf/2016-08/msg00014.html


There is a workaround path for this in libvirt, which take from autoconf patch, see:

https://www.redhat.com/archives/libvir-list/2016-September/msg00459.html

----------
components: Extension Modules
messages: 291260
nosy: louielu
priority: normal
severity: normal
status: open
title: Compiling warning in Modules/posixmodule.c
type: compile error
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30013>
_______________________________________


More information about the New-bugs-announce mailing list