[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Multiple reverts] [RFC PATCH] build: include/compat: figure out which other compat headers are needed


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 12 Jan 2023 12:21:54 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ia2sbsa1r4vbw0b9jirnccNid+oPcdF6VmK/PXk2qcM=; b=UPjeHVUUehM0p27YdnRAP7+KKu6wXmKiUPuy4Tnz7cIL/EX9IkGhmTxKvv22oE93ep3RSVHrKNhoyZT55ec7dCuA/weHcHGFfRuN+xlswdGUZpgxcITbZ/0Ji2RxndApBYaOTfBCr3hIofS6pxZOiPN3msa8BgIvYxHZ8fjZExsAB+ZDZQivhJShZJasqmW8gPl7MkroQtnt+oQutxDimwvKh8qLIUSW1oO3dJilqHofTq9hKaQbluXs55n4i/LSk9+xsn+w+lWHB3kmP9VvffyQNIvmzr0Ir6tLH+yLTdEjneJ9jl/E5/xLHDkbh8aKkzvgbn1uZoXOdIe60bKbPA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aIzc44BPZjWDGItMctV5mLhr6+8J7s1YMwyB1U454FWL5hQdt/a8Yr1cQe08gS6VR3qyGL4b5sxb4Do/jGB86lF56sEF7LedZpdiGrOg3Ve9smncYQtNCIQ94+VSEDbkJNSuwCTnLzwKmsI3Luu7cBpwH7USFUMESLVpu0apLX7e2dQQFFHsQoYxHfsVwf6qg0Wu0VFIpkhUmg2G+5Vqbh1Q1QsjN1aFbq7MIWYmSEaC/n0kA9vp0XJugPWzjhiiYa2+aAUdTQH9uTsEZnpytyQXwrN2tD9I/+qw37f5Bi6I+H1QFzxnmNv9SCEAFldGWxlMhvKL00QZ0nOnkYzL9w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: George Dunlap <George.Dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 12 Jan 2023 11:22:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.01.2023 12:02, Andrew Cooper wrote:
> On 12/01/2023 7:46 am, Jan Beulich wrote:
>> On 11.01.2023 23:29, Andrew Cooper wrote:
>>> For posterity,
>>> https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/3585379553 is
>>> the issue in question.
>>>
>>> In file included from arch/x86/hvm/hvm.c:82:
>>> ./include/compat/hvm/hvm_op.h:6:10: fatal error: ../trace.h: No such
>>> file or directory
>>>     6 | #include "../trace.h"
>>>       |          ^~~~~~~~~~~~
>>> compilation terminated.
>>> make[4]: *** [Rules.mk:246: arch/x86/hvm/hvm.o] Error 1
>>> make[3]: *** [Rules.mk:320: arch/x86/hvm] Error 2
>>> make[3]: *** Waiting for unfinished jobs....
>>>
>>>
>>> All public headers use "../" relative includes for traversing the
>>> public/ hierarchy.  This cannot feasibly change given our "copy this
>>> into your project" stance, but it means the compat headers have the same
>>> structure under compat/.
>>>
>>> This include is supposed to be including compat/trace.h but it was
>>> actually picking up x86's asm/trace.h, hence the build failure now that
>>> I've deleted the file.
>>>
>>> This demonstrates that trying to be clever with -iquote is a mistake. 
>>> Nothing good can possibly come of having the <> and "" include paths
>>> being different.  Therefore we must revert all uses of -iquote.
>> I'm afraid I can't see the connection between use of -iquote and the bug
>> here.
> 
> So I had concluded (wrongly) that it was to do with an asymmetry of
> include paths, but it's not.  <../$x> would behave the same, even if it
> is a bit more obviously wrong.
> 
> The actual problem is the use of ./ or ../ because, despite how they
> read, they are never relative to the current file.  The contents between
> the "" or <> is treated as a string literal and not interpreted by CPP.

First of all the C spec says nothing about how searching is performed.
It's all implementation defined.

Gcc documentation in turn is quite explicit: "By default, the
preprocessor looks for header files included by the quote form of the
directive #include "file" first relative to the directory of the
current file, and then ..." This is behavior I know from all compilers
I've ever worked with, so while not part of the C standard it is
(hopefully) something we can rely upon (or specify as a requirement
for people wanting to use the headers unmodified).

So I agree using ../ inside angle backets would be bogus at best, but
I think using such inside double quotes is sufficient generically okay.
Hence ...

> So furthermore, the public headers are buggy in their use of ../ because
> it is an implicit dependency on -I/path/to/xen/headers/dir/ being
> earlier on the include path than other dirs with these fairly generic
> and not-xen-prefixed file names.

... I don't see any bugginess here.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.