This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Avoid using strtoll


> This is wrong: it should be PR bootstrap/42096 instead.

Will fix that. Thanks

> diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
> index 8cbafbc..4a8a0ff 100644
> --- a/lto-plugin/lto-plugin.c
> +++ b/lto-plugin/lto-plugin.c
> @@ -551,7 +551,7 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
> Â Â Â Elf *archive;
> Â Â Â off_t offset;
> Â Â Â /* We pass the offset of the actual file, not the archive header. */
> - Â Â Âint t = asprintf (&objname, "%s@%" PRId64, file->name,
> + Â Â Âint t = asprintf (&objname, "%s@0x%" PRIx64, file->name,
>
> Unconditional use of PRI* is problematic, either: older platforms lack
> it, although I'm not sure if this affects ELF platforms at the moment
> (IRIX 5, probably).
>
> cf. intl/loadmsgcat.c for a workaround, although that doesn't work as is
> because you cannot use constructs like
>
> # define PRId64 (sizeof (long) == 8 ? "ld" : "lld")
>
> with string concatenation.

This code is part of the gold plugin, so I am not sure portability is
a problem. If it is, would this be OK if I used the define you
mentioned and 2 calls to asprintf?

> Â Â Â ÂRainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>

Cheers,
-- 
Rafael Ãvila de EspÃndola


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]