aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-10-04 18:57:50 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-10-04 18:57:50 +0200
commite21884ad871f52bcd02fc492084bade3dfab275a (patch)
tree2a97768de2fc19ec680f5fbeeccc88163f2aa397
parentecf405846aec3ce7455f68379d86d6888b135c50 (diff)
downloaddabmod-e21884ad871f52bcd02fc492084bade3dfab275a.tar.gz
dabmod-e21884ad871f52bcd02fc492084bade3dfab275a.tar.bz2
dabmod-e21884ad871f52bcd02fc492084bade3dfab275a.zip
Actually enable the new warnings for C++
-rw-r--r--configure.ac5
-rw-r--r--src/DabMod.cpp10
-rw-r--r--src/OfdmGenerator.cpp4
-rw-r--r--src/Resampler.cpp2
4 files changed, 11 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 2205567..0c07732 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,14 +79,15 @@ AC_ARG_ENABLE([output_uhd],
[AS_HELP_STRING([--disable-output-uhd], [Disable UHD output])],
[], [enable_output_uhd=yes])
+AC_LANG_PUSH([C++])
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], [CFLAGS="$CFLAGS -Wduplicated-cond"])
AX_CHECK_COMPILE_FLAG([-Wduplicated-branches], [CFLAGS="$CFLAGS -Wduplicated-branches"])
AX_CHECK_COMPILE_FLAG([-Wlogical-op], [CFLAGS="$CFLAGS -Wlogical-op"])
AX_CHECK_COMPILE_FLAG([-Wrestrict], [CFLAGS="$CFLAGS -Wrestrict"])
-AX_CHECK_COMPILE_FLAG([-Wuseless-cast], [CFLAGS="$CFLAGS -Wuseless-cast"])
-AX_CHECK_COMPILE_FLAG([-Wdouble-precision], [CFLAGS="$CFLAGS -Wdouble-precision"])
AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"])
+AX_CHECK_COMPILE_FLAG([-Wdouble-promotion], [CXXFLAGS="$CXXFLAGS -Wdouble-promotion"])
AX_CHECK_COMPILE_FLAG(["-Wformat=2"], [CFLAGS="$CFLAGS -Wformat=2"])
+AC_LANG_POP([C++])
PKG_CHECK_MODULES([FFTW], [fftw3f], [], [AC_MSG_ERROR([FFTW is required])])
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 15b3be2..2caba5d 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -170,9 +170,9 @@ static void printModSettings(const mod_settings_t& mod_settings)
fprintf(stderr, " Sampling rate: ");
if (mod_settings.outputRate > 1000) {
if (mod_settings.outputRate > 1000000) {
- fprintf(stderr, "%.4g MHz\n", mod_settings.outputRate / 1000000.0f);
+ fprintf(stderr, "%.4g MHz\n", mod_settings.outputRate / 1000000.0);
} else {
- fprintf(stderr, "%.4g kHz\n", mod_settings.outputRate / 1000.0f);
+ fprintf(stderr, "%.4g kHz\n", mod_settings.outputRate / 1000.0);
}
} else {
fprintf(stderr, "%zu Hz\n", mod_settings.outputRate);
@@ -190,11 +190,11 @@ static shared_ptr<ModOutput> prepare_output(
}
if (s.fileOutputFormat == "complexf_normalised") {
if (s.gainMode == GainMode::GAIN_FIX)
- s.normalise = 1.0 / normalise_factor_file_fix;
+ s.normalise = 1.0f / normalise_factor_file_fix;
else if (s.gainMode == GainMode::GAIN_MAX)
- s.normalise = 1.0 / normalise_factor_file_max;
+ s.normalise = 1.0f / normalise_factor_file_max;
else if (s.gainMode == GainMode::GAIN_VAR)
- s.normalise = 1.0 / normalise_factor_file_var;
+ s.normalise = 1.0f / normalise_factor_file_var;
output = make_shared<OutputFile>(s.outputName);
}
else if (s.fileOutputFormat == "s8" or
diff --git a/src/OfdmGenerator.cpp b/src/OfdmGenerator.cpp
index 6a5044e..48449c3 100644
--- a/src/OfdmGenerator.cpp
+++ b/src/OfdmGenerator.cpp
@@ -230,8 +230,8 @@ int OfdmGenerator::process(Buffer* const dataIn, Buffer* dataOut)
double sum_iq = 0;
double sum_delta = 0;
for (size_t i = 0; i < mySpacing; i++) {
- sum_iq += std::norm(before_cfr[i]);
- sum_delta += std::norm(symbol[i] - before_cfr[i]);
+ sum_iq += (double)std::norm(before_cfr[i]);
+ sum_delta += (double)std::norm(symbol[i] - before_cfr[i]);
}
const double mer = 10.0 * std::log10(sum_iq / sum_delta);
myMERs.push_back(mer);
diff --git a/src/Resampler.cpp b/src/Resampler.cpp
index 8786e91..8069a61 100644
--- a/src/Resampler.cpp
+++ b/src/Resampler.cpp
@@ -83,7 +83,7 @@ Resampler::Resampler(size_t inputRate, size_t outputRate, size_t resolution) :
myWindow = (float*)memalign(16, myFftSizeIn * sizeof(float));
for (size_t i = 0; i < myFftSizeIn; ++i) {
- myWindow[i] = 0.5f * (1.0f - cosf(2.0f * M_PI * i / (myFftSizeIn - 1)));
+ myWindow[i] = (float)(0.5 * (1.0 - cos(2.0 * M_PI * i / (myFftSizeIn - 1))));
PDEBUG("Window[%zu] = %f\n", i, myWindow[i]);
}