From 10b559663e245233e674cd68352fe439d1b7f6c7 Mon Sep 17 00:00:00 2001 From: Thomas Veerman Date: Wed, 15 Oct 2014 10:59:38 +0200 Subject: [PATCH] buildsystem: fix build errors for x86 on OSX Define _NLS_PRIVATE in tools/llvm-tblgen/Makefile so that will pull in . This is necessary as Clang's c++/v1/locale implementation contains references to catopen and other catalog symbols that aren't defined anywhere. Moreover, the compiler will complain about NL_CAT_LOCALE not being declared. The compat nl_types.h fixes these discrepancies. However, uses __format_arg to add function attributes to declarations. On NetBSD __format_arg(fmtarg) is defined by to be __attribute__((__format_arg__ (fmtarg))) for briefness, but other platforms don't do that. Consequently, the build will fail on catopen and friends function declarations because the compiler doesn't know how to handle __format_arg(fmtarg). A fixup to takes care of this, but it won't win any beauty contest. Change-Id: Ic4426eca8385aeef858e60304d6e8c06cd497d95 Signed-off-by: Thomas Veerman --- tools/compat/nl_types.h | 10 ++++++++++ tools/llvm-tblgen/Makefile | 2 ++ 2 files changed, 12 insertions(+) diff --git a/tools/compat/nl_types.h b/tools/compat/nl_types.h index 1c114eb8a..9bb482da4 100644 --- a/tools/compat/nl_types.h +++ b/tools/compat/nl_types.h @@ -1,5 +1,15 @@ /* $NetBSD: nl_types.h,v 1.1 2002/01/29 10:20:32 tv Exp $ */ #ifdef _NLS_PRIVATE + +/* #if defined(__minix) */ +/* defines __format_arg, but on some other platforms it doesn't. + * includes because it needs __format_arg. As it might + * not be defined, we do it here as a work around. */ +#ifndef __format_arg +#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg))) +#endif +/* #endif defined(__minix) */ + #include "../../include/nl_types.h" #endif diff --git a/tools/llvm-tblgen/Makefile b/tools/llvm-tblgen/Makefile index 7690b24d0..b5f846819 100644 --- a/tools/llvm-tblgen/Makefile +++ b/tools/llvm-tblgen/Makefile @@ -3,5 +3,7 @@ HOSTPROGNAME= ${_TOOL_PREFIX}llvm-tblgen HOSTPROG_CXX= ${_TOOL_PREFIX}llvm-tblgen HOST_SRCDIR= external/bsd/llvm/bin/tblgen +# MINIX, for OSX Crosscompilation support +CPPFLAGS+= -D_NLS_PRIVATE=1 .include "${.CURDIR}/../Makefile.host" -- 2.44.0