ok...
In order to please my clients, I have to use the -Wall option with gcc.
But...
It generates sh*t loads of warnings that I do not even know what they mean...
here is a piece of my code (the type definition):
and now here is the two typical errors that -Wall is giving:
DS_DAT_DataAccess.c: In function `DS_GPS_Present':
DS_DAT_DataAccess.c:1154: warning: array subscript has type `char'
The function:
and
DS_DAT_DataAccess.c: In function `eDS_DAT_GetData':
DS_DAT_DataAccess.c:2139: warning: subscript has type `char'
The function (truncated because way too long):
Anyone has an idea of why it is complaining?
Everything is running perfectly for week now... It is just for the FAT that I have to get rid of those warnings...
THANK YOU VERY VERY VERY MUCH
In order to please my clients, I have to use the -Wall option with gcc.
But...
It generates sh*t loads of warnings that I do not even know what they mean...
here is a piece of my code (the type definition):
Code:
#define TYPELENGTH(TYPE,N) ((N*(sizeof(TYPE)))+sizeof(char))
/*
* Structures
*/
/* DS_CHO_ChannelObs.c */
typedef struct {
char C_A_PRM_CORR_SM[TYPELENGTH(double,1)];
char C_A_PRM_L1[TYPELENGTH(double,1)];
char CHANNEL_ID[TYPELENGTH(unsigned char,1)];
char CLK_ERR_GPS_SAT[TYPELENGTH(double,1)];
char CPM_CORR_L1[TYPELENGTH(double,1)];
char CPM_CORR_L2[TYPELENGTH(double,1)];
char CPM_L1[TYPELENGTH(double,1)];
char CPM_L2[TYPELENGTH(double,1)];
char FLAG_C_A[TYPELENGTH(char,1)];
char FLAG_CS_L1[TYPELENGTH(char,1)];
char FLAG_CS_L2[TYPELENGTH(char,1)];
char FLAG_P1[TYPELENGTH(char,1)];
char FLAG_P2[TYPELENGTH(char,1)];
char FLAG_SNR_L1[TYPELENGTH(char,1)];
char FLAG_SNR_L2[TYPELENGTH(char,1)];
char IFB_CORR[TYPELENGTH(double,1)];
char IONO_TYPE[TYPELENGTH(int,1)];
char NOISE_C_A_PRM_L1[TYPELENGTH(double,1)];
char NOISE_PRM_L1[TYPELENGTH(double,1)];
char NOISE_PRM_L2[TYPELENGTH(double,1)];
char POS_GPS_SAT[TYPELENGTH(double,3)];
char PRM_CORR_L1[TYPELENGTH(double,1)];
char PRM_CORR_L1_SM[TYPELENGTH(double,1)];
char PRM_CORR_L2[TYPELENGTH(double,1)];
char PRM_CORR_L2_SM[TYPELENGTH(double,1)];
char PRM_CORR_C_A[TYPELENGTH(double,1)];
char PRM_L1[TYPELENGTH(double,1)];
char PRM_L2[TYPELENGTH(double,1)];
char RECV_SIG_STAT[TYPELENGTH(char,1)];
char SIGMA_PR_L1[TYPELENGTH(double,1)];
char SIGMA_PR_L2[TYPELENGTH(double,1)];
char SNR_CORR_L1[TYPELENGTH(int,1)];
char SNR_CORR_L2[TYPELENGTH(int,1)];
char SNR_THEOR_L1[TYPELENGTH(double,1)];
char SNR_THEOR_L2[TYPELENGTH(double,1)];
char SV_IDENTIFIER[TYPELENGTH(unsigned short,1)];
char VEL_GPS_SAT[TYPELENGTH(double,3)];
char SIGMA_PM_L1[TYPELENGTH(double,1)];
char SIGMA_PM_L2[TYPELENGTH(double,1)];
char FLAG_SIGMA_L1[TYPELENGTH(char,1)];
char FLAG_SIGMA_L2[TYPELENGTH(char,1)];
char RES_SOL_PT[TYPELENGTH(double,1)];
} DS_CHO_ChannelObs;
/* DS_GSN_GoceSolution.c */
typedef struct {
char DELTA_T_GOCE[TYPELENGTH(double,1)];
char DIF_NAV_PVT[TYPELENGTH(double,7)];
char FLAG_SIS_POS[TYPELENGTH(char,1)];
char FLAG_SIS_T[TYPELENGTH(char,1)];
char FLAG_SIS_VEL[TYPELENGTH(char,1)];
char GDOP_PDOP_TDOP[TYPELENGTH(double,3)];
char SIG_NAV_PVT[TYPELENGTH(double,3)];
char SIGMA_P[TYPELENGTH(double,3)];
char SIGMA_T[TYPELENGTH(double,1)];
char SIGMA_V[TYPELENGTH(double,3)];
char SOL_SIGMA_PT[TYPELENGTH(double,1)];
char SOL_SIGMA_V[TYPELENGTH(double,1)];
char SOL_STATUS[TYPELENGTH(char,1)];
char SST_COV_PT[TYPELENGTH(double,4*4)];
char SST_COV_V[TYPELENGTH(double,3*3)];
char SST_POS[TYPELENGTH(double,4)];
char SST_VEL[TYPELENGTH(double,3)];
char RES_SOL_V[TYPELENGTH(double,100)];
} DS_GSN_GoceSolution;
/* DS_GEP_GoceEpoch.c */
typedef struct {
char EPOCH[TYPELENGTH(unsigned short,1)];
char N_SV[TYPELENGTH(unsigned char,1)];
char SSTI_TEMP_1[TYPELENGTH(double,1)];
char SSTI_TEMP_2[TYPELENGTH(double,1)];
char SSTI_TEMP_3[TYPELENGTH(double,1)];
char SSTI_TEMP_4[TYPELENGTH(double,1)];
char RECV_SOL_TYPE[TYPELENGTH(char,1)];
char TT_GPS[TYPELENGTH(int,2)];
char TT_OBT[TYPELENGTH(int,2)];
char TT_RX_GPS[TYPELENGTH(int,2)];
char DIF_OBT_GPS[TYPELENGTH(int,2)];
char FLAG_ORIGIN_GPS[TYPELENGTH(char,1)];
DS_CHO_ChannelObs Channel[DS_CHANNELS];
DS_GSN_GoceSolution Solution[2];
} DS_GEP_GoceEpoch;
/* DS_GAP_Gaps.c */
typedef struct {
char START_TIME[TYPELENGTH(int,2)];
char STOP_TIME[TYPELENGTH(int,2)];
char MISSING_LINE[TYPELENGTH(short,1)];
} DS_GAP_Gaps;
/* DS_SST_OUT_1i.c */
typedef struct {
char ENUM_COL_C_A[TYPELENGTH(short,1)];
char ENUM_COL_P1[TYPELENGTH(short,1)];
char ENUM_COL_P2[TYPELENGTH(short,1)];
char ENUM_CS_L1[TYPELENGTH(short,1)];
char ENUM_CS_L2[TYPELENGTH(short,1)];
char ENUM_OL_C_A[TYPELENGTH(short,1)];
char ENUM_OL_P1[TYPELENGTH(short,1)];
char ENUM_OL_P2[TYPELENGTH(short,1)];
} DS_SST_OUT_1;
/* DS_GOR_GoceOrbit.c */
typedef struct {
char STARTTIME[TYPELENGTH(unsigned long int,1)];
char ENDTIME[TYPELENGTH(unsigned long int,1)];
char EPOCHS[TYPELENGTH(unsigned short,1)];
char N_GAPS[TYPELENGTH(unsigned short,1)];
char NUM_ISPS[TYPELENGTH(int,1)];
char ICB_P1[((12*(sizeof(double)))+(12*sizeof(char)))];
char ICB_P2[((12*(sizeof(double)))+(12*sizeof(char)))];
char ICB_C_A[((12*(sizeof(double)))+(12*sizeof(char)))];
DS_GAP_Gaps * GoceGaps;
DS_SST_OUT_1 Gaps;
DS_GEP_GoceEpoch * GoceEpoch;
/*
* GoceEpoch will point on ENDTIME-STARTIME DS_GEP_GoceEpoch
* STARTTIME and ENDTIME are seconds (long int) starting from 01/Jan/2000 00:00:00
*/
} DS_GOR_GoceOrbit;
/* DS_AUX_AuxiliaryData.c */
typedef struct {
char ADC[TYPELENGTH(double,1)];
char ANT_ID_GOCE[TYPELENGTH(char,1)];
char ANT_PC_GOCE[(9*(sizeof(double))+4*sizeof(char))];
char AUX_ANT_PT_SIZE[TYPELENGTH(unsigned char,1)];
char AS2DEG[TYPELENGTH(double,1)];
char BOLTZ[TYPELENGTH(double,1)];
char C_L[TYPELENGTH(double,1)];
char C_PN[TYPELENGTH(double,1)];
char COR_SPAC[TYPELENGTH(double,1)];
char DEG2RAD[TYPELENGTH(double,1)];
char f_L1[TYPELENGTH(double,1)];
char f_L2[TYPELENGTH(double,1)];
char FAC_FRQ[TYPELENGTH(double,1)];
char G_GPS[TYPELENGTH(double,1)];
char H_SCALE[TYPELENGTH(double,1)];
char ICB_TABLE[TYPELENGTH(double,3*12)];
char IFB_TABLE_SIZE[TYPELENGTH(unsigned char,1)];
char L_ATMO[TYPELENGTH(double,1)];
char L_GPS_L1[TYPELENGTH(double,1)];
char L_GPS_L2[TYPELENGTH(double,1)];
char L_IMPL_L1[TYPELENGTH(double,1)];
char L_IMPL_L2[TYPELENGTH(double,1)];
char LOOP_BW[TYPELENGTH(double,1)];
char MULT_L[TYPELENGTH(double,1)];
char MULT_PN[TYPELENGTH(double,1)];
char OFFSET_XHGT[TYPELENGTH(double,1)];
char P_TX_GPS_P_L1[TYPELENGTH(double,1)];
char P_TX_GPS_P_L2[TYPELENGTH(double,1)];
char RECV_WRAP[TYPELENGTH(int,1)];
char SIG_OSC[TYPELENGTH(double,1)];
char T_CHIP[TYPELENGTH(double,1)];
char T_NOISE[TYPELENGTH(double,1)];
char T_PRED[TYPELENGTH(double,1)];
char PI[TYPELENGTH(double,1)];
char RAD2DEG[TYPELENGTH(double,1)];
char H2DEG[TYPELENGTH(double,1)];
char SOL[TYPELENGTH(double,1)];
char OMEGA_Z[TYPELENGTH(double,1)];
char R_EARTH[TYPELENGTH(double,1)];
char X_P[TYPELENGTH(double,1)];
char Y_P[TYPELENGTH(double,1)];
char DIFF_GPS_UTC[TYPELENGTH(double,1)];
char NUMBERS_IONO[TYPELENGTH(unsigned char,1)];
char N_LEAP_S[TYPELENGTH(char,1)];
char OBT0[TYPELENGTH(int,2)];
char UTC0[TYPELENGTH(int,2)];
char GRADIENT_OBT_UTC[TYPELENGTH(double,1)];
char OFFSET_OBT_UTC[TYPELENGTH(double,1)];
char RX_SOFT_VERSION[TYPELENGTH(char,20)];
char COREDUMP[TYPELENGTH(char,1)];
char ANTENNA_B[TYPELENGTH(double,3)];
char * IFB_TABLE; /* Depends on IFB_TABLE_SIZE */
char * AUX_ANT_PT; /* Depends on AUX_ANT_PT_SIZE */
} DS_AUX_AuxiliaryData;
typedef struct {
char TEC_FLAG;
double TEC_VALUE;
} TEC_E;
typedef struct {
char DLAT[TYPELENGTH(double,1)];
char DLON[TYPELENGTH(double,1)];
char INTERVAL[TYPELENGTH(unsigned int,1)];
char XHGT[TYPELENGTH(double,1)];
char IONOTIME[TYPELENGTH(unsigned long int,1)];
char MIN_LAT[TYPELENGTH(double, 1)];
char MIN_LON[TYPELENGTH(double, 1)];
char RANGE_TIME[TYPELENGTH(unsigned long int, 1)];
TEC_E *** TEC;
char * next;
} DS_COD_Iono;
/* DS_CON_Configuration.c */
typedef struct {
char DATA_THRES[TYPELENGTH(double,1)];
char MULT_WRAP[TYPELENGTH(double,1)];
char M_GPS[TYPELENGTH(char,1)];
char M_SPAN_POLYFIT[TYPELENGTH(unsigned char,1)];
char MAX_N_ITER[TYPELENGTH(unsigned char,1)];
char MIN_N_GPS[TYPELENGTH(unsigned char,1)];
char MIN_N_ITER[TYPELENGTH(unsigned char,1)];
char MPV[TYPELENGTH(unsigned char,1)];
char MULT_SNR_L1[TYPELENGTH(double,1)];
char MULT_SNR_L2[TYPELENGTH(double,1)];
char MULT_NOISE_L1[TYPELENGTH(double,1)];
char MULT_NOISE_L2[TYPELENGTH(double,1)];
char MULT_RES[TYPELENGTH(char,1)];
char MULT_SIS_P[TYPELENGTH(double,1)];
char MULT_SIS_T[TYPELENGTH(double,1)];
char MULT_SIS_V[TYPELENGTH(double,1)];
char N_GPS[TYPELENGTH(unsigned char,1)];
char N_ORDER_POLYFIT[TYPELENGTH(unsigned char,1)];
char NPV[TYPELENGTH(char,1)];
char STOP_CRITERIA[TYPELENGTH(double,1)];
char THRES_RES_PT[TYPELENGTH(double,1)];
char THRES_COL_C_A[TYPELENGTH(char,1)];
char THRES_COL_P1[TYPELENGTH(char,1)];
char THRES_COL_P2[TYPELENGTH(char,1)];
char USE_IONO_TYPE[TYPELENGTH(char,1)];
char USE_SM_DATA[TYPELENGTH(char,1)];
char MASTER[TYPELENGTH(char,1)];
char Acquisition_Station[TYPELENGTH(char,XF_MAX_VALUE_LENGTH)];
char Processing_Centre[TYPELENGTH(char,XF_MAX_VALUE_LENGTH)];
} DS_CON_Configuration;
/* DS_GPS_Poly.c */
typedef struct {
char VAL_START_TIME[TYPELENGTH(unsigned long int,1)];
char VAL_END_TIME[TYPELENGTH(unsigned long int,1)];
char TIMETAG[TYPELENGTH(unsigned long int,1)];
char * POLY_COEFF; /* Depends on N_GPS */
char * next;
} DS_GPS_Poly;
/* DS_ISN_IgsSolution.c */
typedef struct {
char ClockTimetag[TYPELENGTH(unsigned long int,1)];
char ClockOffset[TYPELENGTH(double,1)];
char PosTimetag[TYPELENGTH(unsigned long int, 1)];
char Position[TYPELENGTH(double,3)];
char * next;
} DS_ISN_IgsSolution;
/* DS_GSA_GpsSatellite.c */
typedef struct {
char PRN[TYPELENGTH(unsigned short,1)];
char HealthFlag[TYPELENGTH(char,1)];
char G_GPS[TYPELENGTH(double,1)];
char ANT_PC_GPS[TYPELENGTH(double,3)];
DS_ISN_IgsSolution IgsSolution;
DS_GPS_Poly InterpolatingPoly;
} DS_GSA_GpsSatellite;
/* Depacketing */
typedef struct {
double CN0_Eng_Unit;
double Pseudorange_Eng_Unit;
double Doppler_Eng_Unit;
double Position_Eng_Unit;
double Velocity_Eng_Unit;
double ClockBias_Eng_Unit;
double ClockDrift_Eng_Unit;
double TempSensor_Eng_Unit;
} DS_DAT_Depacketing;
/* Datastore */
typedef struct {
DS_GOR_GoceOrbit * GoceOrbit;
DS_GSA_GpsSatellite * GpsSatellite;
DS_CON_Configuration * Configuration;
DS_AUX_AuxiliaryData * AuxiliaryData;
DS_DAT_Depacketing * Depack;
DS_COD_Iono * Iono;
} DataStore;
and now here is the two typical errors that -Wall is giving:
DS_DAT_DataAccess.c: In function `DS_GPS_Present':
DS_DAT_DataAccess.c:1154: warning: array subscript has type `char'
The function:
Code:
char DS_GPS_Present(
unsigned char gps,
unsigned short epoch
) {
vCN_LOG_LogMessage(iCN_PKG_MSG_ENTRY,"DS_GPS_Present");
register char Channel_ID=-1;
register char i;
register char * k;
for(i=0;i<DS_CHANNELS;i++) {
/* k is a pointer to SV_IDENTIFIER at epoch and channel i */
k=datastore.GoceOrbit->GoceEpoch[epoch].Channel[i].SV_IDENTIFIER;
/* k[0] and k[1] being respectivly the v_flag and the value of SV_IDENTIFIER at epoch and channel i*/
if ((k[0]==DS_VALID) && (gps==k[1])) {Channel_ID=i; break;}
}
EXCEPTION(EXIT_BLOCK);
EXIT_BLOCK:
{
vCN_LOG_LogMessage(iCN_PKG_MSG_EXIT,"DS_GPS_Present");
return Channel_ID;
}
}
and
DS_DAT_DataAccess.c: In function `eDS_DAT_GetData':
DS_DAT_DataAccess.c:2139: warning: subscript has type `char'
The function (truncated because way too long):
Code:
enum CN_PKG_STATUS eDS_DAT_GetData(
unsigned short varname,
short epoch_number,
char gps_number,
char channel_number,
void * ptr_flag,
void * ptr_variable
) {
vCN_LOG_LogMessage(iCN_PKG_MSG_ENTRY,"vDS_DAT_GetData");
register enum CN_PKG_STATUS eStatus = eCN_PKG_STATUS_SUCCESS;
register unsigned short epochs=(GET_FLAG(datastore.GoceOrbit->EPOCHS)==DS_VALID)?GET_VALUE(datastore.GoceOrbit->EPOCHS, unsigned short):0;
register unsigned short gaps=(GET_FLAG(datastore.GoceOrbit->N_GAPS)==DS_VALID)?GET_VALUE(datastore.GoceOrbit->N_GAPS, unsigned short):0;
register char channel_id;
char v_flag=DS_INVALID;
vCN_LOG_LogMessage(DS_DEBUGG, varname, epoch_number, gps_number, channel_number);
switch (varname) {
/* truncated ...*/
case DS_PRN:
EXCEPTION_IF((gps_number>=DS_MAXGPS)||(gps_number<0), GPS_OUT_OF_RANGE);
memmove(ptr_flag,&(datastore.GpsSatellite[gps_number].PRN[0]),sizeof(char));
memmove(ptr_variable,&(datastore.GpsSatellite[gps_number].PRN[1]),sizeof(unsigned char));
break;
/* truncated ...*/
Anyone has an idea of why it is complaining?
Everything is running perfectly for week now... It is just for the FAT that I have to get rid of those warnings...
THANK YOU VERY VERY VERY MUCH