[MacPorts] #67729: lzma is broken now with Apple GCC: error: #pragma GCC diagnostic not allowed inside functions

MacPorts noreply at macports.org
Tue Jul 11 01:24:12 UTC 2023


#67729: lzma is broken now with Apple GCC: error: #pragma GCC diagnostic not
allowed inside functions
---------------------------+-----------------------------------------
  Reporter:  barracuda156  |      Owner:  ryandesign
      Type:  defect        |     Status:  assigned
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.8.1
Resolution:                |   Keywords:  tiger, leopard, snowleopard
      Port:  lzma          |
---------------------------+-----------------------------------------

Comment (by kencu):

 {{{
 #if defined (__clang__) || defined(__GNUC__)
 }}}

 in insufficient as a test, as only newer gcc versions can support these
 pragmas inside functions.

 Something like this is better (from our cmake patch for Tiger):
 {{{
 #if defined(__GNUC__)
 #define GCC_VERSION \
         (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
 #endif
 #if defined(__clang__) || (defined(GCC_VERSION) && (GCC_VERSION >= 40500))
 /* gcc diagnostic pragmas available */
 # define GCC_DIAGNOSTIC_AVAILABLE
 #endif
 }}}

 and then use

 {{{
 if defined(GCC_DIAGNOSTIC_AVAILABLE)
 }}}

 as the test.

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


More information about the macports-tickets mailing list