1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-04-07 03:07:02 +00:00

Merge branch 'cpplint' into next

Add new CI job on GitHub applying a list of cpplint filters.
Corrections applied to pass the check.
This commit is contained in:
Carles Fernandez 2020-02-23 14:33:45 +01:00
commit ade93c0d93
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
14 changed files with 73 additions and 69 deletions

View File

@ -63,6 +63,16 @@ jobs:
run: git diff > clang_tidy.patch && echo -e "if \n [ -s clang_tidy.patch ] \nthen \n echo "clang_tidy not applied:"; echo ""; more clang_tidy.patch; exit 1 \nfi \n" > detect && chmod +x ./detect && ./detect
cpplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install-dependencies
run: sudo apt-get install python3-pip && sudo pip3 install cpplint
- name: run checks
run: find ./src/ -iname *.h -o -iname *.cc | xargs cpplint --filter=-,+build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,+build/include_what_you_use,+build/printf_format,+build/storage_class,+readability/constructors,+readability/namespace,+readability/newline,+readability/utf8,+runtime/casting,+runtime/explicit,+runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,+runtime/member_string_references,+runtime/memset,+runtime/operator,+runtime/printf,+runtime/printf_format,+whitespace/blank_line,+whitespace/comma,+whitespace/comments,+whitespace/empty_conditional_body,+whitespace/end-of-line,+whitespace/ending-newline,+whitespace/semicolon,+whitespace/tab
volk-gnsssdr-windows:
runs-on: windows-latest
steps:

View File

@ -44,12 +44,15 @@ SPDX-License-Identifier: GPL-3.0-or-later
- Rewriting of acquisition and tracking adapters, thus avoiding a lot of code duplication.
- New CMake option ENABLE_ARMA_NO_DEBUG defines the macro ARMA_NO_DEBUG, which disables all run-time checks, such as bounds checking, in the Armadillo library. This will result in faster code. This option is disabled by default during development, but automatically set to ON if the option ENABLE_PACKAGING is set to ON.
- Apply more clang-tidy checks related to readability: readability-avoid-const-params-in-decls, readability-braces-around-statements, readability-isolate-declaration, readability-redundant-control-flow, readability-uppercase-literal-suffix. Fixed raised warnings.
- Fixed cpplint.py build/include_what_you_use, whitespace/tab, whitespace/blank_line errors.
- Fixed a number of defects detected by cpplint.py. Filters applied: +build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,+build/include_what_you_use,+build/printf_format,+build/storage_class,+readability/constructors,+readability/namespace,+readability/newline,+readability/utf8,+runtime/casting,+runtime/explicit,+runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,+runtime/member_string_references,+runtime/memset,+runtime/operator,+runtime/printf,+runtime/printf_format,+whitespace/blank_line.
- clang-format can now be applied to the whole code tree without breaking compilation.
- Added more check options to .clang-tidy file.
- Default Python version is now >= 3.4. Python 2.7 still can be used in systems where Python 3 is not available (e.g., CentOS 7, Debian 8, Ubuntu 10.04).
- CMake now passes the CMAKE_BUILD_TYPE (or configuration in multi-configuration generators like Xcode) to modules built along gnss-sdr (e.g, the volk_gnsssdr library and googletest). Build types available: None, Release (by default), Debug, RelWithDebInfo, MinSizeRel, Coverage, NoOptWithASM, O2WithASM, O3WithASM, ASAN.
- Updated links in comments along the source code and in CMake scripts.
- Create a CI job in GitHub to ensure that clang-tidy has been applied in most of the source code (some optional blocks and tests are left apart).
- Create a CI job in GitHub to ensure that clang-format has been applied.
- Create a CI job in GitHub to ensure that cpplint filters have been applied.
- Create a CI job in GitHub to ensure compliance with REUSE Specification (see https://reuse.software)

View File

@ -158,7 +158,6 @@ double adjcp(rtcm_t *rtcm, int sat, int freq, double cp)
{
if (rtcm->cp[sat - 1][freq] == 0.0)
{
;
}
else if (cp < rtcm->cp[sat - 1][freq] - 750.0)
{
@ -1860,7 +1859,6 @@ int decode_type1047(rtcm_t *rtcm)
eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0, 0.0}, {0, 0.0}, {0, 0.0},
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, {0.0}, 0.0, 0.0};
;
double toc;
double sqrtA;
char *msg;

View File

@ -3142,7 +3142,6 @@ int readblq(const char *file, const char *sta, double *odisp)
sscanf(sta, "%16s", staname);
for (p = staname; (*p = static_cast<char>(toupper(static_cast<int>(*p)))); p++)
{
;
}
if (!(fp = fopen(file, "re")))
@ -3163,7 +3162,6 @@ int readblq(const char *file, const char *sta, double *odisp)
}
for (p = name; (*p = static_cast<char>(toupper(static_cast<int>(*p)))); p++)
{
;
}
if (strcmp(name, staname) != 0)
{

View File

@ -1002,35 +1002,35 @@ void detslp_gf_L1L5(rtk_t *rtk, const obsd_t *obs, int i, int j,
void detslp_dop(rtk_t *rtk __attribute__((unused)), const obsd_t *obs __attribute__((unused)), int i __attribute__((unused)), int rcv __attribute__((unused)),
const nav_t *nav __attribute__((unused)))
{
/* detection with doppler disabled because of clock-jump issue (v.2.3.0) */
/* detection with doppler disabled because of clock-jump issue (v.2.3.0) */
#if 0
int f,sat = obs[i].sat;
double tt,dph,dpt,lam,thres;
int f, sat = obs[i].sat;
double tt, dph, dpt, lam, thres;
trace(3,"detslp_dop: i=%d rcv=%d\n",i,rcv);
trace(3, "detslp_dop: i=%d rcv=%d\n", i, rcv);
for (f = 0;f<rtk->opt.nf;f++)
for (f = 0; f < rtk->opt.nf; f++)
{
if (obs[i].L[f] == 0.0 || obs[i].D[f] == 0.0 || rtk->ph[rcv-1][sat-1][f] == 0.0)
if (obs[i].L[f] == 0.0 || obs[i].D[f] == 0.0 || rtk->ph[rcv - 1][sat - 1][f] == 0.0)
{
continue;
}
if (fabs(tt = timediff(obs[i].time,rtk->pt[rcv-1][sat-1][f]))<DTTOL) continue;
if ((lam = nav->lam[sat-1][f])<=0.0) continue;
if (fabs(tt = timediff(obs[i].time, rtk->pt[rcv - 1][sat - 1][f])) < DTTOL) continue;
if ((lam = nav->lam[sat - 1][f]) <= 0.0) continue;
/* cycle slip threshold (cycle) */
thres = MAXACC*tt*tt/2.0/lam+rtk->opt.err[4]*fabs(tt)*4.0;
thres = MAXACC * tt * tt / 2.0 / lam + rtk->opt.err[4] * fabs(tt) * 4.0;
/* phase difference and doppler x time (cycle) */
dph = obs[i].L[f]-rtk->ph[rcv-1][sat-1][f];
dpt = -obs[i].D[f]*tt;
dph = obs[i].L[f] - rtk->ph[rcv - 1][sat - 1][f];
dpt = -obs[i].D[f] * tt;
if (fabs(dph-dpt)<=thres) continue;
if (fabs(dph - dpt) <= thres) continue;
rtk->slip[sat-1][f]| = 1;
rtk->slip[sat - 1][f] | = 1;
errmsg(rtk,"slip detected (sat=%2d rcv=%d L%d=%.3f %.3f thres=%.3f)\n",
sat,rcv,f+1,dph,dpt,thres);
errmsg(rtk, "slip detected (sat=%2d rcv=%d L%d=%.3f %.3f thres=%.3f)\n",
sat, rcv, f + 1, dph, dpt, thres);
}
#endif
}
@ -1814,26 +1814,26 @@ int ddres(rtk_t *rtk, const nav_t *nav, double dt, const double *x,
nb[b]++;
}
#if 0 /* residuals referenced to reference satellite (2.4.2 p11) */
/* restore single-differenced residuals assuming sum equal zero */
if (f<nf)
{
for (j=0,s=0.0;j<MAXSAT;j++) s+=rtk->ssat[j].resc[f];
s/=nb[b]+1;
for (j=0;j<MAXSAT;j++)
{
if (j == sat[i]-1||rtk->ssat[j].resc[f]!=0.0) rtk->ssat[j].resc[f]-=s;
}
}
else
{
for (j=0,s=0.0;j<MAXSAT;j++) s+=rtk->ssat[j].resp[f-nf];
s/=nb[b]+1;
for (j=0;j<MAXSAT;j++)
{
if (j == sat[i]-1||rtk->ssat[j].resp[f-nf]!=0.0)
rtk->ssat[j].resp[f-nf]-=s;
}
}
/* restore single-differenced residuals assuming sum equal zero */
if (f < nf)
{
for (j = 0, s = 0.0; j < MAXSAT; j++) s += rtk->ssat[j].resc[f];
s /= nb[b] + 1;
for (j = 0; j < MAXSAT; j++)
{
if (j == sat[i] - 1 || rtk->ssat[j].resc[f] != 0.0) rtk->ssat[j].resc[f] -= s;
}
}
else
{
for (j = 0, s = 0.0; j < MAXSAT; j++) s += rtk->ssat[j].resp[f - nf];
s /= nb[b] + 1;
for (j = 0; j < MAXSAT; j++)
{
if (j == sat[i] - 1 || rtk->ssat[j].resp[f - nf] != 0.0)
rtk->ssat[j].resp[f - nf] -= s;
}
}
#endif
b++;
}
@ -2323,21 +2323,21 @@ int valpos(rtk_t *rtk, const double *v, const double *R, const int *vflg,
sat1, sat2, stype, freq + 1, v[i], std::sqrt(R[i + i * nv]));
}
#if 0 /* omitted v.2.4.0 */
if (stat&&nv>NP(opt))
if (stat && nv > NP(opt))
{
/* chi-square validation */
for (i = 0; i<nv; i++) vv += v[i]*v[i]/R[i+i*nv];
for (i = 0; i < nv; i++) vv += v[i] * v[i] / R[i + i * nv];
if (vv > chisqr[nv-NP(opt)-1])
if (vv > chisqr[nv - NP(opt) - 1])
{
errmsg(rtk,"residuals validation failed (nv=%d np=%d vv=%.2f cs=%.2f)\n",
nv, NP(opt), vv, chisqr[nv-NP(opt)-1]);
errmsg(rtk, "residuals validation failed (nv=%d np=%d vv=%.2f cs=%.2f)\n",
nv, NP(opt), vv, chisqr[nv - NP(opt) - 1]);
stat = 0;
}
else
{
trace(3,"valpos : validation ok (%s nv=%d np=%d vv=%.2f cs=%.2f)\n",
rtk->tstr, nv, NP(opt), vv, chisqr[nv-NP(opt)-1]);
trace(3, "valpos : validation ok (%s nv=%d np=%d vv=%.2f cs=%.2f)\n",
rtk->tstr, nv, NP(opt), vv, chisqr[nv - NP(opt) - 1]);
}
}
#endif
@ -2790,11 +2790,9 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
/* count rover/base station observations */
for (nu = 0; nu < n && obs[nu].rcv == 1; nu++)
{
;
}
for (nr = 0; nu + nr < n && obs[nu + nr].rcv == 2; nr++)
{
;
}
time = rtk->sol.time; /* previous epoch */

View File

@ -1157,7 +1157,6 @@ int waittcpsvr(tcpsvr_t *tcpsvr, char *msg)
}
while (accsock(tcpsvr, msg))
{
;
}
updatetcpsvr(tcpsvr, msg);
return tcpsvr->svr.state == 2;
@ -2848,7 +2847,6 @@ void strsendcmd(stream_t *str, const char *cmd)
if (!*msg || *msg == '#')
{ /* null or comment */
;
}
else if (*msg == '!')
{ /* binary escape */

View File

@ -29,10 +29,11 @@
#include <gnuradio/block.h> // for block
#include <gnuradio/types.h> // for gr_vector_int
#include <cstdint> // for int32_t
#include <fstream> // for string, ofstream
#include <memory> // for shared_ptr
#include <string>
#include <vector>
#include <fstream> // for std::ofstream
#include <map> // for std::map
#include <memory> // for std:shared_ptr
#include <string> // for std::string
#include <vector> // for std::vector
class Gnss_Synchro;
class hybrid_observables_gs;
@ -58,7 +59,7 @@ public:
private:
friend hybrid_observables_gs_sptr hybrid_observables_gs_make(const Obs_Conf& conf_);
hybrid_observables_gs(const Obs_Conf& conf_);
explicit hybrid_observables_gs(const Obs_Conf& conf_);
Obs_Conf d_conf;

View File

@ -315,7 +315,7 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t
// 2. Viterbi decoder
// 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder)
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180<EFBFBD>
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180 degrees
for (int32_t i = 0; i < frame_length; i++)
{
if ((i + 1) % 2 == 0)

View File

@ -244,7 +244,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
d_acq_code_phase_samples = corrected_acq_phase_samples;
d_carrier_frequency_hz = d_acq_carrier_doppler_hz + (DFRQ1_GLO * static_cast<double>(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)));
;
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast<double>(d_fs_in);

View File

@ -242,7 +242,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
d_acq_code_phase_samples = corrected_acq_phase_samples;
d_carrier_frequency_hz = d_acq_carrier_doppler_hz + (DFRQ2_GLO * static_cast<double>(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)));
;
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast<double>(d_fs_in);

View File

@ -205,7 +205,7 @@ bool Fpga_Multicorrelator_8sc::free()
void Fpga_Multicorrelator_8sc::set_channel(uint32_t channel)
{
char device_io_name[max_length_deviceio_name]; // driver io name
char device_io_name[max_length_deviceio_name] = ""; // driver io name
d_channel = channel;
// open the device corresponding to the assigned channel

View File

@ -1723,8 +1723,7 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector<arma::mat>* obs_vec, Gn
}
}
} // end while
} // End of 'try' block
} // End of 'try' block
catch (const gpstk::FFStreamError& e)
{

View File

@ -1240,9 +1240,8 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults)
}
}
} // end plot
} // end acquisition Delay errors loop
} // end acquisition Doppler errors loop
} // end acquisition Delay errors loop
} // end acquisition Doppler errors loop
pull_in_results_v_v.push_back(pull_in_results_v);
} // end CN0 LOOP

View File

@ -125,11 +125,11 @@ std::map<int, arma::mat> ReadRinexObs(std::string rinex_file, char system, std::
{
obs_mat.at(obs_mat.n_rows - 1, 0) = sow;
dataobj = r_ref_data.getObs(prn, "C1C", r_ref_header);
obs_mat.at(obs_mat.n_rows - 1, 1) = dataobj.data; //C1C P1 (psudorange L1)
obs_mat.at(obs_mat.n_rows - 1, 1) = dataobj.data; // C1C P1 (pseudorange L1)
dataobj = r_ref_data.getObs(prn, "D1C", r_ref_header);
obs_mat.at(obs_mat.n_rows - 1, 2) = dataobj.data; //D1C Carrier Doppler
obs_mat.at(obs_mat.n_rows - 1, 2) = dataobj.data; // D1C Carrier Doppler
dataobj = r_ref_data.getObs(prn, "L1C", r_ref_header);
obs_mat.at(obs_mat.n_rows - 1, 3) = dataobj.data; //L1C Carrier Phase
obs_mat.at(obs_mat.n_rows - 1, 3) = dataobj.data; // L1C Carrier Phase
}
else if (strcmp("1B\0", signal.c_str()) == 0)
{
@ -141,7 +141,7 @@ std::map<int, arma::mat> ReadRinexObs(std::string rinex_file, char system, std::
dataobj = r_ref_data.getObs(prn, "L1B", r_ref_header);
obs_mat.at(obs_mat.n_rows - 1, 3) = dataobj.data;
}
else if (strcmp("2S\0", signal.c_str()) == 0) //L2M
else if (strcmp("2S\0", signal.c_str()) == 0) // L2M
{
obs_mat.at(obs_mat.n_rows - 1, 0) = sow;
dataobj = r_ref_data.getObs(prn, "C2S", r_ref_header);