warning cleanup (#693)

* Kill annoing warnings about unused vars

* Kill annoing signed vs unsigned warnings

* Make ALWAYS_INLINE macro realy inlining

* Incorrect attribute placement.

While correct attribute placement cause ram4 overflow.
Move to correct place (to avoid gcc-2018-q4 errors) and comment
out.

* Silence -Wcast-function-type warnings

Cast to intermediate "void *" to lose compiler knowledge about the original
type and pass the warning. This is a workaround.
This commit is contained in:
dron0gus 2019-02-21 13:44:45 +03:00 committed by rusefi
parent 4ee9b755aa
commit 76fa11d5e2
21 changed files with 33 additions and 23 deletions

View File

@ -655,6 +655,7 @@ public:
LcdController() : PeriodicController("BenchThread") { }
private:
void PeriodicTask(efitime_t nowNt) override {
UNUSED(nowNt);
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->bc.lcdThreadPeriodMs));
if (engineConfiguration->bc.useLcdScreen) {
#if EFI_HD44780_LCD

View File

@ -62,6 +62,7 @@ public:
AuxPidController() : PeriodicController("AuxPidController") { }
private:
void PeriodicTask(efitime_t nowNt) override {
UNUSED(nowNt);
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->auxPid[0].periodMs));
if (parametersVersion.isOld(engine->getGlobalConfigurationVersion())) {

View File

@ -1493,7 +1493,7 @@ typedef struct {
* At what trigger index should some ignition-related math be executed? This is a performance trick to reduce load on synchronization trigger callback.
* offset 1500
*/
int ignMathCalculateAtIndex;
unsigned int ignMathCalculateAtIndex;
/**
* offset 1504
*/

View File

@ -47,6 +47,7 @@ public:
AlternatorController() : PeriodicController("AlternatorController") { }
private:
void PeriodicTask(efitime_t nowNt) override {
UNUSED(nowNt);
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->alternatorControl.periodMs));
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)

View File

@ -82,13 +82,13 @@ static LoggingWithStorage logger("ETB");
/**
* @brief Pulse-Width Modulation state
*/
static SimplePwm etbPwmUp("etbUp") CCM_OPTIONAL;
/*CCM_OPTIONAL*/ static SimplePwm etbPwmUp("etbUp");
static float valueOverride = NAN;
/*
static SimplePwm etbPwmDown("etbDown") CCM_OPTIONAL;
CCM_OPTIONAL static SimplePwm etbPwmDown("etbDown");
*/
static OutputPin outputDirectionOpen CCM_OPTIONAL;
static OutputPin outputDirectionClose CCM_OPTIONAL;
/*CCM_OPTIONAL*/ static OutputPin outputDirectionOpen;
/*CCM_OPTIONAL*/ static OutputPin outputDirectionClose;
EXTERN_ENGINE;
@ -96,7 +96,7 @@ static Pid pid(&engineConfiguration->etb);
static percent_t currentEtbDuty;
static bool wasEtbBraking = false;
//static bool wasEtbBraking = false;
// todo: need to fix PWM so that it supports zero duty cycle
#define PERCENT_TO_DUTY(X) (maxF(minI(X, 99.9), 0.1) / 100.0)
@ -108,6 +108,7 @@ private:
float feedForward = 0;
void PeriodicTask(efitime_t nowNt) override {
UNUSED(nowNt);
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->etb.periodMs));

View File

@ -269,6 +269,7 @@ public:
IdleController() : PeriodicController("IdleValve") { }
private:
void PeriodicTask(efitime_t nowNt) override {
UNUSED(nowNt);
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->idleRpmPid.periodMs));
/*

View File

@ -220,6 +220,7 @@ public:
BenchController() : PeriodicController("BenchThread") { }
private:
void PeriodicTask(efitime_t nowNt) override {
UNUSED(nowNt);
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->auxPid[0].periodMs));
// naive inter-thread communication - waiting for a flag

View File

@ -84,6 +84,7 @@ public:
MILController() : PeriodicController("MFIndicator") { }
private:
void PeriodicTask(efitime_t nowNt) override {
UNUSED(nowNt);
static error_codes_set_s localErrorCopy;
getErrorCodes(&localErrorCopy);

View File

@ -19,6 +19,7 @@ static percent_t mockPedalPosition = MOCK_UNDEFINED;
* this allows unit tests to simulate TPS position
*/
void setMockTpsPosition(percent_t tpsPosition) {
UNUSED(tpsPosition);
#if !EFI_PROD_CODE
mockTps = TPS_TS_CONVERSION * tpsPosition;
#endif
@ -52,7 +53,7 @@ void saveTpsState(efitimeus_t now, float curValue) {
next->curTime = now;
next->curValue = curValue;
int diffSysticks = overflowDiff(now, cur->curTime);
//int diffSysticks = overflowDiff(now, cur->curTime);
float diffSeconds = 0;// TODO: do we need this? diffSysticks * 1.0 / CH_FREQUENCY;
next->rateOfChange = (curValue - cur->curValue) / diffSeconds;

View File

@ -36,6 +36,7 @@ static void turnOff(NamedOutputPin *output) {
static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
UNUSED(ckpSignalType);
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
if (index != SCHEDULING_TRIGGER_INDEX) {
return;
@ -79,6 +80,7 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
}
void initAuxValves(Logging *sharedLogger) {
UNUSED(sharedLogger);
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) {
return;

View File

@ -61,7 +61,6 @@ static int gm_tooth_pair(float startAngle, bool isLongShort, TriggerShape* s, in
*/
void initGmLS24(TriggerShape *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);
trigger_wheel_e ch = T_PRIMARY;
/*
* Okay, here's how this magic works:

View File

@ -246,7 +246,6 @@ void configureHondaCbr600custom(TriggerShape *s) {
}
void configureHondaAccordShifted(TriggerShape *s) {
float w = 720 / 2 / 24;
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
float sb = S24;
@ -278,6 +277,7 @@ void configureHondaAccordShifted(TriggerShape *s) {
}
void configureOnePlus16(TriggerShape *s, operation_mode_e operationMode) {
UNUSED(operationMode);
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
int totalTeethCount = 16;

View File

@ -37,8 +37,6 @@ void initializeMitsubishi4g18(TriggerShape *s) {
s->setTriggerSynchronizationGap(1.6666);
int secondaryWidth = 70;
s->addEvent720(106.77999999999997, T_PRIMARY, TV_FALL);
s->addEvent720(120.09999999999998, T_SECONDARY, TV_RISE);
s->addEvent720(188.0775, T_SECONDARY, TV_FALL);

View File

@ -163,6 +163,7 @@ extern bool printTriggerDebug;
#endif
void TriggerShape::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) {
UNUSED(useOnlyRisingEdgeForTrigger);
// todo: move the following logic from below here
// if (!useOnlyRisingEdgeForTrigger || stateParam == TV_RISE) {
// expectedEventCount[channelIndex]++;

View File

@ -206,7 +206,7 @@ public:
* but name is supposed to hint at the fact that decoders should not be assigning to it
* Please use "getTriggerSize()" macro or "getSize()" method to read this value
*/
int privateTriggerDefinitionSize;
unsigned int privateTriggerDefinitionSize;
bool useOnlyRisingEdgeForTriggerTemp;

View File

@ -47,8 +47,6 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) {
float engineCycle = getEngineCycle(operationMode);
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->addEvent720(180, T_PRIMARY, TV_RISE);
@ -62,6 +60,7 @@ void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) {
}
void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode) {
UNUSED(operationMode);
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
int totalTeethCount = 60;
@ -80,6 +79,7 @@ void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode) {
}
void configure3_1_cam(TriggerShape *s, operation_mode_e operationMode) {
UNUSED(operationMode);
s->initialize(FOUR_STROKE_CAM_SENSOR, true);

View File

@ -136,7 +136,7 @@ void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE
shape->riseOnlyIndexes[0] = 0;
} else {
assertAngleRange(shape->triggerShapeSynchPointIndex, "triggerShapeSynchPointIndex", CUSTOM_ERR_6552);
int triggerDefinitionCoordinate = (shape->triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount;
unsigned int triggerDefinitionCoordinate = (shape->triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount;
efiAssertVoid(CUSTOM_ERR_6595, engine->engineCycleEventCount != 0, "zero engineCycleEventCount");
int triggerDefinitionIndex = triggerDefinitionCoordinate >= shape->privateTriggerDefinitionSize ? triggerDefinitionCoordinate - shape->privateTriggerDefinitionSize : triggerDefinitionCoordinate;
float angle = shape->getAngle(triggerDefinitionCoordinate) - firstAngle;
@ -536,7 +536,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
getTriggerSize());
}
#endif /* EFI_UNIT_TEST */
int endOfCycleIndex = getTriggerSize() - (CONFIG(useOnlyRisingEdgeForTrigger) ? 2 : 1);
unsigned int endOfCycleIndex = getTriggerSize() - (CONFIG(useOnlyRisingEdgeForTrigger) ? 2 : 1);
isSynchronizationPoint = !shaft_is_synchronized || (currentCycle.current_index >= endOfCycleIndex);
@ -632,6 +632,7 @@ static void onFindIndexCallback(TriggerState *state) {
*/
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape,
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) {
UNUSED(triggerConfig);
#if EFI_PROD_CODE || defined(__DOXYGEN__)
efiAssert(CUSTOM_ERR_ASSERT, getRemainingStack(chThdGetSelfX()) > 128, "findPos", -1);
#endif
@ -685,6 +686,7 @@ efitime_t TriggerState::getStartOfRevolutionIndex() const {
}
void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
UNUSED(nowNt);
// empty base implementation
}

View File

@ -27,7 +27,7 @@ extern "C"
#if defined __GNUC__
// GCC
#include <sys/types.h>
#define ALWAYS_INLINE __attribute__((always_inline))
#define ALWAYS_INLINE __attribute__((always_inline)) inline
#else
// IAR
typedef unsigned int time_t;

View File

@ -62,7 +62,7 @@ void cdmIonInit(void) {
return;
}
enableExti(CONFIGB(cdmInputPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extIonCallback);
enableExti(CONFIGB(cdmInputPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extIonCallback);
}
#endif /* EFI_CDM_INTEGRATION */

View File

@ -104,11 +104,11 @@ void initJoystick(Logging *shared) {
return;
sharedLogger = shared;
enableExti(CONFIGB(joystickCenterPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback);
enableExti(CONFIGB(joystickAPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback);
enableExti(CONFIGB(joystickCenterPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback);
enableExti(CONFIGB(joystickAPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback);
// not used so far applyPin(CONFIGB(joystickBPin));
// not used so far applyPin(CONFIGB(joystickCPin));
enableExti(CONFIGB(joystickDPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback);
enableExti(CONFIGB(joystickDPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback);
efiSetPadMode("joy center", CONFIGB(joystickCenterPin), PAL_MODE_INPUT_PULLUP);
efiSetPadMode("joy A", CONFIGB(joystickAPin), PAL_MODE_INPUT_PULLUP);

View File

@ -41,7 +41,7 @@ class cyclic_buffer
T sum(int length) const;
T maxValue(int length) const;
T minValue(int length) const;
void setSize(int size);
void setSize(unsigned int size);
bool contains(T value) const;
int getSize() const;
int getCount() const;
@ -125,7 +125,7 @@ bool cyclic_buffer<T, maxSize>::contains(T value) const {
}
template<typename T, size_t maxSize>
void cyclic_buffer<T, maxSize>::setSize(int size) {
void cyclic_buffer<T, maxSize>::setSize(unsigned int size) {
clear();
this->size = size < maxSize ? size : maxSize;
}