diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-02-23 05:51:02 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-02-23 05:51:02 +0000 |
commit | 5cfbd055878dcca6f3e4081fc5c8805fd2ce7107 (patch) | |
tree | 541c3b9bb643efbcb30860fd2460223f3ae5f4f0 /MdePkg | |
parent | 04985a579c321272ba3cb5790f1ed5dc698616c4 (diff) | |
download | edk2-platforms-5cfbd055878dcca6f3e4081fc5c8805fd2ce7107.tar.xz |
1, Use #if defined() to judge the switching macro such as compiler macro.
Original, some code directly judge the value of these macros, but linux ICC compiler will report error as "zero used for undefined preprocessing identifier". So it is better judge whether these macros are defined before accessing their value.
2, Use #if defined() style to replace #ifdef style.
It is good to keep consistent style for this case.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7596 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Include/Ia32/ProcessorBind.h | 16 | ||||
-rw-r--r-- | MdePkg/Include/Ipf/ProcessorBind.h | 14 | ||||
-rw-r--r-- | MdePkg/Include/X64/ProcessorBind.h | 18 |
3 files changed, 24 insertions, 24 deletions
diff --git a/MdePkg/Include/Ia32/ProcessorBind.h b/MdePkg/Include/Ia32/ProcessorBind.h index 5f29bb3e09..e6d1a7da90 100644 --- a/MdePkg/Include/Ia32/ProcessorBind.h +++ b/MdePkg/Include/Ia32/ProcessorBind.h @@ -23,11 +23,11 @@ //
// Make sure we are using the correct packing rules per EFI specification
//
-#ifndef __GNUC__
+#if !defined(__GNUC__)
#pragma pack()
#endif
-#if __INTEL_COMPILER
+#if defined(__INTEL_COMPILER)
//
// Disable ICC's remark #869: "Parameter" was never referenced warning.
// This is legal ANSI C code so we disable the remark that is turned on with -Wall
@@ -49,7 +49,7 @@ #endif
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
//
// Disable warning that make it impossible to compile at /W4
@@ -95,7 +95,7 @@ // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
//
- #if _MSC_EXTENSIONS
+ #if defined(_MSC_EXTENSIONS)
//
// use Microsoft C complier dependent integer width types
@@ -295,13 +295,13 @@ typedef INT32 INTN; // use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify their member functions with EFIAPI.
//
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
///
/// Microsoft* compiler specific method for EFIAPI calling convension
///
#define EFIAPI __cdecl
#else
- #if __GNUC__
+ #if defined(__GNUC__)
///
/// GCC specific method for EFIAPI calling convension
///
@@ -314,7 +314,7 @@ typedef INT32 INTN; // if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
///
/// Remove global variable from the linked image if there are no references to
/// it after all compiler and linker optimizations have been performed.
@@ -331,7 +331,7 @@ typedef INT32 INTN; //
// For symbol name in GNU assembly code, an extra "_" is necessary
//
-#if __GNUC__
+#if defined(__GNUC__)
#if defined(linux)
#define ASM_PFX(name) name
#else
diff --git a/MdePkg/Include/Ipf/ProcessorBind.h b/MdePkg/Include/Ipf/ProcessorBind.h index d92f16ca27..eb31c3f7bd 100644 --- a/MdePkg/Include/Ipf/ProcessorBind.h +++ b/MdePkg/Include/Ipf/ProcessorBind.h @@ -28,7 +28,7 @@ #pragma pack()
-#if __INTEL_COMPILER
+#if defined(__INTEL_COMPILER)
//
// Disable ICC's remark #869: "Parameter" was never referenced warning.
// This is legal ANSI C code so we disable the remark that is turned on with -Wall
@@ -50,7 +50,7 @@ #endif
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
//
// Disable warning that make it impossible to compile at /W4
// This only works for Microsoft* tools
@@ -101,12 +101,12 @@ #endif
-#if (__STDC_VERSION__ < 199901L)
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ < 199901L)
//
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
//
- #if _MSC_EXTENSIONS
+ #if defined(_MSC_EXTENSIONS)
//
// use Microsoft C complier dependent integer width types
//
@@ -158,7 +158,7 @@ ///
typedef char INT8;
#else
- #ifdef _EFI_P64
+ #if defined(_EFI_P64)
//
// P64 - pointers being 64-bit and longs and ints are 32-bits.
//
@@ -358,7 +358,7 @@ typedef INT64 INTN; // use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify their member functions with EFIAPI.
//
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
///
/// Microsoft* compiler specific method for EFIAPI calling convension
///
@@ -372,7 +372,7 @@ typedef INT64 INTN; // if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
///
/// Remove global variable from the linked image if there are no references to
/// it after all compiler and linker optimizations have been performed.
diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h index f1b0339a12..71f5277538 100644 --- a/MdePkg/Include/X64/ProcessorBind.h +++ b/MdePkg/Include/X64/ProcessorBind.h @@ -24,12 +24,12 @@ //
// Make sure we are using the correct packing rules per EFI specification
//
-#ifndef __GNUC__
+#if !defined(__GNUC__)
#pragma pack()
#endif
-#if __INTEL_COMPILER
+#if defined(__INTEL_COMPILER)
//
// Disable ICC's remark #869: "Parameter" was never referenced warning.
// This is legal ANSI C code so we disable the remark that is turned on with -Wall
@@ -51,7 +51,7 @@ #endif
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
//
// Disable warning that make it impossible to compile at /W4
@@ -97,7 +97,7 @@ // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
//
- #if _MSC_EXTENSIONS
+ #if defined(_MSC_EXTENSIONS)
//
// use Microsoft C complier dependent integer width types
//
@@ -149,7 +149,7 @@ ///
typedef char INT8;
#else
- #ifdef _EFI_P64
+ #if defined(_EFI_P64)
//
// P64 - pointers being 64-bit and longs and ints are 32-bits.
//
@@ -348,12 +348,12 @@ typedef INT64 INTN; // use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify their member functions with EFIAPI.
//
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
///
/// Microsoft* compiler specific method for EFIAPI calling convension
///
#define EFIAPI __cdecl
-#elif __GNUC__
+#elif defined(__GNUC__)
///
/// Define the standard calling convention reguardless of optimization level.
/// The GCC support assumes a GCC compiler that supports the EFI ABI. The EFI
@@ -376,7 +376,7 @@ typedef INT64 INTN; // if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
-#if _MSC_EXTENSIONS
+#if defined(_MSC_EXTENSIONS)
///
/// Remove global variable from the linked image if there are no references to
/// it after all compiler and linker optimizations have been performed.
@@ -395,7 +395,7 @@ typedef INT64 INTN; //
// For symbol name in GNU assembly code, an extra "_" is necessary
//
-#if __GNUC__
+#if defined(__GNUC__)
#if defined(linux)
#define ASM_PFX(name) name
#else
|