[edk2,edk2-staging,14/19] IntelUndiPkg/GigUndiDxe: redefine UNREFERENCED_nPARAMETER macros for GCC

Message ID 20181106175833.26964-15-ard.biesheuvel@linaro.org
State New
Headers show
Series
  • IntelUndiPkg/GigUndiDxe: build fixes for AARCH64/ARM/GCC
Related show

Commit Message

Ard Biesheuvel Nov. 6, 2018, 5:58 p.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/GigUndiDxe/e1000_defines.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.19.1

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

Patch

diff --git a/IntelUndiPkg/GigUndiDxe/e1000_defines.h b/IntelUndiPkg/GigUndiDxe/e1000_defines.h
index 1d07d30aa18e..b9ce1e5e6339 100644
--- a/IntelUndiPkg/GigUndiDxe/e1000_defines.h
+++ b/IntelUndiPkg/GigUndiDxe/e1000_defines.h
@@ -1622,12 +1622,19 @@  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #endif /* NO_82575_SUPPORT */
 #ifndef UNREFERENCED_XPARAMETER
-#define UNREFERENCED_XPARAMETER
+#ifdef _MSC_VER
 #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);
 #define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) (_p); (_q); (_r); (_s); (_t);
+#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 /* UNREFERENCED_XPARAMETER */
 #ifndef E1000_UNUSEDARG
 #define E1000_UNUSEDARG