Clean up build warnings (#4169)

* [build][OSX] Fix clang warnings.

* [build][OSX] A few more warnings taken care of.

* [build] Fixed yet more build warnings across all platforms.

* [build] Fix final warning due to bad CMake flag.

* [build] Remove unused variables as requested, fix indent.

* Fix output display limit type for 8-bit targets.
This commit is contained in:
Max Paperno
2016-12-30 18:16:11 +01:00
committed by Bertrand Songis
parent 1666fd7355
commit 1eead1504c
22 changed files with 39 additions and 40 deletions
@@ -193,7 +193,7 @@ unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i
return errors.to_ulong(); return errors.to_ulong();
} }
unsigned long Er9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) unsigned long Er9xInterface::loadBackup(RadioData &radioData, const uint8_t *eeprom, int esize, int index)
{ {
std::bitset<NUM_ERRORS> errors; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR); errors.set(UNKNOWN_ERROR);
+1 -1
View File
@@ -43,7 +43,7 @@ class Er9xInterface : public EEPROMInterface
virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size); virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index); virtual unsigned long loadBackup(RadioData &, const uint8_t * eeprom, int esize, int index);
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc); virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
@@ -237,7 +237,7 @@ unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom
return errors.to_ulong(); return errors.to_ulong();
} }
unsigned long Ersky9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) unsigned long Ersky9xInterface::loadBackup(RadioData &radioData, const uint8_t *eeprom, int esize, int index)
{ {
std::bitset<NUM_ERRORS> errors; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR); errors.set(UNKNOWN_ERROR);
@@ -43,7 +43,7 @@ class Ersky9xInterface : public EEPROMInterface
virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size); virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index); virtual unsigned long loadBackup(RadioData &, const uint8_t * eeprom, int esize, int index);
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc); virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
+1 -1
View File
@@ -507,7 +507,7 @@ QString LogsDialog::formatTimeDelta(double timeDelta)
return QString("%1 s").arg(timeDelta, 1, 'f', 1); return QString("%1 s").arg(timeDelta, 1, 'f', 1);
} }
int seconds = (int)round(abs(timeDelta)); int seconds = (int)round(fabs(timeDelta));
int hours = seconds / 3600; int hours = seconds / 3600;
seconds %= 3600; seconds %= 3600;
int minutes = seconds / 60; int minutes = seconds / 60;
-4
View File
@@ -121,7 +121,6 @@ class TelemetrySimulator : public QDialog
bool stepping; bool stepping;
QDateTime parseTransmittterTimestamp(QString row); QDateTime parseTransmittterTimestamp(QString row);
void calcLogFrequency(); void calcLogFrequency();
int32_t replayRate;
}; };
private: private:
@@ -162,8 +161,6 @@ private:
uint32_t cellData1; uint32_t cellData1;
uint32_t cellData2; uint32_t cellData2;
uint32_t cellData3; uint32_t cellData3;
uint32_t cellDataTime;
double cell[MAXCELLS];
}; };
class GPSEmulator class GPSEmulator
@@ -185,7 +182,6 @@ private:
double course; double course;
double speedKNTS; double speedKNTS;
double altitude; // in meters double altitude; // in meters
uint32_t nextDataIndex;
uint32_t encodeLatLon(double latLon, bool isLat); uint32_t encodeLatLon(double latLon, bool isLat);
uint32_t encodeDateTime(uint8_t yearOrHour, uint8_t monthOrMinute, uint8_t dayOrSecond, bool isDate); uint32_t encodeDateTime(uint8_t yearOrHour, uint8_t monthOrMinute, uint8_t dayOrSecond, bool isDate);
}; };
+5 -2
View File
@@ -227,7 +227,7 @@
#ifdef MOUNTED_GETMNTINFO #ifdef MOUNTED_GETMNTINFO
# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME # if ! HAVE_STRUCT_STATFS_F_FSTYPENAME && !defined(__clang__)
static const char * static const char *
fstype_to_string (short int t) fstype_to_string (short int t)
{ {
@@ -323,6 +323,7 @@ fstype_to_string (short int t)
} }
# endif # endif
#if !defined(__clang__)
static const char * static const char *
fsp_to_string (const struct statfs *fsp) fsp_to_string (const struct statfs *fsp)
{ {
@@ -332,6 +333,7 @@ fsp_to_string (const struct statfs *fsp)
return fstype_to_string (fsp->f_type); return fstype_to_string (fsp->f_type);
# endif # endif
} }
#endif
#endif /* MOUNTED_GETMNTINFO */ #endif /* MOUNTED_GETMNTINFO */
@@ -918,7 +920,7 @@ read_file_system_list (bool need_fs_type)
*mtail = NULL; *mtail = NULL;
return mount_list; return mount_list;
#if !defined(__clang__)
free_then_fail: free_then_fail:
{ {
int saved_errno = errno; int saved_errno = errno;
@@ -938,6 +940,7 @@ read_file_system_list (bool need_fs_type)
errno = saved_errno; errno = saved_errno;
return NULL; return NULL;
} }
#endif
} }
void free_file_system_list(struct mount_entry * mount_list) void free_file_system_list(struct mount_entry * mount_list)
+2
View File
@@ -371,6 +371,8 @@ set(CMAKE_COMMON_FLAGS "")
set(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG "") set(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG "")
set(CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG "") set(CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG "")
set(CMAKE_EXE_LINKER_FLAGS "") set(CMAKE_EXE_LINKER_FLAGS "")
# similar for -Wl,-search_paths_first (fix "arch_paths_first" warning)
set(CMAKE_CXX_LINK_FLAGS "")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>") set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>") set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
+3 -5
View File
@@ -376,9 +376,7 @@ void evalFunctions()
case FUNC_SET_TIMER: case FUNC_SET_TIMER:
timerSet(CFN_TIMER_INDEX(cfn), CFN_PARAM(cfn)); timerSet(CFN_TIMER_INDEX(cfn), CFN_PARAM(cfn));
break; break;
#endif
#if defined(CPUARM)
case FUNC_SET_FAILSAFE: case FUNC_SET_FAILSAFE:
{ {
unsigned int moduleIndex = CFN_PARAM(cfn); unsigned int moduleIndex = CFN_PARAM(cfn);
@@ -393,7 +391,6 @@ void evalFunctions()
} }
} }
} }
#endif
#if defined(DANGEROUS_MODULE_FUNCTIONS) #if defined(DANGEROUS_MODULE_FUNCTIONS)
case FUNC_RANGECHECK: case FUNC_RANGECHECK:
@@ -405,7 +402,8 @@ void evalFunctions()
} }
break; break;
} }
#endif #endif
#endif // defined(CPUARM)
#if defined(GVARS) #if defined(GVARS)
case FUNC_ADJUST_GVAR: case FUNC_ADJUST_GVAR:
@@ -593,7 +591,7 @@ void evalFunctions()
} }
else { else {
functionsContext.lastFunctionTime[i] = 0; functionsContext.lastFunctionTime[i] = 0;
#if defined(DANGEROUS_MODULE_FUNCTIONS) #if defined(CPUARM) && defined(DANGEROUS_MODULE_FUNCTIONS)
if (functionsContext.activeSwitches & switch_mask) { if (functionsContext.activeSwitches & switch_mask) {
switch (CFN_FUNC(cfn)) { switch (CFN_FUNC(cfn)) {
case FUNC_RANGECHECK: case FUNC_RANGECHECK:
+1 -1
View File
@@ -143,7 +143,7 @@ void menuModelLimits(event_t event)
lcdDrawChar(LIMITS_DIRECTION_POS, y, swVal); lcdDrawChar(LIMITS_DIRECTION_POS, y, swVal);
#endif #endif
int8_t limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 100); limit_min_max_t limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 100);
putsChn(0, y, k+1, IS_LINE_SELECTED(sub, k) ? INVERS : 0); putsChn(0, y, k+1, IS_LINE_SELECTED(sub, k) ? INVERS : 0);
-9
View File
@@ -410,15 +410,6 @@ void displaySwitch(coord_t x, coord_t y, int width, unsigned int index)
} }
} }
const MenuItem MAIN_MENU[] = {
{ "RADIO SETTINGS", menuRadioSetup },
{ "MODEL SELECT", menuModelSelect },
{ "MODEL SETTINGS", menuModelSetup },
{ "CHECKLIST", menuModelNotes },
{ "SD MANAGER", menuRadioSdManager },
{ "VERSION", menuRadioVersion }
};
bool isMenuAvailable(int index) bool isMenuAvailable(int index)
{ {
if (index == 4) { if (index == 4) {
+1 -1
View File
@@ -48,4 +48,4 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val)
} }
return val; return val;
} }
#endif #endif
+2 -2
View File
@@ -278,16 +278,16 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
bool negative = false; bool negative = false;
if (swtch < 0) { if (swtch < 0) {
negative = true;
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) { if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false; return false;
} }
negative = true;
swtch = -swtch; swtch = -swtch;
} }
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
if (swtch >= SWSRC_FIRST_SWITCH && swtch <= SWSRC_LAST_SWITCH) { if (swtch >= SWSRC_FIRST_SWITCH && swtch <= SWSRC_LAST_SWITCH) {
negative = negative; (void)negative;
return true; return true;
} }
#else #else
+1 -1
View File
@@ -187,7 +187,7 @@ static inline gtime_t ydhms_diff(long int year1, long int yday1, int hour1, int
int year0, int yday0, int hour0, int min0, int sec0) int year0, int yday0, int hour0, int min0, int sec0)
{ {
static_assert(-1 / 2 == 0, "no C99 integer division"); static_assert(-1 / 2 == 0, "no C99 integer division");
static_assert(INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX, "long int year and yday are not wide enough"); static_assert(INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= INT_MAX, "long int year and yday are not wide enough");
/* Compute intervening leap days correctly even if year is negative. /* Compute intervening leap days correctly even if year is negative.
Take care to avoid integer overflow here. */ Take care to avoid integer overflow here. */
+3
View File
@@ -27,6 +27,9 @@
#define SECS_PER_DAY 86400ul #define SECS_PER_DAY 86400ul
#define TM_YEAR_BASE 1900 #define TM_YEAR_BASE 1900
#define TIME_T_MIN (-__LONG_MAX__)
#define TIME_T_MAX (__LONG_MAX__)
typedef long int gtime_t; typedef long int gtime_t;
struct gtm struct gtm
-1
View File
@@ -129,7 +129,6 @@ class RlcFile: public EFile
uint8_t m_bRlc; // control byte for run length decoder uint8_t m_bRlc; // control byte for run length decoder
uint8_t m_zeroes; uint8_t m_zeroes;
uint8_t m_flags;
#define WRITE_FIRST_LINK 0x01 #define WRITE_FIRST_LINK 0x01
#define WRITE_NEXT_LINK_1 0x02 #define WRITE_NEXT_LINK_1 0x02
#define WRITE_NEXT_LINK_2 0x03 #define WRITE_NEXT_LINK_2 0x03
+1 -1
View File
@@ -247,9 +247,9 @@ void adcRead()
} }
} }
#if !defined(SIMU)
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,-1, -1,-1, -1,1, 0,0,0}; const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,-1, -1,-1, -1,1, 0,0,0};
#if !defined(SIMU)
uint16_t getAnalogValue(uint8_t index) uint16_t getAnalogValue(uint8_t index)
{ {
if (ana_direction[index] < 0) if (ana_direction[index] < 0)
+4 -2
View File
@@ -22,13 +22,15 @@
volatile uint8_t dacStarted = false; volatile uint8_t dacStarted = false;
#if !defined(SIMU)
#if !defined(SOFTWARE_VOLUME)
const int8_t volumeScale[VOLUME_LEVEL_MAX+1] = const int8_t volumeScale[VOLUME_LEVEL_MAX+1] =
{ {
0, 2, 4, 6, 8, 10, 13, 17, 22, 27, 33, 40, 0, 2, 4, 6, 8, 10, 13, 17, 22, 27, 33, 40,
64, 82, 96, 105, 112, 117, 120, 122, 124, 125, 126, 127 64, 82, 96, 105, 112, 117, 120, 122, 124, 125, 126, 127
} ; } ;
#endif
#if !defined(SIMU)
void setSampleRate(uint32_t frequency) void setSampleRate(uint32_t frequency)
{ {
+4
View File
@@ -24,6 +24,7 @@
#define SAMPTIME 2 // sample time = 28 cycles #define SAMPTIME 2 // sample time = 28 cycles
#define SAMPTIME_LONG 3 // sample time = 56 cycles #define SAMPTIME_LONG 3 // sample time = 56 cycles
#if !defined(SIMU)
#if defined(PCBX9E) && defined(HORUS_STICKS) #if defined(PCBX9E) && defined(HORUS_STICKS)
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,-1,-1,1, -1,1,1,1, -1}; const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,-1,-1,1, -1,1,1,1, -1};
#elif defined(PCBX9E) #elif defined(PCBX9E)
@@ -37,15 +38,18 @@
#else #else
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,0, -1,1, 1}; const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,0, -1,1, 1};
#endif #endif
#endif // #if !defined(SIMU)
#if defined(PCBX9E) #if defined(PCBX9E)
#define NUMBER_ANALOG_ADC1 10 #define NUMBER_ANALOG_ADC1 10
#define NUMBER_ANALOG_ADC3 (NUMBER_ANALOG - 10) #define NUMBER_ANALOG_ADC3 (NUMBER_ANALOG - 10)
#if !defined(SIMU)
// mapping from adcValues order to enum Analogs // mapping from adcValues order to enum Analogs
const uint8_t ana_mapping[NUMBER_ANALOG] = { 0 /*STICK1*/, 1 /*STICK2*/, 2 /*STICK3*/, 3 /*STICK4*/, const uint8_t ana_mapping[NUMBER_ANALOG] = { 0 /*STICK1*/, 1 /*STICK2*/, 2 /*STICK3*/, 3 /*STICK4*/,
10 /*POT1*/, 4 /*POT2*/, 5 /*POT3*/, 6 /*POT4*/, 10 /*POT1*/, 4 /*POT2*/, 5 /*POT3*/, 6 /*POT4*/,
11 /*SLIDER1*/, 12 /*SLIDER2*/, 7 /*SLIDER3*/, 8 /*SLIDER4*/, 11 /*SLIDER1*/, 12 /*SLIDER2*/, 7 /*SLIDER3*/, 8 /*SLIDER4*/,
9 /*TX_VOLTAGE*/ }; 9 /*TX_VOLTAGE*/ };
#endif // !defined(SIMU)
#else #else
#define NUMBER_ANALOG_ADC1 NUMBER_ANALOG #define NUMBER_ANALOG_ADC1 NUMBER_ANALOG
#endif #endif
+2 -2
View File
@@ -98,7 +98,7 @@ extern "C" void INTERRUPT_5MS_IRQHandler()
} }
#endif #endif
#if defined(PCBX9E) #if defined(PCBX9E) && !defined(SIMU)
#define PWR_PRESS_DURATION_MIN 200 // 2s #define PWR_PRESS_DURATION_MIN 200 // 2s
#define PWR_PRESS_DURATION_MAX 500 // 5s #define PWR_PRESS_DURATION_MAX 500 // 5s
@@ -109,7 +109,7 @@ const pm_uchar bmp_startup[] PROGMEM = {
const pm_uchar bmp_lock[] PROGMEM = { const pm_uchar bmp_lock[] PROGMEM = {
#include "lock.lbm" #include "lock.lbm"
}; };
#endif #endif // defined(PCBX9E) && !defined(SIMU)
void boardInit() void boardInit()
{ {
+3 -2
View File
@@ -309,7 +309,9 @@ const pm_char STR_PPM_TRAINER[] PROGMEM = TR_PPM_TRAINER;
const pm_char STR_CH[] PROGMEM = TR_CH; const pm_char STR_CH[] PROGMEM = TR_CH;
const pm_char STR_MODEL[] PROGMEM = TR_MODEL; const pm_char STR_MODEL[] PROGMEM = TR_MODEL;
const pm_char STR_FP[] PROGMEM = TR_FP; const pm_char STR_FP[] PROGMEM = TR_FP;
#if defined(CPUARM)
const pm_char STR_MIX[] PROGMEM = TR_MIX; const pm_char STR_MIX[] PROGMEM = TR_MIX;
#endif
const pm_char STR_ALERT[] PROGMEM = TR_ALERT; const pm_char STR_ALERT[] PROGMEM = TR_ALERT;
const pm_char STR_PRESSANYKEYTOSKIP[] PROGMEM = TR_PRESSANYKEYTOSKIP; const pm_char STR_PRESSANYKEYTOSKIP[] PROGMEM = TR_PRESSANYKEYTOSKIP;
const pm_char STR_THROTTLENOTIDLE[] PROGMEM = TR_THROTTLENOTIDLE; const pm_char STR_THROTTLENOTIDLE[] PROGMEM = TR_THROTTLENOTIDLE;
@@ -496,6 +498,7 @@ const pm_char STR_RESET_BTN[] PROGMEM = TR_RESET_BTN;
#if defined(SDCARD) #if defined(SDCARD)
const pm_char STR_BACKUP_MODEL[] PROGMEM = TR_BACKUP_MODEL; const pm_char STR_BACKUP_MODEL[] PROGMEM = TR_BACKUP_MODEL;
const pm_char STR_RESTORE_MODEL[] PROGMEM = TR_RESTORE_MODEL; const pm_char STR_RESTORE_MODEL[] PROGMEM = TR_RESTORE_MODEL;
const pm_char STR_DELETE_ERROR[] PROGMEM = TR_DELETE_ERROR;
const pm_char STR_SDCARD_ERROR[] PROGMEM = TR_SDCARD_ERROR; const pm_char STR_SDCARD_ERROR[] PROGMEM = TR_SDCARD_ERROR;
const pm_char STR_NO_SDCARD[] PROGMEM = TR_NO_SDCARD; const pm_char STR_NO_SDCARD[] PROGMEM = TR_NO_SDCARD;
const pm_char STR_SDCARD_FULL[] PROGMEM = TR_SDCARD_FULL; const pm_char STR_SDCARD_FULL[] PROGMEM = TR_SDCARD_FULL;
@@ -507,8 +510,6 @@ const pm_char STR_MODELS_PATH[] PROGMEM = MODELS_PATH;
const pm_char STR_MODELS_EXT[] PROGMEM = MODELS_EXT; const pm_char STR_MODELS_EXT[] PROGMEM = MODELS_EXT;
#endif #endif
const pm_char STR_DELETE_ERROR[] PROGMEM = TR_DELETE_ERROR;
const pm_char STR_CAT_NOT_EMPTY[] PROGMEM = TR_CAT_NOT_EMPTY; const pm_char STR_CAT_NOT_EMPTY[] PROGMEM = TR_CAT_NOT_EMPTY;
const pm_char STR_WARNING[] PROGMEM = TR_WARNING; const pm_char STR_WARNING[] PROGMEM = TR_WARNING;
const pm_char STR_THROTTLEWARN[] PROGMEM = TR_THROTTLEWARN; const pm_char STR_THROTTLEWARN[] PROGMEM = TR_THROTTLEWARN;
+2 -2
View File
@@ -723,9 +723,10 @@ extern const pm_char STR_RESET_BTN[];
extern const pm_char STR_BACKUP_MODEL[]; extern const pm_char STR_BACKUP_MODEL[];
extern const pm_char STR_RESTORE_MODEL[]; extern const pm_char STR_RESTORE_MODEL[];
extern const pm_char STR_DELETE_ERROR[]; extern const pm_char STR_DELETE_ERROR[];
extern const pm_char STR_SDCARD_ERROR[];
extern const pm_char STR_NO_SDCARD[]; extern const pm_char STR_NO_SDCARD[];
extern const pm_char STR_SDCARD_FULL[]; extern const pm_char STR_SDCARD_FULL[];
extern const pm_char STR_SDCARD_NOWIZ[]; extern const pm_char STR_SDCARD_NOWIZ[];
extern const pm_char STR_INCOMPATIBLE[]; extern const pm_char STR_INCOMPATIBLE[];
extern const pm_char STR_LOGS_PATH[]; extern const pm_char STR_LOGS_PATH[];
extern const pm_char STR_LOGS_EXT[]; extern const pm_char STR_LOGS_EXT[];
@@ -734,7 +735,6 @@ extern const pm_char STR_SDCARD_NOWIZ[];
#define STR_UPDATE_LIST STR_DELAYDOWN #define STR_UPDATE_LIST STR_DELAYDOWN
#endif #endif
extern const pm_char STR_SDCARD_ERROR[];
extern const pm_char STR_CAT_NOT_EMPTY[]; extern const pm_char STR_CAT_NOT_EMPTY[];
extern const pm_char STR_WARNING[]; extern const pm_char STR_WARNING[];
extern const pm_char STR_STORAGE_WARNING[]; extern const pm_char STR_STORAGE_WARNING[];