From owner-svn-src-projects@FreeBSD.ORG Wed Sep 19 09:23:14 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA3A6106566B; Wed, 19 Sep 2012 09:23:14 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 213918FC0C; Wed, 19 Sep 2012 09:23:12 +0000 (UTC) Received: by lahe6 with SMTP id e6so484301lah.13 for ; Wed, 19 Sep 2012 02:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=bk5Ah7dDKA0Ymr0QmpJ9u2T1mapCYlmLRzKjmAYSBoA=; b=XUsxOzpy3nv5cUvQGdN+/OtJIRWAfmYZVChK1rq1/KX6fmfWmXkXcasUf4NmtjLZJY YYHDMg2ZZtqzSLKsa/wleSLaMGXpMWndSElYH/u+TzSpV2Zu38CVH8QAQjJGnFoaOdNF zf83LIxkJ5qXCNDR2uNWIzKL2PbBaaPomskZoRtbiKnS/6b+G7l8q28aDvdw9n21u3MN Qmhl1jlZBuU8nba8joMJ4JoUtxczsaAT5+Uri0dI6yfTcMVkSjY6b+xDry+QpXV9jY9x BKzgIbebx1MKc2oRxIP19JKsexajMLoCMv1VCX4WXMzvhUNwleZS107FpMOJ8nOqFcQq g5nQ== MIME-Version: 1.0 Received: by 10.152.131.68 with SMTP id ok4mr2141459lab.47.1348046590995; Wed, 19 Sep 2012 02:23:10 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.102.39 with HTTP; Wed, 19 Sep 2012 02:23:10 -0700 (PDT) In-Reply-To: <20120919190309.R1306@besplex.bde.org> References: <201207301350.q6UDobCI099069@svn.freebsd.org> <201207301732.33474.jhb@freebsd.org> <20120918083324.GX37286@deviant.kiev.zoral.com.ua> <20120919041811.GM37286@deviant.kiev.zoral.com.ua> <20120919190309.R1306@besplex.bde.org> Date: Wed, 19 Sep 2012 10:23:10 +0100 X-Google-Sender-Auth: wXxuReArvFwvODcndQftcCSUVSQ Message-ID: From: Attilio Rao To: Bruce Evans Content-Type: text/plain; charset=UTF-8 Cc: Davide Italiano , src-committers@freebsd.org, John Baldwin , Jeff Roberson , Dimitry Andric , svn-src-projects@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r238907 - projects/calloutng/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2012 09:23:14 -0000 On 9/19/12, Bruce Evans wrote: > On Wed, 19 Sep 2012, Attilio Rao wrote: > >> On Wed, Sep 19, 2012 at 5:18 AM, Konstantin Belousov >> wrote: >>> On Tue, Sep 18, 2012 at 08:00:48PM +0100, Attilio Rao wrote: >>>> ... >>>> Here is the patch. I didn't use a real extern function body for it, >>>> but just went with an empty macro. >>>> ... >>>> +/* >>>> + * Compiler memory barriers, specific to gcc and clang. >>>> + */ >>>> +#if defined(__GNUC__) >>>> +#define __compiler_membar() __asm __volatile(" " : : : >>>> "memory") >>>> +#else >>>> +#define __compiler_membar() struct __hack >>>> +#endif >>> >>> I would not call this an empty macro. If this works at all, it requires >>> c99 compiler. Why not just do >>> extern void __compiler_membar(void); >>> for !GNUC. Note that we never supplied actual implementation for the >>> placeholders, as evidenced e.g. by cpufunc.h or fpu.c. >> >> So the main reason for this is to keep compliancy with c'89? Are you >> sure it is so important nowadays? >> I'm always under the impression that we are already using c'99 >> specific features, like structs initializers, etc. > > 'struct __hack' requires a c83 compiler. It is used extensively and worked > in 1993. > > One point of using an extern function is to break properly when a feature > is missing. For a random compiler, you wouldn't know if it needs the > feature. OTOH, your original version with no support breaks even better, > by giving a spew of error messages (at least with -Wmumble-prototypes). > Many of the features in sys/cdefs.h are handled in this way. E.g., > using __packed is a syntax error unless it is known to work (for > __GNUC_PREREQ(2, 7) || __INTEL_COMPILER), except for lint it is bogusly > stubbed out so that it is not properly broken for line. I see. So definitively what version do you prefer? The one using the external definition or the one without anything? Attilio -- Peace can only be achieved by understanding - A. Einstein