Skip to content
Snippets Groups Projects
Commit cc99b60d authored by Mark de Wever's avatar Mark de Wever
Browse files

AST-1144 Enable more compiler warnings

parent ccac3bee
No related branches found
No related tags found
1 merge request!283AST-1144 Enable more compiler warnings
Pipeline #44572 passed with warnings
...@@ -70,7 +70,7 @@ endif() ...@@ -70,7 +70,7 @@ endif()
# Include aocommon/eigen3/pybind11 headers # Include aocommon/eigen3/pybind11 headers
include_directories("${CMAKE_SOURCE_DIR}/external/aocommon/include/") include_directories("${CMAKE_SOURCE_DIR}/external/aocommon/include/")
include_directories("${CMAKE_SOURCE_DIR}/external/eigen/") include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/external/eigen/")
# Find python with cmake to convince pybind11 to use right python path # Find python with cmake to convince pybind11 to use right python path
# This can go when we're using CMake >= 3.12: # This can go when we're using CMake >= 3.12:
# https://pybind11.readthedocs.io/en/stable/compiling.html#findpython-mode # https://pybind11.readthedocs.io/en/stable/compiling.html#findpython-mode
...@@ -98,7 +98,7 @@ find_package(Threads REQUIRED) ...@@ -98,7 +98,7 @@ find_package(Threads REQUIRED)
# Find and include Casacore # Find and include Casacore
set(CASACORE_MAKE_REQUIRED_EXTERNALS_OPTIONAL TRUE) set(CASACORE_MAKE_REQUIRED_EXTERNALS_OPTIONAL TRUE)
find_package(Casacore REQUIRED COMPONENTS casa ms tables measures fits) find_package(Casacore REQUIRED COMPONENTS casa ms tables measures fits)
include_directories(${CASACORE_INCLUDE_DIRS}) include_directories(SYSTEM ${CASACORE_INCLUDE_DIRS})
# Find and include Boost headers (boost::math required for MWA beam) # Find and include Boost headers (boost::math required for MWA beam)
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
...@@ -136,7 +136,17 @@ endif() ...@@ -136,7 +136,17 @@ endif()
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO) set(CMAKE_CXX_EXTENSIONS NO)
add_compile_options("${OpenMP_CXX_FLAGS}" -Wall) add_compile_options(
"${OpenMP_CXX_FLAGS}"
-Wall
-Wnon-virtual-dtor
-Wzero-as-null-pointer-constant
-Wduplicated-branches
-Wundef
-Wvla
-Wpointer-arith
-Wextra
-Wno-unused-parameter)
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--no-undefined") string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--no-undefined")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
......
...@@ -150,16 +150,13 @@ void StoreBeam(const std::string& filename, const std::complex<float>* buffer, ...@@ -150,16 +150,13 @@ void StoreBeam(const std::string& filename, const std::complex<float>* buffer,
<< " x " << ny << ")\n"; << " x " << ny << ")\n";
std::vector<double> img(nx * ny * width * height, 0.0); std::vector<double> img(nx * ny * width * height, 0.0);
for (size_t ant = 0; ant != nStations; ++ant) { for (size_t ant = 0; ant != nStations; ++ant) {
typedef std::complex<float> Data[nStations][height][width][4];
Data* data_ptr = (Data*)buffer;
size_t xCorner = (ant % nx) * width, yCorner = (ant / nx) * height; size_t xCorner = (ant % nx) * width, yCorner = (ant / nx) * height;
for (size_t y = 0; y != height; ++y) { for (size_t y = 0; y != height; ++y) {
for (size_t x = 0; x != width; ++x) { for (size_t x = 0; x != width; ++x) {
std::complex<float> response = 0; std::complex<float> response = 0;
for (auto pol = 0; pol < 4; pol++) { for (auto pol = 0; pol < 4; pol++) {
std::complex<float> value = (*data_ptr)[ant][y][x][pol]; response += *buffer * std::conj(*buffer);
response += value * std::conj(value); ++buffer;
} }
img[(yCorner + y) * width * nx + x + xCorner] = abs(response) / 2; img[(yCorner + y) * width * nx + x + xCorner] = abs(response) / 2;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment