[MacPorts] #65998: legacy-support @1.0.7: error: restrict requires a pointer or reference

MacPorts noreply at macports.org
Sat Oct 15 20:00:28 UTC 2022


#65998: legacy-support @1.0.7: error: restrict requires a pointer or reference
--------------------+--------------------------------------------------
 Reporter:  kencu   |      Owner:  (none)
     Type:  defect  |     Status:  new
 Priority:  Normal  |  Milestone:
Component:  ports   |    Version:
 Keywords:          |       Port:  legacy-support, legacy-support-devel
--------------------+--------------------------------------------------
 trying to run the macports-legacy-support test suite with a newer compiler
 such as gcc-7 or clang-7.0 fails:

 {{{
 gcc-mp-7 -c -Iinclude -Os -Wall -fPIC src/macports_legacy_realpath.c -o
 src/macports_legacy_realpath.dl.o
 gcc-mp-7 -c -Iinclude -Os -Wall -fPIC src/macports_legacy_realpath.c -o
 src/macports_legacy_realpath.dl.o
 src/macports_legacy_realpath.c:27:1: error: invalid use of 'restrict'
  char *realpath(const char __restrict *stringsearch, char __restrict
 *buffer)
  ^~~~
 src/macports_legacy_realpath.c:27:1: error: invalid use of 'restrict'
 src/macports_legacy_realpath.c: In function 'realpath':
 src/macports_legacy_realpath.c:29:5: error: invalid use of 'restrict'
      char *(*real_realpath)(const char __restrict *, char __restrict *);
      ^~~~
 src/macports_legacy_realpath.c:29:5: error: invalid use of 'restrict'
 src/macports_legacy_realpath.c: At top level:
 src/macports_legacy_realpath.c:52:1: error: invalid use of 'restrict'
  char *macports_legacy_realpath(const char __restrict *stringsearch, char
 __restrict *buffer) { return realpath(stringsearch, buffer); }
  ^~~~
 src/macports_legacy_realpath.c:52:1: error: invalid use of 'restrict'
 make: *** [src/macports_legacy_realpath.dl.o] Error 1
 }}}

 {{{
 clang-mp-7.0 -c -Iinclude -Os -Wall -fPIC src/macports_legacy_realpath.c
 -o src/macports_legacy_realpath.dl.o
 clang-mp-7.0 -c -Iinclude -Os -Wall -fPIC src/macports_legacy_realpath.c
 -o src/macports_legacy_realpath.dl.o
 src/macports_legacy_realpath.c:27:27: error: restrict requires a pointer
 or reference ('char' is invalid)
 char *realpath(const char __restrict *stringsearch, char __restrict
 *buffer)
                           ^
 /usr/include/sys/cdefs.h:177:20: note: expanded from macro '__restrict'
 #define __restrict      restrict
                         ^
 src/macports_legacy_realpath.c:27:58: error: restrict requires a pointer
 or reference ('char' is invalid)
 char *realpath(const char __restrict *stringsearch, char __restrict
 *buffer)
                                                          ^
 /usr/include/sys/cdefs.h:177:20: note: expanded from macro '__restrict'
 #define __restrict      restrict
                         ^
 src/macports_legacy_realpath.c:29:39: error: restrict requires a pointer
 or reference ('char' is invalid)
     char *(*real_realpath)(const char __restrict *, char __restrict *);
                                       ^
 /usr/include/sys/cdefs.h:177:20: note: expanded from macro '__restrict'
 #define __restrict      restrict
                         ^
 src/macports_legacy_realpath.c:29:58: error: restrict requires a pointer
 or reference ('char' is invalid)
     char *(*real_realpath)(const char __restrict *, char __restrict *);
                                                          ^
 /usr/include/sys/cdefs.h:177:20: note: expanded from macro '__restrict'
 #define __restrict      restrict
                         ^
 src/macports_legacy_realpath.c:52:43: error: restrict requires a pointer
 or reference ('char' is invalid)
 char *macports_legacy_realpath(const char __restrict *stringsearch, char
 __restrict *buffer) { return realpath(stringsearch, buffer); }
                                           ^
 /usr/include/sys/cdefs.h:177:20: note: expanded from macro '__restrict'
 #define __restrict      restrict
                         ^
 src/macports_legacy_realpath.c:52:74: error: restrict requires a pointer
 or reference ('char' is invalid)
 char *macports_legacy_realpath(const char __restrict *stringsearch, char
 __restrict *buffer) { return realpath(stringsearch, buffer); }
                                                                          ^
 /usr/include/sys/cdefs.h:177:20: note: expanded from macro '__restrict'
 #define __restrict      restrict
                         ^
 6 errors generated.
 make: *** [src/macports_legacy_realpath.dl.o] Error 1
 }}}

 steps to reproduce (on 10.5 Intel):
 {{{
 cd /Users/Shared
 git clone https://github.com/macports/macports-legacy-support.git
 cd macports-legacy-support
 CC=clang-mp-7.0 CXX=clang++-mp-7.0  make check
 }}}

 some other syntax is needed for the restrict keyword it seems, although it
 does work with gcc-4.2.

-- 
Ticket URL: <https://trac.macports.org/ticket/65998>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list