From owner-freebsd-hackers@FreeBSD.ORG Wed May 19 13:40:14 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FCA4106564A; Wed, 19 May 2010 13:40:14 +0000 (UTC) (envelope-from gljennjohn@googlemail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id F2C498FC24; Wed, 19 May 2010 13:40:13 +0000 (UTC) Received: by fxm4 with SMTP id 4so1060195fxm.13 for ; Wed, 19 May 2010 06:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:reply-to:x-mailer:mime-version :content-type:content-transfer-encoding; bh=4LgJmunZku5WhuORUCpSWA6I9/EFZUtq53WQGwgKOcE=; b=pto8UYjzXUOODhQH2TZ3fVxn9eWrih0W0TRVEptKgzdW4KgOwYfjxZdyoq7kRP8rnn kPssGLyVqPi8bSKx3NiggmmHhFIcqpxgGO4V63BLXUHONop79E0w8VsxzGEJdLE/Mqo6 DEScKxdcvyeXHwsNx7/8CRCY/UegMBEzj4STw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :x-mailer:mime-version:content-type:content-transfer-encoding; b=dfv17jWy1BZ/xelVqa0v10P4mKigjwvBvKp99dO3LBH1S2RbNCR/rjfvEsQ2HkTLLF WnZPY2K+WeqEzubnxlD6YdF2yghvb/nfw/16MYLdDMyuLSzbIuMRRUlXJWmdZLh5pUOl SO2G77vrDl/FQEVaT0Ly2ryrspIkWpdmvjK+o= Received: by 10.223.5.81 with SMTP id 17mr9818743fau.42.1274275027590; Wed, 19 May 2010 06:17:07 -0700 (PDT) Received: from ernst.jennejohn.org (p578E2C16.dip.t-dialin.net [87.142.44.22]) by mx.google.com with ESMTPS id 2sm36002077fav.13.2010.05.19.06.17.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 19 May 2010 06:17:06 -0700 (PDT) Date: Wed, 19 May 2010 15:17:05 +0200 From: Gary Jennejohn To: Gabor PALI Message-ID: <20100519151705.4aa19e25@ernst.jennejohn.org> In-Reply-To: References: X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.7; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org Subject: Re: How to Include Headers for siginterrupt() and vsnprintf() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gljennjohn@googlemail.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2010 13:40:14 -0000 On Wed, 19 May 2010 12:52:04 +0200 Gabor PALI wrote: > Hello there, > > I have some sources developed on non-FreeBSD systems (the sources of > the run-time system for the Glasgow Haskell Compiler [1]) which try to > #include signal.h to use siginterrupt() and stdio.h to use > vsnprintf(). The problem is that they #define (or not) some constants > which makes them hidden so the prototypes are not seen by the > compiler. How to cope with this kind of sources? My naive solution > is to do something like that (rts/posix/Signals.c): > > #if defined(HAVE_SIGNAL_H) > # if defined(freebsd_HOST_OS) > extern int siginterrupt(int,int); > # endif > # include > #endif > > and that (rts/eventlog/EventLog.c): > > #ifdef freebsd_HOST_OS > int vsnprintf(char * __restrict, size_t, const char * > __restrict,__va_list) __printflike(3, 0); > #endif > > > Thank you for the hints in advance. > Try moving stdlib.h and string.h up near the top. stdlib.h includes sys/cdefs.h which defines (most) of these macros, like __XSI_VISIBLE. -- Gary Jennejohn