public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] Query Errors / warnings observed on edk2/EmbeddedPkg
@ 2024-02-02 10:14 Jayaprakash, N
  2024-02-02 14:33 ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Jayaprakash, N @ 2024-02-02 10:14 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Kinney, Michael D


[-- Attachment #1.1: Type: text/plain, Size: 3391 bytes --]

Hi All,

Is the EmbeddedPkg being actively developed by the Tianocore / edk2 community?

I saw following Warnings & errors while trying to build it.

Want to check with the community leaders if it is worth investing time in raising BZ and fixing these errors / warnings?

Please find the details of the errors / warnings as given below:


1)
SyntaxWarning: invalid escape sequence '\C'

This warning message is seen with the latest edk2 code available in the main branch.
part of the build logs are copied over here for reference.

C:\Users\njayapra\github\edk2_work\edk2>build -b RELEASE -t VS2019 -a X64 -p EmbeddedPkg\EmbeddedPkg.dsc
C:\Users\njayapra\github\edk2_work\edk2\BaseTools\Source\Python\Workspace\DscBuildData.py:2952: SyntaxWarning: invalid escape sequence '\C'
  PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source\C\Common\PcdValueCommon.c"))



  1.  error C2036: 'void *': unknown size



c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\PrePiMemoryAllocationLib\MemoryAllocationLib.c(311): error C2036: 'void *': unknown size


  1.  More errors and warnings:
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(83): error C2220: the following warning is treated as an error
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(83): warning C4244: 'function': conversion from 'int' to 'UINT8', possible loss of data
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(93): warning C4244: 'return': conversion from 'INTN' to 'int', possible loss of data
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(103): warning C4244: 'function': conversion from 'int' to 'UINT8', possible loss of data
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(122): warning C4244: '=': conversion from 'int' to 'char', possible loss of data
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt.c(93): warning C4018: '<': signed/unsigned mismatch
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt.c(101): warning C4018: '<': signed/unsigned mismatch
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt.c(302): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt.c(324): warning C4018: '>': signed/unsigned mismatch



Regards,
Jayaprakash Nevara,
System Software Architect
CCG-CPE-C4S-India
PyUEFI - Tianocore Project<https://github.com/tianocore/edk2-libc/tree/master/AppPkg/Applications/Python/Python-3.6.8>; Yammer Group<https://web.yammer.com/main/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI5OTYwMDE3OTIwMCJ9/all>
CCG Python Academy<https://degreed.com/plan/3127217?newWindow=true>
[cid:image001.png@01DA55EE.A8F4E4D0]Rust Programming - Yammer Group<https://web.yammer.com/main/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIxNDM2MTA2NTg4MTYifQ/all>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115035): https://edk2.groups.io/g/devel/message/115035
Mute This Topic: https://groups.io/mt/104116832/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #1.2: Type: text/html, Size: 11596 bytes --]

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 8978 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] Query Errors / warnings observed on edk2/EmbeddedPkg
  2024-02-02 10:14 [edk2-devel] Query Errors / warnings observed on edk2/EmbeddedPkg Jayaprakash, N
@ 2024-02-02 14:33 ` Laszlo Ersek
  2024-02-02 14:54   ` Jayaprakash, N
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2024-02-02 14:33 UTC (permalink / raw)
  To: devel, n.jayaprakash; +Cc: Kinney, Michael D

On 2/2/24 11:14, Jayaprakash, N wrote:
> Hi All,
> 
>  
> 
> Is the EmbeddedPkg being actively developed by the Tianocore / edk2
> community?
> 
>  
> 
> I saw following Warnings & errors while trying to build it.
> 
>  
> 
> Want to check with the community leaders if it is worth investing time
> in raising BZ and fixing these errors / warnings?
> 
>  
> 
> Please find the details of the errors / warnings as given below:
> 
>  
> 
> 1) 
> 
> SyntaxWarning: invalid escape sequence '\C'
> 
>  
> 
> This warning message is seen with the latest edk2 code available in the
> main branch.
> 
> part of the build logs are copied over here for reference.
> 
>  
> 
> C:\Users\njayapra\github\edk2_work\edk2>build -b RELEASE -t VS2019 -a
> X64 -p EmbeddedPkg\EmbeddedPkg.dsc
> 
> C:\Users\njayapra\github\edk2_work\edk2\BaseTools\Source\Python\Workspace\DscBuildData.py:2952: SyntaxWarning: invalid escape sequence '\C'
> 
>   PcdValueCommonPath =
> os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"],
> "Source\C\Common\PcdValueCommon.c"))
> 

I can't really comment on this; it is from a relatively old commit -- 484b1534ed8f ("BaseTools:copy the common PcdValueCommon.c to output directory", 2020-03-12).


>  
> 
>  
> 
>  2. error C2036: 'void *': unknown size
> 
>  
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\PrePiMemoryAllocationLib\MemoryAllocationLib.c(311): error C2036: 'void *': unknown size
> 

This is a bug; please file a BZ. We shouldn't be doing pointer arithmetic on (VOID*).

We should replace (UINTN)(OldBuffer + OldSize) with ((UINTN)OldBuffer + OldSize).

>  
> 
>  3. More errors and warnings:
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(83): error C2220: the following warning is treated as an error
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(83): warning C4244: 'function': conversion from 'int' to 'UINT8', possible loss of data
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(93): warning C4244: 'return': conversion from 'INTN' to 'int', possible loss of data

Filing a BZ for investigating these seems worthwhile too. For example:

     86 static inline int
     87 memcmp (
     88   const void  *dest,
     89   const void  *src,
     90   int         len
     91   )
     92 {
     93   return CompareMem (dest, src, len);
     94 }

CompareMem returns INTN, which can be INT64, so the warning is *theoretically* correct. It's easy to shut up with an explicit cast to "int". Here's why such a cast is safe: the CompareMem documentation says,

  @retval Non-zero          The first mismatched byte in SourceBuffer subtracted from the first
                            mismatched byte in DestinationBuffer.

so that will fit in a plain "int" too.

Etc.

Laszlo

> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(103): warning C4244: 'function': conversion from 'int' to 'UINT8', possible loss of data
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env.h(122): warning C4244: '=': conversion from 'int' to 'char', possible loss of data
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt.c(93): warning C4018: '<': signed/unsigned mismatch
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt.c(101): warning C4018: '<': signed/unsigned mismatch
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt.c(302): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt.c(324): warning C4018: '>': signed/unsigned mismatch
> 
>  
> 
>  
> 
>  
> 
> Regards,
> 
> Jayaprakash Nevara,
> 
> System Software Architect
> 
> CCG-CPE-C4S-India
> 
> PyUEFI - Tianocore Project
> <https://github.com/tianocore/edk2-libc/tree/master/AppPkg/Applications/Python/Python-3.6.8>; Yammer Group <https://web.yammer.com/main/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI5OTYwMDE3OTIwMCJ9/all>
> 
> CCG Python Academy <https://degreed.com/plan/3127217?newWindow=true>
> 
> Rust Programming – Yammer Group
> <https://web.yammer.com/main/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIxNDM2MTA2NTg4MTYifQ/all>
> 
>  
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115050): https://edk2.groups.io/g/devel/message/115050
Mute This Topic: https://groups.io/mt/104116832/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] Query Errors / warnings observed on edk2/EmbeddedPkg
  2024-02-02 14:33 ` Laszlo Ersek
@ 2024-02-02 14:54   ` Jayaprakash, N
  0 siblings, 0 replies; 3+ messages in thread
From: Jayaprakash, N @ 2024-02-02 14:54 UTC (permalink / raw)
  To: Laszlo Ersek, devel@edk2.groups.io; +Cc: Kinney, Michael D

Thanks Laszlo for your comments.
I shall rise BZ and also contribute to the fixes through PRs.

Regards,
JP

-----Original Message-----
From: Laszlo Ersek <lersek@redhat.com> 
Sent: Friday, February 2, 2024 8:03 PM
To: devel@edk2.groups.io; Jayaprakash, N <n.jayaprakash@intel.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] Query Errors / warnings observed on edk2/EmbeddedPkg

On 2/2/24 11:14, Jayaprakash, N wrote:
> Hi All,
> 
>  
> 
> Is the EmbeddedPkg being actively developed by the Tianocore / edk2 
> community?
> 
>  
> 
> I saw following Warnings & errors while trying to build it.
> 
>  
> 
> Want to check with the community leaders if it is worth investing time 
> in raising BZ and fixing these errors / warnings?
> 
>  
> 
> Please find the details of the errors / warnings as given below:
> 
>  
> 
> 1)
> 
> SyntaxWarning: invalid escape sequence '\C'
> 
>  
> 
> This warning message is seen with the latest edk2 code available in 
> the main branch.
> 
> part of the build logs are copied over here for reference.
> 
>  
> 
> C:\Users\njayapra\github\edk2_work\edk2>build -b RELEASE -t VS2019 -a
> X64 -p EmbeddedPkg\EmbeddedPkg.dsc
> 
> C:\Users\njayapra\github\edk2_work\edk2\BaseTools\Source\Python\Workspace\DscBuildData.py:2952: SyntaxWarning: invalid escape sequence '\C'
> 
>   PcdValueCommonPath =
> os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"],
> "Source\C\Common\PcdValueCommon.c"))
> 

I can't really comment on this; it is from a relatively old commit -- 484b1534ed8f ("BaseTools:copy the common PcdValueCommon.c to output directory", 2020-03-12).


>  
> 
>  
> 
>  2. error C2036: 'void *': unknown size
> 
>  
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\PrePiMemor
> yAllocationLib\MemoryAllocationLib.c(311): error C2036: 'void *': 
> unknown size
> 

This is a bug; please file a BZ. We shouldn't be doing pointer arithmetic on (VOID*).

We should replace (UINTN)(OldBuffer + OldSize) with ((UINTN)OldBuffer + OldSize).

>  
> 
>  3. More errors and warnings:
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env
> .h(83): error C2220: the following warning is treated as an error
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env
> .h(83): warning C4244: 'function': conversion from 'int' to 'UINT8', 
> possible loss of data
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env
> .h(93): warning C4244: 'return': conversion from 'INTN' to 'int', 
> possible loss of data

Filing a BZ for investigating these seems worthwhile too. For example:

     86 static inline int
     87 memcmp (
     88   const void  *dest,
     89   const void  *src,
     90   int         len
     91   )
     92 {
     93   return CompareMem (dest, src, len);
     94 }

CompareMem returns INTN, which can be INT64, so the warning is *theoretically* correct. It's easy to shut up with an explicit cast to "int". Here's why such a cast is safe: the CompareMem documentation says,

  @retval Non-zero          The first mismatched byte in SourceBuffer subtracted from the first
                            mismatched byte in DestinationBuffer.

so that will fit in a plain "int" too.

Etc.

Laszlo

> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env
> .h(103): warning C4244: 'function': conversion from 'int' to 'UINT8', 
> possible loss of data
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Include\libfdt_env
> .h(122): warning C4244: '=': conversion from 'int' to 'char', possible 
> loss of data
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt
> .c(93): warning C4018: '<': signed/unsigned mismatch
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt
> .c(101): warning C4018: '<': signed/unsigned mismatch
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt
> .c(302): warning C4267: 'initializing': conversion from 'size_t' to 
> 'int', possible loss of data
> 
> c:\users\njayapra\github\edk2_work\edk2\EmbeddedPkg\Library\FdtLib\fdt
> .c(324): warning C4018: '>': signed/unsigned mismatch
> 
>  
> 
>  
> 
>  
> 
> Regards,
> 
> Jayaprakash Nevara,
> 
> System Software Architect
> 
> CCG-CPE-C4S-India
> 
> PyUEFI - Tianocore Project
> <https://github.com/tianocore/edk2-libc/tree/master/AppPkg/Application
> s/Python/Python-3.6.8>; Yammer Group 
> <https://web.yammer.com/main/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI5OT
> YwMDE3OTIwMCJ9/all>
> 
> CCG Python Academy <https://degreed.com/plan/3127217?newWindow=true>
> 
> Rust Programming – Yammer Group
> <https://web.yammer.com/main/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIxND
> M2MTA2NTg4MTYifQ/all>
> 
>  
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115057): https://edk2.groups.io/g/devel/message/115057
Mute This Topic: https://groups.io/mt/104116832/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-02 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02 10:14 [edk2-devel] Query Errors / warnings observed on edk2/EmbeddedPkg Jayaprakash, N
2024-02-02 14:33 ` Laszlo Ersek
2024-02-02 14:54   ` Jayaprakash, N

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox