GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — New warnings: ` warning: unused function 'ensure_shared_on_read' [-Wunused-function]` · Issue #116029 · python/cpython

New warnings: warning: unused function 'ensure_shared_on_read' [-Wunused-function] #116029

New issue
Copy link
New issue
Copy link
Closed
Closed
New warnings: warning: unused function 'ensure_shared_on_read' [-Wunused-function]#116029
Copy link
Labels
topic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@Eclips4
Eclips4
opened on Feb 28, 2024
Issue body actions

Bug report

Bug description:

Popped up during the build (./configure --with-pydebug && make -j):

Objects/dictobject.c:1233:1: warning: unused function 'ensure_shared_on_read' [-Wunused-function]
ensure_shared_on_read(PyDictObject *mp)
^
In file included from Objects/obmalloc.c:16:
In file included from Objects/mimalloc/static.c:23:
Objects/mimalloc/alloc.c:77:5: warning: static function 'mi_debug_fill' is used in an inline function with external linkage [-Wstatic-in-inline]
mi_debug_fill(page, block, MI_DEBUG_UNINIT, mi_page_usable_block_size(page));
^
Objects/mimalloc/alloc.c:30:13: note: 'mi_debug_fill' declared here
static void mi_debug_fill(mi_page_t* page, mi_block_t* block, int c, size_t size) {
...
Objects/dictobject.c:5032:9: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
    if (!dictiter_iternext_threadsafe(d, self, &value, NULL) == 0) {
        ^                                                    ~~
Objects/dictobject.c:5032:9: note: add parentheses after the '!' to evaluate the comparison first
    if (!dictiter_iternext_threadsafe(d, self, &value, NULL) == 0) {
        ^
         (                                                       )
Objects/dictobject.c:5032:9: note: add parentheses around left hand side expression to silence this warning
    if (!dictiter_iternext_threadsafe(d, self, &value, NULL) == 0) {
        ^
        (                                                   )
Objects/dictobject.c:5155:9: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
    if (!dictiter_iternext_threadsafe(d, self, NULL, &value) == 0) {
        ^                                                    ~~
Objects/dictobject.c:5155:9: note: add parentheses after the '!' to evaluate the comparison first
    if (!dictiter_iternext_threadsafe(d, self, NULL, &value) == 0) {
        ^
         (                                                       )
Objects/dictobject.c:5155:9: note: add parentheses around left hand side expression to silence this warning
    if (!dictiter_iternext_threadsafe(d, self, NULL, &value) == 0) {
        ^

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

  • gh-116029: Fix unused function warning on macOS #116340

Activity

  1. Eclips4
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Feb 28, 2024
  2. Eclips4
    changed the title [-]New warning: ` warning: unused function 'ensure_shared_on_read' [-Wunused-function`[/-] [+]New warning: ` warning: unused function 'ensure_shared_on_read' [-Wunused-function]`[/+] on Feb 28, 2024
  3. Eclips4
    changed the title [-]New warning: ` warning: unused function 'ensure_shared_on_read' [-Wunused-function]`[/-] [+]New warnings: ` warning: unused function 'ensure_shared_on_read' [-Wunused-function]`[/+] on Feb 28, 2024
  4. colesbury commented on Mar 4, 2024

    @colesbury
    colesbury
    on Mar 4, 2024
    Contributor
    More actions

    I think both of these bugs have been fixed now:

    • gh-115491: Fix Clang compiler warning #116153
    • gh-112075: Remove compiler warning from apple clang #115855
  5. sobolevn
    added
    topic-free-threading
    on Mar 4, 2024
  6. sobolevn commented on Mar 4, 2024

    @sobolevn
    sobolevn
    on Mar 4, 2024
    Member
    More actions

    Since this function looks like this:

    static inline void
    ensure_shared_on_read(PyDictObject *mp)
    {
    #ifdef Py_GIL_DISABLED
        if (!_Py_IsOwnedByCurrentThread((PyObject *)mp) && !IS_DICT_SHARED(mp)) {
            // The first time we access a dict from a non-owning thread we mark it
            // as shared. This ensures that a concurrent resize operation will
            // delay freeing the old keys or values using QSBR, which is necessary
            // to safely allow concurrent reads without locking...
            Py_BEGIN_CRITICAL_SECTION(mp);
            if (!IS_DICT_SHARED(mp)) {
                SET_DICT_SHARED(mp);
            }
            Py_END_CRITICAL_SECTION();
        }
    #endif
    }

    I am going to cc @colesbury

  7. sobolevn commented on Mar 4, 2024

    @sobolevn
    sobolevn
    on Mar 4, 2024
    Member
    More actions

    @colesbury it was fast 😆

    I still see this on the latest main:

    Objects/dictobject.c:1242:1: warning: unused function 'ensure_shared_on_read' [-Wunused-function]
    ensure_shared_on_read(PyDictObject *mp)
    ^
    
    Reacted by Sam Gross
  8. colesbury
    added 2 commits that reference this issue on Mar 4, 2024

    pythongh-116029: Fix unused function warning on macOS

    c380a5a

    gh-116029: Fix unused function warning on macOS (#116340)

    58c7919
  9. adorilson
    added a commit that references this issue on Mar 25, 2024

    pythongh-116029: Fix unused function warning on macOS (python#116340)

    29d6673
  10. diegorusso
    added a commit that references this issue on Apr 17, 2024

    pythongh-116029: Fix unused function warning on macOS (python#116340)

    7f94be9
  11. Eclips4
    closed this as completedon Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.