svn commit: r238907 - projects/calloutng/sys/kern

Attilio Rao attilio at freebsd.org
Wed Sep 19 07:37:08 UTC 2012


On Wed, Sep 19, 2012 at 5:18 AM, Konstantin Belousov
<kostikbel at gmail.com> wrote:
> On Tue, Sep 18, 2012 at 08:00:48PM +0100, Attilio Rao wrote:
>> On Tue, Sep 18, 2012 at 4:30 PM, Attilio Rao <attilio at freebsd.org> wrote:
>> > On 9/18/12, Konstantin Belousov <kostikbel at gmail.com> wrote:
>> >> Traditionally, we do provide the fallback for non-GNUC compilers, by
>> >> defining extern function with the compatible signature. In this case,
>> >> the empty function just works for the purpose, although with higher
>> >> overhead than the GNUC case.
>> >
>> > I agree, we need a fallback here. Unfortunately I'm buried with job
>> > stuff but I will provide an errata patch ASAP.
>>
>> Here is the patch. I didn't use a real extern function body for it,
>> but just went with an empty macro.
>>
>> Attilio
>
>> +/*
>> + * 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.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein


More information about the svn-src-projects mailing list