All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@suse.com>
To: ian.jackson@citrix.com
Cc: stefanos@xilinx.com, sstabellini@kernel.org, wei.liu2@citrix.com,
	konrad.wilk@oracle.com, Andrew.Cooper3@citrix.com, tim@xen.org,
	George.Dunlap@citrix.com, julien.grall@arm.com,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v11 1/9] xen: use __UINTPTR_TYPE__ for uintptr_t
Date: Fri, 08 Mar 2019 00:23:29 -0700	[thread overview]
Message-ID: <5C8218710200007800150110@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <23681.15387.866696.351589@mariner.uk.xensource.com>

>>> Ian Jackson <ian.jackson@citrix.com> 03/07/19 4:44 PM >>>
>Jan Beulich writes ("Re: [PATCH v11 1/9] xen: use __UINTPTR_TYPE__ for uintptr_t"):
>> On 06.03.19 at 22:16, <sstabellini@kernel.org> wrote:
>> > Also, it is not a good idea to use __mode__(__pointer__) to define
>> > uintptr_t, because it relies on an obscurely defined GCC feature whose
>> > semantics might be taken to imply that the things are really pointers.
>> 
>> "Obscurely defined" is rather subjective, I'd say. The "pointer" mode
>> is precisely for this according to my understanding,
>
>Unfortunately it is not your understanding that is relevant, but the
>possible future understanding of compiler authors.

Well, I'm trying to claim that I sort of understand what their understanding
is, ...


>> and personally I find "You may also specify a mode of byte or
>> __byte__ to indicate the mode corresponding to a one-byte integer,
>> word or __word__ for the mode of a one-word integer, and pointer or
>> __pointer__ for the mode used to represent pointers" sufficiently
>> clear, and not leaving room for any (hidden) interpretation like "to
>> imply that the things are really pointers".
>
>The problem is the word `mode'.  I cannot find a definition of that in
>this context in the GCC manual.  The only thing is the extremely
>informal description you quote.  Normally in English `mode' would mean
>something other than merely `size'.
>
>I think in fact the word `mode' here is a reference to a concept in
>the GCC compiler internals.

... knowing some (hopefully enough) of these internals, first and foremost
because I had done the entire tool chain port for an experimental OS of
ours years ago. Arguably this may not be enough, but I hope it explains
why I'm saying what I say.


>This is really not a situation we should
>be optimistic about, particularly given that we are in serious dispute
>with compiler authors about the meanings of specifications and that
>compiler authors seem quite willing to engage in rank sophistry.
>Relying on our good faith interpretation of some vague text is a
>seriously bad idea.

I'm not relying on just the what you call "vague" text. I'm having a rather
hard time imagining why the compiler folks would change a fundamental
concept of how the compiler (internally, and exposed to users via the
__attribute__(())) works.


>On the other hand, the cpp documentation has this:
>
>__UINTPTR_TYPE__
>
>These macros are defined to the correct underlying types for the
>'size_t', 'ptrdiff_t', 'wchar_t', 'wint_t', 'intmax_t', ...
>
>This is completely clear and unambiguous.
>
>If I were Stefano I would have quoted these manual sections in my
>commit message or a code comment.  I would have hoped that to be
>conclusive.

He sort of did that, by pointing at them instead of quoting.


>> ... in line with
>> 
>> void
>> c_stddef_cpp_builtins(void)
>> {
>>   builtin_define_with_value ("__SIZE_TYPE__", SIZE_TYPE, 0);
>>   builtin_define_with_value ("__PTRDIFF_TYPE__", PTRDIFF_TYPE, 0);
>> [...]
>>   if (INTPTR_TYPE)
>>     builtin_define_with_value ("__INTPTR_TYPE__", INTPTR_TYPE, 0);
>>   if (UINTPTR_TYPE)
>>     builtin_define_with_value ("__UINTPTR_TYPE__", UINTPTR_TYPE, 0);
>> }
>
>I have no idea what this is.  Is this some piece of the cpp source
>code ?  What is your point in quoting it ?

The fact that the symbol is not defined unconditionally, whereas
__attribute__((__mode__(__pointer__))) is always available.


>> > [1] https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html 
>> 
>> Note that this also says "Some of these macros may not be defined on
>> particular systems if GCC does not provide a ‘stdint.h’ header on those
>> systems." I have absolutely no idea under what conditions gcc may not
>> (want to) provide stdint.h.
>
>We do not need to worry about this.
>
>What this means is that if the underlying gcc platform does not have a
>uintptr_t then we don't get __UINTPTR_T__.  If that is the case then
>we need to fix GCC, not use >
>Furthermore, the possible failure case with __UINTPTR_T__is an
>undefined type error.  Failures due to use of the mode attribute are
>unknowable because there is no real specification for it.

Well, I accept this to be one possible and valid standpoint. I don't accept
this to be the only one.

Jan




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

  reply	other threads:[~2019-03-08  7:40 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 22:38 [PATCH v11 0/9] misc safety certification fixes Stefano Stabellini
2019-03-05 22:38 ` [PATCH v11 1/9] xen: use __UINTPTR_TYPE__ for uintptr_t Stefano Stabellini
2019-03-06  7:47   ` Jan Beulich
2019-03-06 21:16     ` Stefano Stabellini
2019-03-07  8:29       ` Jan Beulich
2019-03-07 15:43         ` Ian Jackson
2019-03-08  7:23           ` Jan Beulich [this message]
2019-03-08 14:18   ` Andrew Cooper
2019-03-08 15:19     ` Ian Jackson
2019-03-05 22:38 ` [PATCH v11 2/9] xen: introduce ptrdiff_t Stefano Stabellini
2019-03-05 22:38 ` [PATCH v11 3/9] xen: introduce DECLARE_BOUNDS Stefano Stabellini
2019-03-06 15:24   ` Jan Beulich
2019-03-06 20:55     ` Stefano Stabellini
2019-03-07  8:39       ` Jan Beulich
2019-03-07 14:16         ` Ian Jackson
2019-03-08  8:15           ` Jan Beulich
2019-03-08 15:31             ` Ian Jackson
2019-03-05 22:38 ` [PATCH v11 4/9] xen/arm: use DECLARE_BOUNDS as required Stefano Stabellini
2019-03-05 22:38 ` [PATCH v11 5/9] xen/x86: " Stefano Stabellini
2019-03-06 15:33   ` Jan Beulich
2019-03-06 21:05     ` Stefano Stabellini
2019-03-07  8:40       ` Jan Beulich
2019-03-07 14:02       ` Ian Jackson
2019-03-07 14:42         ` George Dunlap
2019-03-08  8:46         ` Jan Beulich
2019-03-08  8:55           ` Juergen Gross
2019-03-08 15:33           ` Ian Jackson
2019-03-06 15:48   ` Jan Beulich
2019-03-06 21:38     ` Stefano Stabellini
2019-03-07  8:50       ` Jan Beulich
2019-03-07 14:43         ` Ian Jackson
2019-03-08  8:22           ` Jan Beulich
2019-03-08 15:36             ` Ian Jackson
2019-03-08 15:57               ` Jan Beulich
2019-03-07 14:00       ` Ian Jackson
2019-03-08 15:43   ` Ian Jackson
2019-03-08 15:49     ` Jan Beulich
2019-03-05 22:38 ` [PATCH v11 6/9] xen/common: " Stefano Stabellini
2019-03-06 15:37   ` Jan Beulich
2019-03-06 21:08     ` Stefano Stabellini
2019-03-05 22:38 ` [PATCH v11 7/9] xen: " Stefano Stabellini
2019-03-05 22:38 ` [PATCH v11 8/9] xen: use DECLARE_BOUNDS in alternative.c Stefano Stabellini
2019-03-06 16:35   ` Jan Beulich
2019-03-06 21:38     ` Stefano Stabellini
2019-03-05 22:38 ` [PATCH v11 9/9] xen: explicit casts when DECLARE_BOUNDS cannot be used Stefano Stabellini
2019-03-07 11:40   ` Jan Beulich
2019-03-07 15:25     ` [PATCH v11 9/9] xen: explicit casts when DECLARE_BOUNDS cannot be used [and 1 more messages] Ian Jackson
2019-03-07 22:55       ` Stefano Stabellini
2019-03-08 15:39         ` [PATCH v11 9/9] xen: explicit casts when DECLARE_BOUNDS cannot be used [and 1 more messages] " Ian Jackson
2019-03-08  8:28       ` [PATCH v11 9/9] xen: explicit casts when DECLARE_BOUNDS cannot be used " Jan Beulich
2019-03-08 15:26 ` SRSL People... [PATCH v11 0/9] misc safety certification fixes Andrew Cooper
2019-03-08 15:44   ` Ian Jackson
2019-03-08 15:46   ` Jan Beulich
2019-03-08 20:14     ` Stefano Stabellini

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=5C8218710200007800150110@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=stefanos@xilinx.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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.