All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v3 3/3] x86/string: Clean up x86/string.h
Date: Mon, 15 May 2017 08:22:11 -0600	[thread overview]
Message-ID: <5919D5B30200007800159E59@prv-mh.provo.novell.com> (raw)
In-Reply-To: <537fa0f1-d421-96d7-c69f-947f1a02ee6b@citrix.com>

>>> On 15.05.17 at 15:08, <andrew.cooper3@citrix.com> wrote:
> On 15/05/17 11:19, Jan Beulich wrote:
>>  >>> On 15.05.17 at 12:08, <JBeulich@suse.com> wrote:
>>>>>> On 12.05.17 at 19:35, <andrew.cooper3@citrix.com> wrote:
>>>> --- a/xen/include/asm-x86/string.h
>>>> +++ b/xen/include/asm-x86/string.h
>>>> @@ -2,13 +2,23 @@
>>>>  #define __X86_STRING_H__
>>>>  
>>>>  #define __HAVE_ARCH_MEMCPY
>>>> -#define memcpy(t,f,n) (__builtin_memcpy((t),(f),(n)))
>>>> +void *memcpy(void *dest, const void *src, size_t n);
>>>> +#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
>>>>  
>>>> -/* Some versions of gcc don't have this builtin. It's non-critical anyway. 
>>> */
>>>>  #define __HAVE_ARCH_MEMMOVE
>>>> -extern void *memmove(void *dest, const void *src, size_t n);
>>>> +void *memmove(void *dest, const void *src, size_t n);
>>>> +#define memmove(d, s, n) __builtin_memmove(d, s, n)
>>>>  
>>>>  #define __HAVE_ARCH_MEMSET
>>>> -#define memset(s,c,n) (__builtin_memset((s),(c),(n)))
>>>> +void *memset(void *dest, int c, size_t n);
>>>> +#define memset(s, c, n) __builtin_memset(s, c, n)
>>> Now that xen/string.h has the exact same declarations and
>>> definitions already, why don't you simply delete the overrides
>>> from here?
>> Hmm, wait - I guess you need to keep them because of the custom
>> implementation. That's awkward, there shouldn't be a need to have
>> redundant declarations just because there are custom
>> implementations. How about making __HAVE_ARCH_* serve both
>> purposes, by allowing it to have different values (besides being
>> defined or undefined)?
> 
> I don't understand how you would intend this new __HAVE_ARCH_* to work.

E.g. __HAVE_ARCH_* = 2 meaning arch provides declaration and
definition (i.e. generic header and source skip theirs), while
__HAVE_ARCH_* = 1 meaning arch provides just a definition, but
the generic declaration and macro (where applicable) are fine (i.e.
only the generic source skips its piece of code).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-05-15 14:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12 17:35 [PATCH v3 for-next 0/3] Improvements to string.h Andrew Cooper
2017-05-12 17:35 ` [PATCH v3 1/3] xen/string: Clean up {xen, arm}/string.h Andrew Cooper
2017-05-15 10:02   ` Jan Beulich
2017-05-31  8:47   ` Julien Grall
2017-05-12 17:35 ` [PATCH v3 2/3] xen/string: Use compiler __builtin_*() where possible Andrew Cooper
2017-05-15 10:05   ` Jan Beulich
2017-05-12 17:35 ` [PATCH v3 3/3] x86/string: Clean up x86/string.h Andrew Cooper
2017-05-15 10:08   ` Jan Beulich
2017-05-15 10:19     ` Jan Beulich
2017-05-15 13:08       ` Andrew Cooper
2017-05-15 14:22         ` Jan Beulich [this message]
2017-05-31 12:42           ` Andrew Cooper
2017-05-31 13:00             ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5919D5B30200007800159E59@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.