Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler warning in Modules/posixmodule.c #74199

Closed
mlouielu mannequin opened this issue Apr 7, 2017 · 3 comments
Closed

Compiler warning in Modules/posixmodule.c #74199

mlouielu mannequin opened this issue Apr 7, 2017 · 3 comments
Labels
3.7 (EOL) end of life build The build process and cross-build extension-modules C modules in the Modules dir

Comments

@mlouielu
Copy link
Mannequin

mlouielu mannequin commented Apr 7, 2017

BPO 30013
Nosy @vstinner, @serhiy-storchaka, @mlouielu
PRs
  • bpo-30013: Fix compiler warning in Modules/posixmodule.c #1024
  • Superseder
  • bpo-31343: Include major(), minor(), makedev() from sysmacros
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-10-17.12:05:57.864>
    created_at = <Date 2017-04-07.09:56:44.598>
    labels = ['extension-modules', 'build', '3.7']
    title = 'Compiler warning in Modules/posixmodule.c'
    updated_at = <Date 2017-10-17.12:05:57.863>
    user = 'https://github.com/mlouielu'

    bugs.python.org fields:

    activity = <Date 2017-10-17.12:05:57.863>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-10-17.12:05:57.864>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2017-04-07.09:56:44.598>
    creator = 'louielu'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30013
    keywords = []
    message_count = 3.0
    messages = ['291260', '292308', '304500']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'serhiy.storchaka', 'fweimer', 'louielu']
    pr_nums = ['1024']
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '31343'
    type = 'compile error'
    url = 'https://bugs.python.org/issue30013'
    versions = ['Python 3.7']

    @mlouielu
    Copy link
    Mannequin Author

    mlouielu mannequin commented Apr 7, 2017

    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

    @mlouielu mlouielu mannequin added 3.7 (EOL) end of life extension-modules C modules in the Modules dir build The build process and cross-build labels Apr 7, 2017
    @mlouielu mlouielu mannequin changed the title Compiling warning in Modules/posixmodule.c Compiler warning in Modules/posixmodule.c Apr 7, 2017
    @mlouielu
    Copy link
    Mannequin Author

    mlouielu mannequin commented Apr 26, 2017

    serhiy, haypo, what do you think about this warning's fixed?

    Thanks!

    @serhiy-storchaka
    Copy link
    Member

    Sorry, Louie Lu, this already has been fixed in bpo-31343.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life build The build process and cross-build extension-modules C modules in the Modules dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant