[MacPorts] #62164: qemu @5.2.0: build failure with +cocoa

MacPorts noreply at macports.org
Tue Nov 30 18:29:20 UTC 2021


#62164: qemu @5.2.0: build failure with +cocoa
---------------------+-----------------------
  Reporter:  Ionic   |      Owner:  raimue
      Type:  defect  |     Status:  assigned
  Priority:  Normal  |  Milestone:
 Component:  ports   |    Version:
Resolution:          |   Keywords:  legacy-os
      Port:  qemu    |
---------------------+-----------------------

Comment (by jasonliu--):

 Replying to [comment:8 kencu]:
 > I don't immediately see the problem with your patch, sorry.
 >
 >
 >
 > The availability stuff, I'm sure you know, looks like
 [https://clang.llvm.org/docs/LanguageExtensions.html#objective-c-available
 this] now:
 > {{{
 > void my_function(NSSomeClass* var) {
 >   if (@available(macOS 10.12, *)) {
 >     [var fancyNewMethod];
 >   } else {
 >     // Put fallback behavior for old macOS versions (and for non-mac
 >     // platforms) here.
 >   }
 > }
 > }}}

 Note that this technique has one very notable disadvantage when compared
 with the older, more traditional technique of the availability macros,
 like {{{MAC_OS_X_VERSION_MAX_ALLOWED}}},
 {{{MAC_OS_X_VERSION_MIN_REQUIRED}}}, etc. Using {{{@available}}} allows
 code that has been compiled on newer systems to be run on older systems,
 but {{{@available}}} '''does not have the ability to hide any code from
 being seen by the compiler'''. On the other hand, when you use the
 availability macros, the preprocessor will actually hide the code from the
 compiler. This means that if you try to compile code that uses
 {{{@available}}} on an older macOS, but {{{[var fancyNewMethod];}}} only
 exists in a newer version of macOS, you will still get a compiler error.

 References:
 * https://github.com/macports/macports-ports/blob/master/python/py-
 matplotlib/files/patch-v34-src-macosx.m.diff
 * https://github.com/macports/macports-
 ports/commit/b07e0eb6440b1499bfd2157e19db86fc79984471#comments

-- 
Ticket URL: <https://trac.macports.org/ticket/62164#comment:12>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list