[edk2,edk2-staging,14/20] IntelUndiPkg/XGigUndiDxe: redefine UNREFERENCED_nPARAMETER macros for GCC

Message ID 20181115023353.20159-15-ard.biesheuvel@linaro.org
State New
Headers show
Series
  • IntelUndiPkg/XGigUndiDxe: fix GCC / ARM build issues
Related show

Commit Message

Ard Biesheuvel Nov. 15, 2018, 2:33 a.m.
Use (VOID) casts to silence unreferenced parameter warnings on GCC. The
existing macros generate 'statement with no effect' warnings instead,
which does not really help.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 IntelUndiPkg/XGigUndiDxe/ixgbe_type.h | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.17.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Ryszard Knop Jan. 30, 2019, 4:22 p.m. | #1
Reviewed-by: Ryszard Knop <ryszard.knop@linux.intel.com>


On Wed, 2018-11-14 at 18:33 -0800, ard.biesheuvela wrote:
> Use (VOID) casts to silence unreferenced parameter warnings on GCC.

> The

> existing macros generate 'statement with no effect' warnings instead,

> which does not really help.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>

> ---

>  IntelUndiPkg/XGigUndiDxe/ixgbe_type.h | 8 ++++++++

>  1 file changed, 8 insertions(+)

> 

> diff --git a/IntelUndiPkg/XGigUndiDxe/ixgbe_type.h

> b/IntelUndiPkg/XGigUndiDxe/ixgbe_type.h

> index e3bb1a8a313e..f67bfbfc2a9f 100644

> --- a/IntelUndiPkg/XGigUndiDxe/ixgbe_type.h

> +++ b/IntelUndiPkg/XGigUndiDxe/ixgbe_type.h

> @@ -4411,11 +4411,19 @@ struct ixgbe_hw {

>  #define IXGBE_NOT_IMPLEMENTED			0x7FFFFFFF

>  

>  #ifndef UNREFERENCED_XPARAMETER

> +#ifdef _MSC_VER

>  #define UNREFERENCED_XPARAMETER

>  #define UNREFERENCED_1PARAMETER(_p) (_p);

>  #define UNREFERENCED_2PARAMETER(_p, _q) (_p); (_q);

>  #define UNREFERENCED_3PARAMETER(_p, _q, _r) (_p); (_q); (_r);

>  #define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) (_p); (_q); (_r);

> (_s);

> +#else

> +#define UNREFERENCED_1PARAMETER(_p) (VOID)(_p)

> +#define UNREFERENCED_2PARAMETER(_p, _q) (VOID)(_p); (VOID)(_q);

> +#define UNREFERENCED_3PARAMETER(_p, _q, _r) (VOID)(_p); (VOID)(_q);

> (VOID)(_r);

> +#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) (VOID)(_p);

> (VOID)(_q); (VOID)(_r); (VOID)(_s);

> +#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) (VOID)(_p);

> (VOID)(_q); (VOID)(_r); (VOID)(_s); (VOID)(_t);

> +#endif

>  #endif

>  #define IXGBE_FUSES0_GROUP(_i)		(0x11158 + ((_i) * 4))

>  #define IXGBE_FUSES0_300MHZ		(1 << 5)


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Patch

diff --git a/IntelUndiPkg/XGigUndiDxe/ixgbe_type.h b/IntelUndiPkg/XGigUndiDxe/ixgbe_type.h
index e3bb1a8a313e..f67bfbfc2a9f 100644
--- a/IntelUndiPkg/XGigUndiDxe/ixgbe_type.h
+++ b/IntelUndiPkg/XGigUndiDxe/ixgbe_type.h
@@ -4411,11 +4411,19 @@  struct ixgbe_hw {
 #define IXGBE_NOT_IMPLEMENTED			0x7FFFFFFF
 
 #ifndef UNREFERENCED_XPARAMETER
+#ifdef _MSC_VER
 #define UNREFERENCED_XPARAMETER
 #define UNREFERENCED_1PARAMETER(_p) (_p);
 #define UNREFERENCED_2PARAMETER(_p, _q) (_p); (_q);
 #define UNREFERENCED_3PARAMETER(_p, _q, _r) (_p); (_q); (_r);
 #define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) (_p); (_q); (_r); (_s);
+#else
+#define UNREFERENCED_1PARAMETER(_p) (VOID)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) (VOID)(_p); (VOID)(_q);
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) (VOID)(_p); (VOID)(_q); (VOID)(_r);
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) (VOID)(_p); (VOID)(_q); (VOID)(_r); (VOID)(_s);
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) (VOID)(_p); (VOID)(_q); (VOID)(_r); (VOID)(_s); (VOID)(_t);
+#endif
 #endif
 #define IXGBE_FUSES0_GROUP(_i)		(0x11158 + ((_i) * 4))
 #define IXGBE_FUSES0_300MHZ		(1 << 5)