Discussion:
[edk2] [PATCH] MdeModulePkg/Core/Pei: Fix empty loop warning
Olivier Martin
2015-07-09 18:30:23 UTC
Permalink
I have been trying to duplicate this issue using the '-pedantic' options of LLVM and GCC and I cannot reproduce this issue - even if it still present in the code.

Feng, are you happy with my initial patch - the one that aligns the code with the EDK2 coding style?


From: Andrew Fish [mailto:***@apple.com]
Sent: 16 January 2014 00:03
To: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] [PATCH] MdeModulePkg/Core/Pei: Fix empty loop warning

Olivier,

Xcode 5 does not warn by default on that construct. Would it be possible to post the warning to the mailing list? clang is good about letting you know which diagnostic warning is failing, and the compiler flag associated with that warning.

for.c:8:23: warning: comparison of unsigned expression < 0 is always false
[-Wtautological-compare]
for (i=0; i<10 || i < 0; i++);
~ ^ ~
1 warning generated.


Thanks,

Andrew Fish

On Jan 15, 2014, at 3:53 PM, Olivier Martin <***@arm.com<mailto:***@arm.com>> wrote:


Hi Feng,
the toolchain was LLVM. But my colleague who raised the issue said there were many other cases.
Thanks,
Olivier
________________________________________
From: Tian, Feng [***@intel.com<mailto:***@intel.com>]
Sent: 15 January 2014 23:34
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>; Dong, Eric
Subject: Re: [edk2] [PATCH] MdeModulePkg/Core/Pei: Fix empty loop warning

Hi, Olivier

Could you let me know which toolchains would raise warning on such usage?

I have a little curious why it doesn't happen at CpuDeadLoop() of MdePkg BaseLib.

CpuDeadLoop() {
...
for (Index = 0; Index == 0;);
}

Thanks
Feng

From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, January 15, 2014 20:29
To: Dong, Eric
Cc: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: [edk2] [PATCH] MdeModulePkg/Core/Pei: Fix empty loop warning

Dear MdeModulePkg maintainers,
Please see the attached patch that fix the PeiCore code to comply with the EDK2 Coding Standard - some toolchains raise a warning on empty loop.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com<mailto:***@arm.com><mailto:***@arm.com>>

Regards,
Olivier

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Tian, Feng
2015-07-10 01:04:29 UTC
Permalink
Martin,

I am ok with the code change, I just don't know whether the patch comment is correct and whether the code change is the real root-cause as EDKII has many such usages and why they don't raise this build warning? :(.

Thanks
Feng

From: Olivier Martin [mailto:***@arm.com]
Sent: Friday, July 10, 2015 02:30
To: edk2-***@lists.sourceforge.net; Tian, Feng
Subject: RE: [edk2] [PATCH] MdeModulePkg/Core/Pei: Fix empty loop warning

I have been trying to duplicate this issue using the '-pedantic' options of LLVM and GCC and I cannot reproduce this issue - even if it still present in the code.

Feng, are you happy with my initial patch - the one that aligns the code with the EDK2 coding style?


From: Andrew Fish [mailto:***@apple.com]
Sent: 16 January 2014 00:03
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] [PATCH] MdeModulePkg/Core/Pei: Fix empty loop warning

Olivier,

Xcode 5 does not warn by default on that construct. Would it be possible to post the warning to the mailing list? clang is good about letting you know which diagnostic warning is failing, and the compiler flag associated with that warning.

for.c:8:23: warning: comparison of unsigned expression < 0 is always false
[-Wtautological-compare]
for (i=0; i<10 || i < 0; i++);
~ ^ ~
1 warning generated.


Thanks,

Andrew Fish

On Jan 15, 2014, at 3:53 PM, Olivier Martin <***@arm.com<mailto:***@arm.com>> wrote:

Hi Feng,
the toolchain was LLVM. But my colleague who raised the issue said there were many other cases.
Thanks,
Olivier
________________________________________
From: Tian, Feng [***@intel.com<mailto:***@intel.com>]
Sent: 15 January 2014 23:34
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>; Dong, Eric
Subject: Re: [edk2] [PATCH] MdeModulePkg/Core/Pei: Fix empty loop warning

Hi, Olivier

Could you let me know which toolchains would raise warning on such usage?

I have a little curious why it doesn't happen at CpuDeadLoop() of MdePkg BaseLib.

CpuDeadLoop() {
...
for (Index = 0; Index == 0;);
}

Thanks
Feng

From: Olivier Martin [mailto:***@arm.com]
Sent: Wednesday, January 15, 2014 20:29
To: Dong, Eric
Cc: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: [edk2] [PATCH] MdeModulePkg/Core/Pei: Fix empty loop warning

Dear MdeModulePkg maintainers,
Please see the attached patch that fix the PeiCore code to comply with the EDK2 Coding Standard - some toolchains raise a warning on empty loop.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com<mailto:***@arm.com><mailto:***@arm.com>>

Regards,
Olivier

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Loading...