From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/9] common: include <inttypes.h> always
Date: Fri, 3 Aug 2018 11:01:11 -0400 [thread overview]
Message-ID: <20180803150111.GH32145@bill-the-cat> (raw)
In-Reply-To: <CAPnjgZ0jSuFc4CTUd_mJkAef4-aCEB5cORO1B=pvC3+YLP5jmg@mail.gmail.com>
On Thu, Aug 02, 2018 at 10:56:11AM -0600, Simon Glass wrote:
> +Tom
>
> Hi Masahiro,
>
> On 30 July 2018 at 19:41, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> > 2018-07-26 22:59 GMT+09:00 Philipp Tomsich
> > <philipp.tomsich@theobroma-systems.com>:
> >> With the ram-size variable changed to u64, we'll need appropriate
> >> macros for printing u64 values correctly either in 32bit builds
> >> (i.e. ILP32 models) or in 64bit builds (i.e. LP64 models). Best to
> >> make the PRIx64 macro available everywhere.
> >>
> >> This include inttypes.h from common.h to make the various macros for
> >> formatted printing available to everyone.
> >>
> >> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> >> ---
> >
> >
> > NACK.
> >
> >
> > PRIx64 is evil crap. I would make the code super ugly.
> > Do not use it.
> >
> >
> > The right thing to do is use the same typedefs
> > for all architectures.
> >
> > typedef unsigned char u8;
> > typedef unsigned short u16;
> > typedef unsigned int u32;
> > typedef unsigned long long u64;
> >
> > This works for both ILP32 and LP64.
> >
> >
> > Use '%llx' for printing u64 variables _always_.
> >
> >
> >
> > This is what Linux exactly does.
> >
> >
> >
> > In fact, Linux defined fixed-width types differently
> > for different architectures in old days.
> >
> >
> > After long time effort, Linux unified
> > the fixed-width types for the kernel space.
> >
> > https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/int-ll64.h
> >
> >
> >
> > See Linux commit:
> >
> > commit 0c79a8e29b5fcbcbfd611daf9d500cfad8370fcf
> > Author: Geert Uytterhoeven <geert@linux-m68k.org>
> > Date: Thu Jan 23 15:53:43 2014 -0800
> >
> > asm/types.h: Remove include/asm-generic/int-l64.h
> >
> >
> >
> >
> >
> > And, I fixed ARM Trusted Firmware in the same way:
> >
> > https://github.com/ARM-software/arm-trusted-firmware/commit/0a2d5b43c81ed6132761023bf43755f13122ddf0
> >
> >
> >
> >
> >
> > U-Boot is still doing wrong,
> > and core developers in U-Boot do not understand this, unfortunately.
>
> While this works in many cases we do seem to have problems with some
> toolchains. Perhaps things are better now as my problems were a a few
> years back. Things like size_t with %z caused problems too. I remember
> m68k producing warnings when I tried this.
>
> I am certainly interested in converting over to this other approach. I
> am also OK with the PRi stuff, since it only affects a relatively
> small number of cases.
It would certainly be worth giving things another try with current
compilers.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180803/467aba57/attachment.sig>
next prev parent reply other threads:[~2018-08-03 15:01 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 13:59 [U-Boot] [PATCH 0/9] Support 4GB of memory on 32bit systems Philipp Tomsich
2018-07-26 13:59 ` [U-Boot] [PATCH 1/9] dm: allow 4GB of DRAM " Philipp Tomsich
2018-08-02 20:36 ` Simon Glass
2018-08-02 21:31 ` Dr. Philipp Tomsich
2018-09-02 11:10 ` Alexander Graf
2018-09-02 16:04 ` Vagrant Cascadian
2018-09-02 17:49 ` Alexander Graf
2018-09-03 14:29 ` Lokesh Vutla
2018-09-14 10:53 ` Simon Glass
2018-09-14 11:03 ` Philipp Tomsich
2019-01-19 15:21 ` Rask Ingemann Lambertsen
2018-07-26 13:59 ` [U-Boot] [PATCH 2/9] rockchip: support 4GB " Philipp Tomsich
2018-07-26 20:05 ` Carlo Caione
2018-07-26 20:08 ` Dr. Philipp Tomsich
2018-07-26 20:09 ` Dr. Philipp Tomsich
2018-07-26 22:54 ` Dr. Philipp Tomsich
2018-07-27 7:50 ` Carlo Caione
2018-07-27 9:12 ` Dr. Philipp Tomsich
2018-07-26 13:59 ` [U-Boot] [PATCH 3/9] common: include <inttypes.h> always Philipp Tomsich
2018-07-31 1:41 ` Masahiro Yamada
2018-08-02 16:56 ` Simon Glass
2018-08-03 15:01 ` Tom Rini [this message]
2018-08-06 2:54 ` Masahiro Yamada
2018-08-02 8:46 ` Patrick DELAUNAY
2018-07-26 13:59 ` [U-Boot] [PATCH 4/9] MIPS: use PRIx64 macros for printing ram size Philipp Tomsich
2018-08-02 20:36 ` Simon Glass
2018-08-07 14:41 ` Daniel Schwierzeck
2018-07-26 13:59 ` [U-Boot] [PATCH 5/9] rockchip: rk3368: change type of ram-size field for a min()-calculation Philipp Tomsich
2018-08-02 20:36 ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 6/9] ram: stm32mp1: use PRIx64 macros for printing ram size Philipp Tomsich
2018-08-02 8:52 ` Patrick DELAUNAY
2018-08-02 16:56 ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 7/9] board: keymile: add explicit cast to truncate the 64bit ram size field Philipp Tomsich
2018-08-02 20:36 ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 8/9] board: cm_fx6: use PRIx64 macros for printing ram size Philipp Tomsich
2018-07-31 1:42 ` Masahiro Yamada
2018-08-02 20:36 ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 9/9] mpc85xx: add casts for ram size in min() calculation Philipp Tomsich
2018-07-26 16:12 ` York Sun
2018-08-11 1:44 ` [U-Boot] [PATCH 0/9] Support 4GB of memory on 32bit systems Tom Rini
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=20180803150111.GH32145@bill-the-cat \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.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