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

./pyconfig.h:1438:0: warning: "_GNU_SOURCE" redefined [enabled by default] #74980

Closed
segevfiner mannequin opened this issue Jun 28, 2017 · 7 comments
Closed

./pyconfig.h:1438:0: warning: "_GNU_SOURCE" redefined [enabled by default] #74980

segevfiner mannequin opened this issue Jun 28, 2017 · 7 comments
Assignees
Labels
3.7 build The build process and cross-build

Comments

@segevfiner
Copy link
Mannequin

segevfiner mannequin commented Jun 28, 2017

BPO 30797
Nosy @vstinner, @ned-deily, @segevfiner
PRs
  • bpo-30797, bpo-30694: Avoid _GNU_SOURCE redefined warning in xmlparse.c #2615
  • bpo-30797: Avoid _GNU_SOURCE redefined warning in xmlparse.c #2670
  • [3.5] bpo-30797: Avoid _GNU_SOURCE redefined warning in xmlparse.c (GH-2670) #2671
  • [2.7] bpo-30797: Avoid _GNU_SOURCE redefined warning in xmlparse.c (GH-2670) #2672
  • 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 = 'https://github.com/vstinner'
    closed_at = <Date 2017-07-16.08:55:23.402>
    created_at = <Date 2017-06-28.22:24:05.887>
    labels = ['build', '3.7']
    title = './pyconfig.h:1438:0: warning: "_GNU_SOURCE" redefined [enabled by default]'
    updated_at = <Date 2017-07-16.08:55:23.401>
    user = 'https://github.com/segevfiner'

    bugs.python.org fields:

    activity = <Date 2017-07-16.08:55:23.401>
    actor = 'ned.deily'
    assignee = 'vstinner'
    closed = True
    closed_date = <Date 2017-07-16.08:55:23.402>
    closer = 'ned.deily'
    components = ['Build']
    creation = <Date 2017-06-28.22:24:05.887>
    creator = 'Segev Finer'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30797
    keywords = []
    message_count = 7.0
    messages = ['297238', '297860', '297861', '297871', '297931', '298185', '298236']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'ned.deily', 'Segev Finer']
    pr_nums = ['2615', '2670', '2671', '2672']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue30797'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @segevfiner
    Copy link
    Mannequin Author

    segevfiner mannequin commented Jun 28, 2017

    This is caused by _GNU_SOURCE being defined here:

    AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
    , But also getting defined by AC_USE_SYSTEM_EXTENSIONS (
    AC_USE_SYSTEM_EXTENSIONS
    ).

    AC_USE_SYSTEM_EXTENSIONS does use an #ifndef but Python's AC_DEFINE seems to be getting order after it.

    @segevfiner segevfiner mannequin added build The build process and cross-build 3.7 labels Jun 28, 2017
    @ned-deily
    Copy link
    Member

    ned-deily commented Jul 7, 2017

    New changeset 05b72ed by Ned Deily in branch '3.6':
    bpo-30797, bpo-30694: Avoid _GNU_SOURCE redefined warning in xmlparse.c (bpo-2615)
    05b72ed

    @ned-deily
    Copy link
    Member

    ned-deily commented Jul 7, 2017

    Thanks for the report. This warning is currently visible on many/all of the buildbots on all branches. The conflict is caused by the upgrade of the bundled to libexpat to version 2.2.1 (bpo-30694). 2.2.1 introduced a define of _GNU_SOURCE into Modules/expat/xmlparse.c. The definition in xmlparse is simply:

    #define _GNU_SOURCE

    But Python, in pyconfig.h, which ./configure generates from pyconfig.h.in, may already have defined _GNU_SOURCE thusly:

    #define _GNU_SOURCE 1

    pyconfig.h gets included into our copy of Modules/expat/expat_config.h which is included later in xmlparse.c causing the compile warning.

    The simplest way to avoid the warning is to just change the definition in xmlparse.c to match that in pyconfig.h; the compilers don't complain if the definition is identical. I have now merged that fix into the 3.6 branch so builders of 3.6.2 won't see the warning. I will leave this open for @Haypo to review and to handle merging into the other branches affected by bpo-30694 (master, 3.5, 2.7, 3.4, 3.3).

    @ned-deily ned-deily removed the build The build process and cross-build label Jul 7, 2017
    @ned-deily
    Copy link
    Member

    ned-deily commented Jul 7, 2017

    One more thing: building with a recent gcc on Linux:
    $ gcc --version
    gcc (Debian 6.3.0-18) 6.3.0 20170516

    also gives an "unused but set variable" warning.

    ./Modules/expat/xmlparse.c: In function ‘gather_time_entropy’:
    ./Modules/expat/xmlparse.c:780:7: warning: variable ‘gettimeofday_res’ set but not used [-Wunused-but-set-variable]
       int gettimeofday_res;
           ^~~~~~~~~~~~~~~~

    Since I didn't see it in time, I didn't try to fix this for 3.6.2 but it would be best to silence it going forward.

    @ned-deily
    Copy link
    Member

    ned-deily commented Jul 8, 2017

    New changeset bdabd76 by Ned Deily in branch '3.6':
    bpo-30797, bpo-30694: Avoid _GNU_SOURCE redefined warning in xmlparse.c (bpo-2615)
    bdabd76

    @vstinner
    Copy link
    Member

    vstinner commented Jul 11, 2017

    New changeset 884c4ca by Victor Stinner (Segev Finer) in branch '2.7':
    [2.7] bpo-30797: Avoid _GNU_SOURCE redefined warning in xmlparse.c (GH-2670) (bpo-2672)
    884c4ca

    @segevfiner
    Copy link
    Mannequin Author

    segevfiner mannequin commented Jul 12, 2017

    The fix is now in 3.5-3.7 and 2.7, unless you intend to also back port to 3.4 and 3.3, this can be closed.

    @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 build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants