[MacPorts] #67248: grep @3.10 is broken on some versions of Tiger (?PPC ONLY): error: expected '=', ',', '; ', 'asm' or '__attribute__' before 'mcontext64_t'

MacPorts noreply at macports.org
Wed May 24 23:23:04 UTC 2023


#67248: grep @3.10 is broken on some versions of Tiger (?PPC ONLY): error: expected
'=', ',', ';', 'asm' or '__attribute__' before 'mcontext64_t'
---------------------------+-------------------------
  Reporter:  barracuda156  |      Owner:  Schamschula
      Type:  defect        |     Status:  assigned
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.8.1
Resolution:                |   Keywords:  tiger
      Port:  grep          |
---------------------------+-------------------------

Comment (by ballapete):

 `sys/_types.h` has:

 {{{
    29   /* Forward references */
    30   #ifndef _POSIX_C_SOURCE
    31   struct mcontext;
    32   struct mcontext64;
    33   #else /* _POSIX_C_SOURCE */
    34   struct __darwin_mcontext;
    35   #endif /* _POSIX_C_SOURCE */
 }}}

 and

 {{{
   106   #ifndef _POSIX_C_SOURCE
   107   typedef struct mcontext *__darwin_mcontext_t;   /* [???] machine
 context */
   108   typedef struct mcontext64 *__darwin_mcontext64_t; /* [???] machine
 context */
   109   #else /* _POSIX_C_SOURCE */
   110   typedef struct __darwin_mcontext *__darwin_mcontext_t; /* [???]
 machine context */
   111   #endif /* _POSIX_C_SOURCE */
 }}}

 and also:

 {{{
   157   /* user context */
   158   #ifndef _POSIX_C_SOURCE
   159   struct ucontext
   160   #else /* _POSIX_C_SOURCE */
   161   struct __darwin_ucontext
   162   #endif /* _POSIX_C_SOURCE */
   163   {
   164           int             uc_onstack;
   165           __darwin_sigset_t       uc_sigmask;     /* signal mask
 used by this context */
   166           __darwin_stack_t        uc_stack;       /* stack used by
 this context */
   167   #ifndef _POSIX_C_SOURCE
   168           struct ucontext *uc_link;               /* pointer to
 resuming context */
   169   #else /* _POSIX_C_SOURCE */
   170           struct __darwin_ucontext *uc_link;      /* pointer to
 resuming context */
   171   #endif /* _POSIX_C_SOURCE */
   172           __darwin_size_t uc_mcsize;              /* size of the
 machine context passed in */
   173           __darwin_mcontext_t     uc_mcontext;    /* pointer to
 machine specific context */
   174   };
   175   #ifndef _POSIX_C_SOURCE
   176   typedef struct ucontext __darwin_ucontext_t;    /* [???] user
 context */
   177   #else /* _POSIX_C_SOURCE */
   178   typedef struct __darwin_ucontext __darwin_ucontext_t; /* [???]
 user context */
   179   #endif /* _POSIX_C_SOURCE */
   180
   181   #ifndef _POSIX_C_SOURCE
   182   struct ucontext64 {
   183           int             uc_onstack;
   184           __darwin_sigset_t       uc_sigmask;     /* signal mask
 used by this context */
   185           __darwin_stack_t        uc_stack;       /* stack used by
 this context */
   186           struct ucontext64 *uc_link;             /* pointer to
 resuming context */
   187           __darwin_size_t uc_mcsize;              /* size of the
 machine context passed in */
   188           __darwin_mcontext64_t uc_mcontext64;    /* pointer to
 machine specific context */
   189   };
   190   typedef struct ucontext64 __darwin_ucontext64_t; /* [???] user
 context */
   191   #endif /* _POSIX_C_SOURCE */
 }}}
 while the pre-compiled C source has:

 {{{
 # 28 "/usr/include/sys/_types.h" 2 3 4
 .
 .
 .
 struct __darwin_mcontext;
 # 49 "/usr/include/sys/_types.h" 3 4
 .
 .
 .
 # 93 "/usr/include/sys/_types.h" 3 4
 .
 .
 .
 typedef struct __darwin_mcontext *__darwin_mcontext_t;
 .
 .
 .
 # 128 "/usr/include/sys/signal.h" 3 4
 .
 .
 .
 #define _MCONTEXT_T
 typedef __darwin_mcontext_t mcontext_t;
 .
 .
 .
 #define _MCONTEXT64_T
 typedef __darwin_mcontext64_t mcontext64_t;
 }}}

 and also

 {{{
 # 93 "/usr/include/sys/_types.h" 3 4
 .
 .
 .
 struct __darwin_ucontext

 {
  int uc_onstack;
  __darwin_sigset_t uc_sigmask;
  __darwin_stack_t uc_stack;

  struct __darwin_ucontext *uc_link;

  __darwin_size_t uc_mcsize;
  __darwin_mcontext_t uc_mcontext;
 };


 typedef struct __darwin_ucontext __darwin_ucontext_t;
 # 28 "/usr/include/_types.h" 2 3 4
 .
 .
 .
 # 170 "/usr/include/sys/signal.h" 3 4
 #define _UCONTEXT_T
 typedef __darwin_ucontext_t ucontext_t;


 #define _UCONTEXT64_T
 typedef __darwin_ucontext64_t ucontext64_t;
 # 186 "/usr/include/sys/signal.h" 3 4
 }}}

 which means that `_POSIX_C_SOURCE is (was) #define`d. Actually the problem
 is despite `types __darwin_mcontext64_t and __darwin_ucontext64_t
 #define`d. These are defined outside of `sys/_types.h`, in `sys/signal.h`:

 {{{
   134   #ifndef _ANSI_SOURCE
   135   #include <sys/_types.h>
   136
   137   #ifndef _MCONTEXT_T
   138   #define _MCONTEXT_T
   139   typedef __darwin_mcontext_t             mcontext_t;
   140   #endif
   141
   142   #ifndef _POSIX_C_SOURCE
   143   #ifndef _MCONTEXT64_T
   144   #define _MCONTEXT64_T
   145   typedef __darwin_mcontext64_t           mcontext64_t;
 <<<<<<<<
   146   #endif
   147   #endif /* _POSIX_C_SOURCE */
   148
   149   #ifndef _PID_T
   150   #define _PID_T
   151   typedef __darwin_pid_t                  pid_t;
   152   #endif
   153
   154   #ifndef _PTHREAD_ATTR_T
   155   #define _PTHREAD_ATTR_T
   156   typedef __darwin_pthread_attr_t         pthread_attr_t;
   157   #endif
   158
   159   #ifndef _SIGSET_T
   160   #define _SIGSET_T
   161   typedef __darwin_sigset_t               sigset_t;
   162   #endif
   163
   164   #ifndef _SIZE_T
   165   #define _SIZE_T
   166   typedef __darwin_size_t                 size_t;
   167   #endif
   168
   169   #ifndef _UCONTEXT_T
   170   #define _UCONTEXT_T
   171   typedef __darwin_ucontext_t             ucontext_t;
   172   #endif
   173
   174   #ifndef _POSIX_C_SOURCE
   175   #ifndef _UCONTEXT64_T
   176   #define _UCONTEXT64_T
   177   typedef __darwin_ucontext64_t           ucontext64_t;
 <<<<<<<<
   178   #endif
   179   #endif /* _POSIX_C_SOURCE */
 }}}

 Which means that in-between `_POSIX_C_SOURCE` changed to being undefined…

 First time here:

 {{{
 # 21 "./stdio.h" 3
 # 42 "./stdio.h" 3
 #define _POSIX_C_SOURCE 200809L    (line 2406 pre-processed output)
 }}}

 then

 {{{
 # 50 "./stdio.h" 2 3

 #undef _GL_ALREADY_INCLUDING_STDIO_H


 #undef _GL_DEFINED__POSIX_C_SOURCE
 #undef _POSIX_C_SOURCE



 #define _GL_STDIO_H
 # 68 "./stdio.h" 3                (line 2924 pre-processed output)
 }}}

 And indeed some 2,000 lines later `sys/signal.h` with the user context
 variables gets included. So it's `stdlib.h` that resets the macro?

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


More information about the macports-tickets mailing list