[cfe-dev] netbsd & gcc 4.6 triple

James K. Lowden jklowden at schemamania.org
Tue Apr 24 10:48:35 PDT 2012

On Tue, 24 Apr 2012 17:08:38 +0200
Joerg Sonnenberger <joerg at britannica.bec.de> wrote:

> If you look at the pre-processed code for Triple.cpp,
> what is the include path leading to sys/param.h?

The attached file was created with 

$ cat preprocess.sh
cpp -H \
    -I/usr/pkgsrc/wip/clang/work/llvm/include \
    -I/usr/pkgsrc/wip/clang/work/llvm/lib/Support  \
    -DNDEBUG \
    -I/usr/include \
    -I/usr/pkg/gcc46/include \
    -I/usr/pkg/gcc46/lib/gcc/x86_64-unknown-netbsd5.0.2/4.6.3/include \
    -I/usr/include \
    -I/usr/pkg/gcc46/include \
    -I/usr/pkg/gcc46/lib/gcc/x86_64-unknown-netbsd5.0.2/4.6.3/include  \

$ ./preprocess.sh 2>&1 | grep -E '^(# [0-9]+ ")|^\.'

The story starts with llvm/include/llvm/ADT/SmallVector.h.  That draws
in many gcc46/include files, one of which is gcc46/include/c+
+//x86_64-unknown-netbsd5.0.2/bits/ctype_base.h, which says:

     26 // ISO C++ 14882: 22.1  Locales
     27 //
     29 // Information as gleaned from /usr/include/ctype.h on NetBSD.
     30 // Full details can be found from the CVS files at:
     31 //   anoncvs at anoncvs.netbsd.org:/cvsroot/basesrc/include/ctype.h
     32 // See www.netbsd.org for details of access.
     34 #include <sys/param.h>

That's new btw.  The attached diff shows ctype_base.h from base didn't
include sys/params.h.  

I hope that answers your specific question.  Should we talk to gcc
about it?  

It's not enough, though, IMO.  configure.ac also looks for
sys/params.h and configure references "NetBSD" where it should use
__NetBSD_Version__ unless, improbably, it seeks to be compatible with
NetBSD 1.4.  It's worth considering changing the clang
symbols to be slightly different from NetBSD and FSCALE.  

Interested to hear your thoughts.  I fetched
http://llvm.org/svn/llvm-project/llvm/trunk this morning. I'll try
building that and, if I bump into the same problem -- if I get that far
-- I'll try patching ctype_base.h.  


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Triple.includes
Type: application/octet-stream
Size: 79738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120424/006731a4/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctype_base.h-diff
Type: application/octet-stream
Size: 3696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120424/006731a4/attachment-0001.obj>

More information about the cfe-dev mailing list