From 9591ef40dc01e76c2add4eb98b0cf4c86fa26d0c Mon Sep 17 00:00:00 2001 From: Robert May Date: Fri, 30 Oct 2015 20:20:51 +0000 Subject: [PATCH] Turn off -Wunused-parameter for include "nrf_soc.h" Unfortunately we can't turn it off just while nrf_soc.h is being included as the way the defines are used the compiler can't tell the parameters are unused until the end of the compilation unit. So we can't use the more normal as that pops the supression too early. WARNING: including nrf_soc.h will turn off unused-function warnings for the rest of the compilation unit - see included nrf_svc.h --- source/MicroBitThermometer.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/MicroBitThermometer.cpp b/source/MicroBitThermometer.cpp index 8e1df04..094572b 100644 --- a/source/MicroBitThermometer.cpp +++ b/source/MicroBitThermometer.cpp @@ -1,4 +1,18 @@ #include "MicroBit.h" + +/** + * Turn off unused-parameter warnings under gcc -Wall + * This turns them off for the entire compilation unit + * (i.e. the whole of this file) as the compiler can't + * tell that a parameter is unused until the end, and + * so we can't just turn it off as a guard around the + * next include. + * It might be better to add + * #pragram GCC system header + * as the first line of nrf_soc.h, but that's a different + * module ... + */ +#pragma GCC diagnostic ignored "-Wunused-parameter" #include "nrf_soc.h" /**