public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Andrew Fish <afish@apple.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>,
	stephano <stephano.cetola@linux.intel.com>,
	edk2-devel@lists.01.org
Subject: Re: TianoCore Community Meeting Minutes
Date: Fri, 12 Oct 2018 11:50:39 -0700	[thread overview]
Message-ID: <8D8324EA-9CE4-4479-B948-56086A6F9ECD@apple.com> (raw)
In-Reply-To: <180aa195-2e56-06a6-ef66-747e6c3210f7@redhat.com>



> On Oct 12, 2018, at 9:07 AM, Laszlo Ersek <lersek@redhat.com> wrote:
> 
> On 10/12/18 15:27, Leif Lindholm wrote:
>> On Thu, Oct 11, 2018 at 10:43:57AM -0700, stephano wrote:
> 
>>> Switching to Standard C Types
>>> -----------------------------
>>> Both Shawn and Nate mentioned that the current system has been in place for
>>> a long time and some people prefer the current setup. I can start an email
>>> discussion around this issue specifically if anyone feels strongly that we
>>> should be using standard types.
>> 
>> So, I don't think we made it this far down the agenda on the US-EU
>> call.
>> 
>> One way would be to simply explicitly permit it, possibly with the
>> constraint that every module needs to pick one and stick with it,
>> unless people object.
>> 
>> I think we'll want to discuss this in a US-EU call as well.
> 
> I'm playing devil's advocate here -- because, in general, I'm a fan of
> sticking with standard C as much as possible --, but I see a big
> obstacle in the way.
> 
> That obstacle is "Table 5. Common UEFI Data Types", in the UEFI spec.
> Until a good portion of that table is expressed in terms of standard C
> types as well (expanding upon the current definitions), possibly in an
> edk2-level spec (i.e. not necessarily in the UEFI spec itself), I think
> there's no chance to enable standard C types in edk2 *meaningfully*.
> 
> Because, as soon as you have to call a PI or UEFI interface, you'll have
> to stick with the PI/UEFI spec types anyway.
> 

Lazlo,

Given there is also a C ABI for each supported processor architecture in the UEFI spec it should be possible to define the EFI types in terms of C types. The only potential issue is I'm not sure BOOLEAN maps to bool in all cases? 

https://github.com/tianocore/edk2/blob/master/MdePkg/Include/X64/ProcessorBind.h#L188
So
typedef __int64    UINT64; 
or
typedef long long INT64;

becomes:
typedef int64_t    INT64;

Thus we could move the definition of UINT64, INT64, UINT32, INT32, UINT16, INT16, UINT8, INT8, CHAR, and CHAR16 to Base.h and have ProcessorBind.h just define the C standard types for a given architecture. 

The tricky part is when there are different answers to the question are you using a standard C lib. Basically the definitions in MdePkg/Include/X64/ProcessorBind.h could conflict with stdint.h. Almost seems like you would need a build flag to control if you use stdint.h. 


I think the bigger question is what problem are we trying to solve? If some one is programming with uint32_t are they going to expect printf(), memcpy(), etc. We solve that problem today StdLib? I guess we only have an option of the full pedantic C lib (I can't remember if StdLib depends on the shell?), or nothing. Are we trying to define a light weight C lib that works in the firmware code? How much of the C lib do we need to make that useful? 

Thanks,

Andrew Fish

PS Speaking of printf() != Print() or DEBUG()... I see a lot of people botching Print() in EFI. It would nice if we could get compiler warnings for miss use.

You can add printf warnings to any functing in 
int 
my_printf (void *my_object, const char *my_format, ...)   __attribute__ ((format (printf, 2, 3)));

It would be awesome if we could add edk2_print to at least gcc and clang. Given they are open source projects anything is possible. Not sure how this works on VC++?

> 
>>> Using Git Submodules (like we do with OpenSSL)
>>> --------------------
>> 
>> We didn't make it here either. What would we use it _for_?
>> I think the openssl case makes a lot of sense, but what else?
> 
> We embed a bunch of other projects (libraries, mainly):
> - Oniguruma
> - Brotli
> - fdt
> - LZMA SDK
> - ...
> 
> Thanks
> Laszlo
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



  parent reply	other threads:[~2018-10-12 18:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11 17:43 TianoCore Community Meeting Minutes stephano
2018-10-12 13:27 ` Leif Lindholm
2018-10-12 16:07   ` Laszlo Ersek
2018-10-12 18:06     ` Leif Lindholm
2018-10-12 18:30       ` Kinney, Michael D
2018-10-12 19:44         ` Andrew Fish
2018-10-12 18:50     ` Andrew Fish [this message]
2018-10-14 21:15   ` stephano
2018-10-12 20:28 ` Andrew Fish
  -- strict thread matches above, loose matches on Subject: below --
2018-10-19 16:09 Jeremiah Cox
2018-10-22 10:14 ` Laszlo Ersek

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=8D8324EA-9CE4-4479-B948-56086A6F9ECD@apple.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