classification
Title: Include major(), minor(), makedev() from sysmacros
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, fweimer, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-09-04 21:50 by christian.heimes, last changed 2017-10-17 22:02 by fweimer. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3318 merged christian.heimes, 2017-09-04 22:06
PR 3344 merged christian.heimes, 2017-09-05 13:53
PR 3345 merged christian.heimes, 2017-09-05 13:57
Messages (5)
msg301272 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-04 21:50
On Fedora 26, GCC is emitting warnings because we are using minor(), major() and makedev() 
from sys/types.h. The macros should be included from sys/sysmacros.h instead:

./Modules/posixmodule.c: In function ‘os_major_impl’:
./Modules/posixmodule.c:8758: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:8775: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:8793: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);
             ^~~~~~~~~~~~~~~~~~~~~
msg301311 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-05 13:53
New changeset 75b961869a1184895c9d5bf41a57f3c985622662 by Christian Heimes in branch 'master':
bpo-31343: Include sys/sysmacros.h (#3318)
https://github.com/python/cpython/commit/75b961869a1184895c9d5bf41a57f3c985622662
msg301315 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-05 15:08
New changeset ffa7011cb904ee6ad9d4931b073c13d9e1514e6b by Christian Heimes in branch '2.7':
[2.7] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3345)
https://github.com/python/cpython/commit/ffa7011cb904ee6ad9d4931b073c13d9e1514e6b
msg301316 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-05 15:09
New changeset 02854dab6231d726fa2c63d44ab25598988c44f4 by Christian Heimes in branch '3.6':
[3.6] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3344)
https://github.com/python/cpython/commit/02854dab6231d726fa2c63d44ab25598988c44f4
msg304501 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-10-17 12:06
Louie Lu proposed the fix for this issue in issue30013.
History
Date User Action Args
2017-10-17 22:02:24fweimersetnosy: + fweimer
2017-10-17 12:06:54serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg304501
2017-10-17 12:05:57serhiy.storchakalinkissue30013 superseder
2017-09-05 15:09:27christian.heimessetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2017-09-05 15:09:14christian.heimessetmessages: + msg301316
2017-09-05 15:08:47christian.heimessetmessages: + msg301315
2017-09-05 13:57:09christian.heimessetpull_requests: + pull_request3356
2017-09-05 13:53:49christian.heimessetpull_requests: + pull_request3355
2017-09-05 13:53:11christian.heimessetmessages: + msg301311
2017-09-04 22:06:01christian.heimessetpull_requests: + pull_request3344
2017-09-04 21:50:37christian.heimescreate