linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Cc: linux-man@vger.kernel.org, gcc@gcc.gnu.org,
	cfe-users@lists.llvm.org, Dave Martin <Dave.Martin@arm.com>
Subject: Re: cacheflush.2
Date: Fri, 11 Dec 2020 19:14:07 +0100	[thread overview]
Message-ID: <b18b7e3d-d6a2-dba6-adad-713a171044c0@gmail.com> (raw)
In-Reply-To: <90152ea6-f2eb-b08f-7269-f8266ffb15d1@gmail.com>

It looks like GCC recently moved from 'char *' to 'void *'.
This SO question[1] (4 years ago) quotes the GCC docs
and they had 'char *'.
Maybe Clang hasn't noticed the change.
I'll report a bug.

[1]: https://stackoverflow.com/q/35741814/6872717

On 12/9/20 8:15 PM, Alejandro Colomar (man-pages) wrote:
> Hi Heinrich,
> 
> It looks like a bug (or at least an undocumented divergence from GCC) in
> Clang/LLVM.  Or I couldn't find the documentation for it.
> 
> Clang uses 'char *':
> https://github.com/llvm/llvm-project/blob/7faf62a80bfc3a9dfe34133681fcc31f8e8d658b/clang/include/clang/Basic/Builtins.def#L583
> 
> GCC uses 'void *':
> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
> 
> I CCd Clang and GCC lists; maybe they know about that divergence.
> 
> Cheers,
> 
> Alex
> 
> On 12/9/20 7:48 PM, Heinrich Schuchardt wrote:
>> On 12/9/20 7:34 PM, Alejandro Colomar (man-pages) wrote:
>>> Hi Heinrich & Michael,
>>>
>>> What about the following?:
>>>
>>> [
>>> NOTES
>>>         GCC provides a similar function, which may be useful on  archi‐
>>>         tectures that lack this system call:
>>>
>>>             void __builtin___clear_cache(void *begin, void *end);
>>> ]
>>
>> I just checked building with Clang/LLVM. There the arguments are of type
>> (char *). See the following error output:
>>
>> +arch/sandbox/cpu/cache.c:19:26: error: passing 'uint8_t *' (aka
>> 'unsigned char *') to parameter of type 'char *' converts between
>> pointers to integer types with different sign [-Werror,-Wpointer-sign]
>> +        __builtin___clear_cache(state->ram_buf,
>> +                                ^~~~~~~~~~~~~~
>> +arch/sandbox/cpu/cache.c:20:12: error: passing 'uint8_t *' (aka
>> 'unsigned char *') to parameter of type 'char *' converts between
>> pointers to integer types with different sign [-Werror,-Wpointer-sign]
>> +                                state->ram_buf + state->ram_size);
>> +                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Best regards
>>
>> Heinrich
>>
>>>
>>> Cheers,
>>>
>>> Alex
>>>
>>> On 12/9/20 7:04 PM, Heinrich Schuchardt wrote:
>>>> Hello Michael,
>>>>
>>>> function cacheflush() does not exist on many architectures.
>>>>
>>>> It would have saved me a lot of time if the man-page had referenced
>>>> GCC's
>>>>
>>>> void __builtin___clear_cache(void *begin, void *end)
>>>>
>>>> Maybe you can add it to NOTES.
>>>>
>>>> Best regards
>>>>
>>>> heirnich
>>>
>>
> 

-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es

  reply	other threads:[~2020-12-11 19:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 18:04 cacheflush.2 Heinrich Schuchardt
2020-12-09 18:34 ` cacheflush.2 Alejandro Colomar (man-pages)
2020-12-09 18:48   ` cacheflush.2 Heinrich Schuchardt
2020-12-09 19:15     ` cacheflush.2 Alejandro Colomar (man-pages)
2020-12-11 18:14       ` Alejandro Colomar (man-pages) [this message]
2020-12-14 21:13         ` cacheflush.2 Martin Sebor
2020-12-14 22:34           ` cacheflush.2 Alejandro Colomar (man-pages)
2020-12-18 10:42             ` Ping: cacheflush.2 Alejandro Colomar (man-pages)
2020-12-18 16:51               ` Martin Sebor
2020-12-19 14:04                 ` Alejandro Colomar (man-pages)
2020-12-10 18:17   ` cacheflush.2 Dave Martin
2020-12-10 19:20     ` cacheflush.2 Heinrich Schuchardt
2020-12-10 20:56       ` RFC v2: cacheflush.2 Alejandro Colomar (man-pages)
2020-12-11  8:15         ` Michael Kerrisk (man-pages)
2020-12-11 18:02           ` Alejandro Colomar (man-pages)
2020-12-11 18:22             ` RFC v3: " Alejandro Colomar (man-pages)
2020-12-11 18:26               ` RFC v4: " Alejandro Colomar (man-pages)
2020-12-14 11:43                 ` [PATCH v5] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative Alejandro Colomar
2020-12-14 12:00                   ` Heinrich Schuchardt
2020-12-15 13:30                 ` [PATCH v6] " Alejandro Colomar
2020-12-20 15:35                   ` Ping: " Alejandro Colomar (man-pages)
2020-12-20 20:48                   ` Michael Kerrisk (man-pages)

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=b18b7e3d-d6a2-dba6-adad-713a171044c0@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=Dave.Martin@arm.com \
    --cc=cfe-users@lists.llvm.org \
    --cc=gcc@gcc.gnu.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=xypron.glpk@gmx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).