[edk2] [PATCH 1/4] MdePkg: Disable some Level 4 warnings for VS2017/ARM64

Pete Batard posted 4 patches 6 years, 10 months ago
[edk2] [PATCH 1/4] MdePkg: Disable some Level 4 warnings for VS2017/ARM64
Posted by Pete Batard 6 years, 10 months ago
We disable the exact same warnings as IA32 and X64.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
---
 MdePkg/Include/AArch64/ProcessorBind.h | 53 +++++++++++++++++++-
 1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
index bc473562f9e5..4f341ebeb03f 100644
--- a/MdePkg/Include/AArch64/ProcessorBind.h
+++ b/MdePkg/Include/AArch64/ProcessorBind.h
@@ -1,7 +1,7 @@
 /** @file
   Processor or Compiler specific defines and types for AArch64.
 
-  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
 
@@ -30,7 +30,56 @@
 #pragma pack()
 #endif
 
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
+
+//
+// Disable some level 4 compilation warnings (same as IA32 and X64)
+//
+
+//
+// Disabling bitfield type checking warnings.
+//
+#pragma warning ( disable : 4214 )
+
+//
+// Disabling the unreferenced formal parameter warnings.
+//
+#pragma warning ( disable : 4100 )
+
+//
+// Disable slightly different base types warning as CHAR8 * can not be set
+// to a constant string.
+//
+#pragma warning ( disable : 4057 )
+
+//
+// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
+//
+#pragma warning ( disable : 4127 )
+
+//
+// This warning is caused by functions defined but not used. For precompiled header only.
+//
+#pragma warning ( disable : 4505 )
+
+//
+// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
+//
+#pragma warning ( disable : 4206 )
+
+//
+// Disable 'potentially uninitialized local variable X used' warnings
+//
+#pragma warning ( disable : 4701 )
+
+//
+// Disable 'potentially uninitialized local pointer variable X used' warnings
+//
+#pragma warning ( disable : 4703 )
+
+#endif
+
+#if defined(_MSC_EXTENSIONS)
   //
   // use Microsoft* C compiler dependent integer width types
   //
-- 
2.9.3.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 1/4] MdePkg: Disable some Level 4 warnings for VS2017/ARM64
Posted by Ard Biesheuvel 6 years, 10 months ago
On 14 February 2018 at 13:08, Pete Batard <pete@akeo.ie> wrote:
> We disable the exact same warnings as IA32 and X64.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
>  MdePkg/Include/AArch64/ProcessorBind.h | 53 +++++++++++++++++++-
>  1 file changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
> index bc473562f9e5..4f341ebeb03f 100644
> --- a/MdePkg/Include/AArch64/ProcessorBind.h
> +++ b/MdePkg/Include/AArch64/ProcessorBind.h
> @@ -1,7 +1,7 @@
>  /** @file
>    Processor or Compiler specific defines and types for AArch64.
>
> -  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>    Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
>    Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
>
> @@ -30,7 +30,56 @@
>  #pragma pack()
>  #endif
>
> -#if _MSC_EXTENSIONS
> +#if defined(_MSC_EXTENSIONS)
> +
> +//
> +// Disable some level 4 compilation warnings (same as IA32 and X64)
> +//
> +
> +//
> +// Disabling bitfield type checking warnings.
> +//
> +#pragma warning ( disable : 4214 )
> +
> +//
> +// Disabling the unreferenced formal parameter warnings.
> +//
> +#pragma warning ( disable : 4100 )
> +
> +//
> +// Disable slightly different base types warning as CHAR8 * can not be set
> +// to a constant string.
> +//
> +#pragma warning ( disable : 4057 )
> +
> +//
> +// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
> +//
> +#pragma warning ( disable : 4127 )
> +
> +//
> +// This warning is caused by functions defined but not used. For precompiled header only.
> +//
> +#pragma warning ( disable : 4505 )
> +
> +//
> +// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
> +//
> +#pragma warning ( disable : 4206 )
> +
> +//
> +// Disable 'potentially uninitialized local variable X used' warnings
> +//
> +#pragma warning ( disable : 4701 )
> +
> +//
> +// Disable 'potentially uninitialized local pointer variable X used' warnings
> +//
> +#pragma warning ( disable : 4703 )
> +
> +#endif
> +
> +#if defined(_MSC_EXTENSIONS)

Can you drop the redundant #endif + #if please? Also, I take it
_MSC_EXTENSIONS will never be #defined to 0 ?


>    //
>    // use Microsoft* C compiler dependent integer width types
>    //
> --
> 2.9.3.windows.2
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 1/4] MdePkg: Disable some Level 4 warnings for VS2017/ARM64
Posted by Pete Batard 6 years, 10 months ago
Hi Ard,

On 2018.02.14 13:13, Ard Biesheuvel wrote:
> On 14 February 2018 at 13:08, Pete Batard <pete@akeo.ie> wrote:
>> We disable the exact same warnings as IA32 and X64.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Pete Batard <pete@akeo.ie>
>> ---
>>   MdePkg/Include/AArch64/ProcessorBind.h | 53 +++++++++++++++++++-
>>   1 file changed, 51 insertions(+), 2 deletions(-)
>>
>> diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
>> index bc473562f9e5..4f341ebeb03f 100644
>> --- a/MdePkg/Include/AArch64/ProcessorBind.h
>> +++ b/MdePkg/Include/AArch64/ProcessorBind.h
>> @@ -1,7 +1,7 @@
>>   /** @file
>>     Processor or Compiler specific defines and types for AArch64.
>>
>> -  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
>> +  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>>     Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
>>     Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
>>
>> @@ -30,7 +30,56 @@
>>   #pragma pack()
>>   #endif
>>
>> -#if _MSC_EXTENSIONS
>> +#if defined(_MSC_EXTENSIONS)
>> +
>> +//
>> +// Disable some level 4 compilation warnings (same as IA32 and X64)
>> +//
>> +
>> +//
>> +// Disabling bitfield type checking warnings.
>> +//
>> +#pragma warning ( disable : 4214 )
>> +
>> +//
>> +// Disabling the unreferenced formal parameter warnings.
>> +//
>> +#pragma warning ( disable : 4100 )
>> +
>> +//
>> +// Disable slightly different base types warning as CHAR8 * can not be set
>> +// to a constant string.
>> +//
>> +#pragma warning ( disable : 4057 )
>> +
>> +//
>> +// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
>> +//
>> +#pragma warning ( disable : 4127 )
>> +
>> +//
>> +// This warning is caused by functions defined but not used. For precompiled header only.
>> +//
>> +#pragma warning ( disable : 4505 )
>> +
>> +//
>> +// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
>> +//
>> +#pragma warning ( disable : 4206 )
>> +
>> +//
>> +// Disable 'potentially uninitialized local variable X used' warnings
>> +//
>> +#pragma warning ( disable : 4701 )
>> +
>> +//
>> +// Disable 'potentially uninitialized local pointer variable X used' warnings
>> +//
>> +#pragma warning ( disable : 4703 )
>> +
>> +#endif
>> +
>> +#if defined(_MSC_EXTENSIONS)
> 
> Can you drop the redundant #endif + #if please?

Will do. I'll probably wait another week before sending a v2, since I 
expect some reviewers to be off for Chinese New Year.

> Also, I take it
> _MSC_EXTENSIONS will never be #defined to 0 ?

According to Microsoft [1]:

Defined as 1 if the /Ze (Enable Language Extensions) compiler option is 
set, which is the default. Otherwise, undefined.

> 
> 
>>     //
>>     // use Microsoft* C compiler dependent integer width types
>>     //
>> --
>> 2.9.3.windows.2
>>

Regards,

/Pete

[1] https://msdn.microsoft.com/en-us/library/b0084kay.aspx
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel