mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix build on macOS M1, FreeBSD powerpc64*, et al (?)
On some systems, the following won't compile because of the way the
macros are defined in the system headers:
va_copy(ap, va_listval(va_arg(ap, va_listarg)));
The error from clang is something like:
.../hashalloc.c:155:16: error: non-const lvalue reference to type
'__builtin_va_list' cannot bind to a temporary of type 'va_list'
(aka 'char *')
va_copy(ap, va_listval(va_arg(ap, va_listarg)));
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./ast_common.h:200:23: note: expanded from macro 'va_listval'
#define va_listval(p) (p)
^
.../include/stdarg.h:27:53: note: expanded from macro 'va_copy'
#define va_copy(dest, src) __builtin_va_copy(dest, src)
^~~
1 error generated.
mamake [lib/libast]: *** exit code 1 making hashalloc.o
This commit backports a FreeBSD build fix from:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255308
Thanks to Chase <nicetrynsa@protonmail.ch> for the bug report.
src/lib/libast/hash/hashalloc.c,
src/lib/libast/string/tokscan.c:
- Store va_listval() result in variable and pass that to va_copy().
This commit is contained in:
parent
53f4bc6a53
commit
4d7ea081d3
2 changed files with 6 additions and 2 deletions
|
|
@ -50,6 +50,7 @@ hashalloc(Hash_table_t* ref, ...)
|
|||
va_list* vp = va;
|
||||
Hash_region_f region = 0;
|
||||
void* handle;
|
||||
va_listarg tmpval;
|
||||
|
||||
va_start(ap, ref);
|
||||
|
||||
|
|
@ -152,7 +153,8 @@ hashalloc(Hash_table_t* ref, ...)
|
|||
va_copy(*vp, ap);
|
||||
vp++;
|
||||
}
|
||||
va_copy(ap, va_listval(va_arg(ap, va_listarg)));
|
||||
tmpval = va_listval(va_arg(ap, va_listarg));
|
||||
va_copy(ap, tmpval);
|
||||
break;
|
||||
case 0:
|
||||
if (vp > va)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue