public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Xue, Gavin" <gavin.xue@intel.com>
To: Pedro Falcato <pedro.falcato@gmail.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"sunilvl@ventanamicro.com" <sunilvl@ventanamicro.com>
Cc: "Warkentin, Andrei" <andrei.warkentin@intel.com>,
	"Wang, Yimin" <yimin.wang@intel.com>,
	"Sheng, Alan" <alan.sheng@intel.com>
Subject: Re: [edk2-devel] [edk2 PATCH] MdePkg: Use same ProcessorBind symbol define for RISCV64
Date: Fri, 16 Jun 2023 15:51:55 +0000	[thread overview]
Message-ID: <DM6PR11MB47409615F2006C27FD45D18BFE58A@DM6PR11MB4740.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CAKbZUD0M3cEAm8SWEEHUJCGtJ2AmPQkZV0btCpgNVem_pQUr7A@mail.gmail.com>

Hi Sunil/Pedro,

1. As you know, ProcessorBind.h file of CPU Architecture file declares sets of base types for edk2 code compiling.
So data type in edk2 code doesn't rely on specific compiler (msvc, gcc etc.), which is a good design.

But in practice, for the purpose of reuse, some code can be built with edk2, and also can be built to a standalone application (e.g. Win App).
Just like below code piece:
===========
#ifndef __WRAPPER_BASE_TYPES_H__
#define __WRAPPER_BASE_TYPES_H__

//
// To avoid definition conflict during EDK2 build, it must include
// ProcessorBind.h before xxx.h
//
#ifndef __PROCESSOR_BIND_H__

#include <stdint.h>
typedef uint8_t  UINT8;
==========

In this case, if this is a edk2 build, the code will refer to data types from ProcessorBind.h, otherwise, it will refer to stdint.h from compiler.

2. Regarding the guard name, it's same __PROCESSOR_BIND_H__ macro in AArch64/Arm/Ebc/Ia32/X64, but it is PROCESSOR_BIND_H_
in RiscV64 and LoongArh64. For above code, if we build BIOS for RISCV64, it will try to include stdint.h due to different guard name.

I am not sure if we can use same guard name to keep code alignment, or give some comments. Thanks.

Best regards,
Gavin

-----Original Message-----
From: Pedro Falcato <pedro.falcato@gmail.com> 
Sent: Friday, June 16, 2023 10:12 PM
To: devel@edk2.groups.io; sunilvl@ventanamicro.com
Cc: Xue, Gavin <gavin.xue@intel.com>; Warkentin, Andrei <andrei.warkentin@intel.com>; Wang, Yimin <yimin.wang@intel.com>; Sheng, Alan <alan.sheng@intel.com>
Subject: Re: [edk2-devel] [edk2 PATCH] MdePkg: Use same ProcessorBind symbol define for RISCV64

On Fri, Jun 16, 2023 at 11:36 AM Sunil V L <sunilvl@ventanamicro.com> wrote:
>
> On Fri, Jun 16, 2023 at 03:22:57PM +0800, Gavin Xue wrote:
> > Different symbol (PROCESSOR_BIND_H__) define in RISCV64 
> > ProcessorBinding.h from other CPU Arch. An unexception compilation 
> > error generated if include __PROCESSOR_BIND_H__ symbol in header 
> > file for cross-platform compiling.

(replying through Sunil's reply as the original email doesn't seem to have been sent to the list)

What exactly is the problem here? The header has its include guard, you include it once, it defines PROCESSOR_BIND_H__, you include it twice, the #ifndef doesn't pass and nothing gets "included" again.
I really don't understand what your problem is, here. Particularly the __PROCESSOR_BIND_H__ inclusion bit, this all seems like a giant hack.

--
Pedro

  reply	other threads:[~2023-06-16 15:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16  7:22 [edk2 PATCH] MdePkg: Use same ProcessorBind symbol define for RISCV64 Gavin Xue
2023-06-16 10:35 ` Sunil V L
2023-06-16 14:11   ` [edk2-devel] " Pedro Falcato
2023-06-16 15:51     ` Xue, Gavin [this message]
2023-06-21 14:16       ` Pedro Falcato
2023-06-22  9:58         ` Xue, Gavin
2023-06-22 15:45           ` Pedro Falcato
2023-06-27 20:29           ` Michael D Kinney
2023-06-30  9:28             ` Xue, Gavin
2023-06-30 16:59               ` Michael D Kinney
2023-07-03  9:01                 ` Xue, Gavin
2023-07-03 17:01                 ` Pedro Falcato
2023-07-04  9:39                   ` Xue, Gavin

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-list 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=DM6PR11MB47409615F2006C27FD45D18BFE58A@DM6PR11MB4740.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /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