tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

clang support flagging



Clang is increasingly important as a C++ compiler, but is difficult to
use on NetBSD.  

The gaping holes in NetBSD are locale support and C99 math, primarily
for long double.  I wrote this message first to confirm the situation
is as I see it, and second to ask who might be already working on it.  

In case you haven't been following developments closely, here's a brief
summary:

1.  Clang has been adopted by Apple and FreeBSD.  
2.  Clang accepts gcc 4.2 constructs.  Current gcc is 4.7.  
3.  C++ compilation worldwide is in flux as compilers implement C++11. 
4.  Clang and gcc are diverging.  Each project is implementing builtins
and extensions, some of which the other chooses not to support,
sometimes with good reason.  
5.  The up-and-coming alternative to GNU libstdc++ is clang's libc++.
It doesn't compile on NetBSD because it requires, among other things,
locale support defined by POSIX but not provided by NetBSD.  

The central issue is support for the standard library.  The day may not
be too far off when clang will be the preferred C++ compiler.  As
clang's  libc++ matures, projects will adopt it, and they won't compile
on NetBSD.  

To get a sense of the scale, I spent a day getting libc++ to
compile.  It required 152 functions:

$ grep -c \; *h | awk -F: '{print; SUM += $2;} END {print "TOTAL "SUM}'
locale.h:5
math.h:77
stdio.h:16
stdlib.h:16
time.h:1
wchar.h:1
wctype.h:36
TOTAL 152

Files containing the missing declarations are attached.  

locale_t appears on 75 lines.  Two thirds of the math functions are for
long double support, the rest seem to be other C99 functions.  

AFAIK C++11 is quiet on the subject of math functions and an
implementation can comply with the standard without C99 functions.  But
we need C99 functions anyway to remain relevant for quantitative work 
on modern archictectures.  

Bringing locales and 80-bit floating point to NetBSD seems to be a
matter of porting.  FreeBSD has both, and cephes has most of the C99
math.  

--jkl

Attachment: locale.h
Description: Binary data

Attachment: math.h
Description: Binary data

Attachment: stdio.h
Description: Binary data

Attachment: stdlib.h
Description: Binary data

Attachment: time.h
Description: Binary data

Attachment: wchar.h
Description: Binary data

Attachment: wctype.h
Description: Binary data



Home | Main Index | Thread Index | Old Index