From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH 2/4] lib/alloc: fix format warnings, add/use PRIx64 Date: Tue, 1 Mar 2016 12:04:01 +0100 Message-ID: <56D57721.7050807@redhat.com> References: <1456777155-8599-1-git-send-email-drjones@redhat.com> <1456777155-8599-3-git-send-email-drjones@redhat.com> <56D5218C.8040204@redhat.com> <20160301091539.e5l2uec4iv6kfsn5@hawk.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, rkrcmar@redhat.com To: Andrew Jones , Thomas Huth Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50080 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752430AbcCALEF (ORCPT ); Tue, 1 Mar 2016 06:04:05 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 290A77F08C for ; Tue, 1 Mar 2016 11:04:05 +0000 (UTC) In-Reply-To: <20160301091539.e5l2uec4iv6kfsn5@hawk.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: On 01/03/2016 10:15, Andrew Jones wrote: >> > So libcflat uses the header stdint.h from the standard gcc installation >> > to get the uint64_t and friends, but you define the PRIx64 etc. here >> > manually? That sounds strange... You could simply include "inttypes.h" >> > instead of "stdint.h" in this libcflat.h header file, then you would get >> > PRIx64 and friends automatically instead. > We can only include headers that are provided by libgcc in arch-neutral > files like libcflat, in order for cross-compiling to work. inttypes.h > isn't available. Yup, inttypes.h is not part of the freestanding environment. > > OTOH, for a stand-alone binary like kvm-unit-tests, it's also somewhat > > risky to compile without "-nostdinc" since unwanted headers might be > > included that way (e.g. what happens if someone writes "#include > > " by accident? You likely get some nice confusion...). So maybe > > it would be better to compile with "-nostdinc" instead and define all > > necessary things manually here? > > We don't have -nostdinc because sometimes the x86 tests cheat and use > standard includes. arm and powerpc Makefiles could/should add it though, > as they don't currently cheat, and it's probably best if they never do. Some of the includes are part of the freestanding environment: float.h, iso646.h, limits.h, stdarg.h, stdbool.h, stddef.h, stdint.h and probably a few more in C11 (e.g. stdalign.h, stdatomic.h, stdnoreturn.h). Using them is not cheating. Paolo