Suppress some annoying deprecation warnings (OSX) #9284

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2016/12/osx_warnings changing 1 files +1 −0
  1. jonasschnelli commented at 1:02 PM on December 5, 2016: contributor

    No description provided.

  2. [OSX] Suppress some annoying OSX deprecation warnings 2ab8fbbd5b
  3. jonasschnelli added the label Build system on Dec 5, 2016
  4. jonasschnelli added the label MacOSX on Dec 5, 2016
  5. paveljanik commented at 1:48 PM on December 5, 2016: contributor

    On my building VM based on 10.10.x, it removes two warnings: daemon and LSGetApplicationForInfo. Maybe there are more warnings removed on newer systems. I always took it as a gentle reminder :-)

    ACK https://github.com/bitcoin/bitcoin/pull/9284/commits/2ab8fbbd5b0075b9e6316aaf2405e6b9d97f2311

  6. theuni commented at 4:19 PM on December 5, 2016: member

    Hmm, I don't think we really want to hide these?

  7. jonasschnelli commented at 4:35 PM on December 5, 2016: contributor

    I get at least 100 of those while compiling:

    In file included from /usr/local/Cellar/protobuf260/2.6.0/include/google/protobuf/stubs/atomicops.h:179:
    /usr/local/Cellar/protobuf260/2.6.0/include/google/protobuf/stubs/atomicops_internals_macosx.h:173:9: warning: 
          'OSAtomicCompareAndSwap64Barrier' is deprecated: first deprecated in macOS 10.12 - Use
          std::atomic_compare_exchange_strong() from <atomic> instead [-Wdeprecated-declarations]
        if (OSAtomicCompareAndSwap64Barrier(
            ^
    
  8. morcos commented at 4:54 PM on December 5, 2016: member

    Hmm.. They are pretty annoying, and I guess we can't just fix them ourselves...

  9. jonasschnelli commented at 5:04 PM on December 5, 2016: contributor

    @theuni: We could wrap it in a " if host = darwin"?

  10. gmaxwell commented at 4:54 AM on December 6, 2016: contributor

    I don't think we want to blanket disable them even on a single host. If protobuf is doing this can we just wrap the headers it generates with a pragma to disable the warning just there? (also, we should complain upstream)

  11. theuni commented at 5:47 AM on December 6, 2016: member

    @gmaxwell Yes, Looks like it still exists in master upstream :\

    I think we could probably hack together something like

    #ifdef SOME_MAC_VERSION_MACRO
    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wdeprecated-declarations"
    #include "protobuf/foo.h"
    #pragma clang diagnostic pop
    #endif
    

    I'm not sure how possible that is with the generated file, though. I can have a look tomorrow while I'm bored on a plane.

  12. laanwj commented at 6:46 AM on December 6, 2016: member

    +1 for using #pragma to do this on a case-by-case basis. Don't forget the daemon one (#8813) if you do.

  13. jonasschnelli commented at 7:12 AM on December 6, 2016: contributor

    Thanks for having a look at this @theuni. Hundreds of warnings on OSX 10.12+ defeats the purpose of warning the user. Everyone on OSX will just ignore them because finding the non-OSX-hell-depracation warnings is like finding the needle in a haystack.

  14. paveljanik commented at 7:15 AM on December 6, 2016: contributor

    I like the #pragma solution!

  15. theuni commented at 1:23 AM on December 8, 2016: member

    I think there may be a better option here. The includes have a GOOGLE_PROTOBUF_NO_THREAD_SAFETY macro that we can set, assuming we don't need thread-safety in the structures themselves. I assume that's the case?

    I didn't have access to the protobuf options while I was looking, but I'd assume there's something that we can add to the .proto to get that defined. I'll take a closer look when I can find some stable internet.

    Edit: That macro suppresses the inclusion of the problematic headers.

  16. laanwj commented at 12:25 PM on December 8, 2016: member

    assuming we don't need thread-safety in the structures themselves

    We don't. I didn't even realize there was an option for that.

  17. CodeShark commented at 9:01 AM on December 11, 2016: contributor

    utACK

  18. theuni commented at 6:14 AM on December 12, 2016: member

    I checked the protobuf docs and don't see any easy way to disable this. @jonasschnelli Could you try the hammer approach of ./configure CPPFLAGS=-DGOOGLE_PROTOBUF_NO_THREAD_SAFETY ? If that works, we can stick it in the appropriate place.

  19. jonasschnelli commented at 8:37 AM on December 12, 2016: contributor

    @theuni: Defining GOOGLE_PROTOBUF_NO_THREAD_SAFETY solves the deprecation warnings. But do we want to disable the thread safety on OSX?

    There are other deprecation warnings though (leveldb):

    In file included from ./leveldb/port/port_posix.h:47:
    ./leveldb/port/atomic_pointer.h:59:3: warning: 'OSMemoryBarrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_thread_fence() from <atomic>
          instead [-Wdeprecated-declarations]
      OSMemoryBarrier();
      ^
    /usr/include/libkern/OSAtomicDeprecated.h:749:9: note: 'OSMemoryBarrier' has been explicitly marked deprecated here
    void    OSMemoryBarrier( void );
            ^
    
  20. fanquake commented at 11:52 AM on December 12, 2016: member

    The other warnings have been fixed upstream IIRC On Mon., 12 Dec. 2016 at 16:37, Jonas Schnelli notifications@github.com wrote:

    @theuni https://github.com/theuni:

    Defining GOOGLE_PROTOBUF_NO_THREAD_SAFETY solves the deprecation warnings. But do we want to disable the thread safety on OSX?

    There are other deprecation warnings though (leveldb):

    In file included from ./leveldb/port/port_posix.h:47:

    ./leveldb/port/atomic_pointer.h:59:3: warning: 'OSMemoryBarrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_thread_fence() from <atomic>

      instead [-Wdeprecated-declarations]

    OSMemoryBarrier();

    ^

    /usr/include/libkern/OSAtomicDeprecated.h:749:9: note: 'OSMemoryBarrier' has been explicitly marked deprecated here

    void OSMemoryBarrier( void );

        ^

    — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/9284#issuecomment-266371083, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0t8murumP6MrWRK2HChoUFioTSxYIPks5rHQfDgaJpZM4LEMrg .

  21. jonasschnelli commented at 1:10 PM on January 24, 2017: contributor

    Closing for now.

  22. jonasschnelli closed this on Jan 24, 2017

  23. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me