Major cleanup of compilation warnings.

This commit is contained in:
Anne de Jong 2020-10-16 20:37:02 +02:00
parent bc9639f10c
commit f54ac216c1
10 changed files with 31 additions and 32 deletions

View File

@ -72,7 +72,7 @@ set(Python_ADDITIONAL_VERSIONS "3.8")
# General make flags # General make flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -Wextra -Wno-type-limits \ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -Wextra -Wno-type-limits \
-Werror=implicit-function-declaration \ -Werror=implicit-function-declaration -Wno-unused-parameter \
-Werror=return-type") -Werror=return-type")
if(CMAKE_SYSTEM_NAME STREQUAL "Windows") if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
@ -131,7 +131,7 @@ endif(LASP_DEBUG)
# occures. # occures.
############################## General compilation flags (independent of debug mode, windows or linux) ############################## General compilation flags (independent of debug mode, windows or linux)
set(CYTHON_EXTRA_C_FLAGS "-Wno-sign-compare -Wno-cpp -Wno-implicit-fallthrough -Wno-incompatible-pointer-types -Wno-strict-aliasing") set(CYTHON_EXTRA_C_FLAGS "-Wno-sign-compare -Wno-cpp -Wno-implicit-fallthrough -Wno-incompatible-pointer-types -Wno-strict-aliasing")
set(CYTHON_EXTRA_CXX_FLAGS "-Wno-sign-compare -Wno-cpp -Wno-implicit-fallthrough -Wno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -Wall -Wextra \ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -Wall -Wextra \
@ -169,7 +169,6 @@ include_directories(
lasp/c lasp/c
) )
set(cpp_daq_linklibs pthread)
add_subdirectory(lasp) add_subdirectory(lasp)
add_subdirectory(test) add_subdirectory(test)

View File

@ -15,16 +15,17 @@
typedef struct Fft_s { typedef struct Fft_s {
us nfft; us nfft;
vd fft_work; // Storage memory for fftpack vd fft_work; // Storage memory for fftpack
}; } Fft_s;
#elif defined LASP_FFT_BACKEND_FFTW #elif defined LASP_FFT_BACKEND_FFTW
#include <fftw3.h> #include <fftw3.h>
typedef struct Fft_s { typedef struct Fft_s {
us nfft; us nfft;
fftw_plan forward_plan; fftw_plan forward_plan;
fftw_plan reverse_plan; fftw_plan reverse_plan;
c* complex_storage; c* complex_storage;
d* real_storage; d* real_storage;
}; } Fft_s;
#endif #endif

View File

@ -131,7 +131,7 @@ static inline c* getvcval(const vc* vec,us row){
*/ */
static inline void dmat_set(dmat* mat,const d value){ static inline void dmat_set(dmat* mat,const d value){
dbgassert(mat,NULLPTRDEREF); dbgassert(mat,NULLPTRDEREF);
if(likely(mat->n_cols * mat->n_rows > 0)) { if(islikely(mat->n_cols * mat->n_rows > 0)) {
for(us col=0;col<mat->n_cols;col++) { for(us col=0;col<mat->n_cols;col++) {
d_set(getdmatval(mat,0,col),value,mat->n_rows); d_set(getdmatval(mat,0,col),value,mat->n_rows);
} }
@ -147,7 +147,7 @@ static inline void dmat_set(dmat* mat,const d value){
*/ */
static inline void cmat_set(cmat* mat,const c value){ static inline void cmat_set(cmat* mat,const c value){
dbgassert(mat,NULLPTRDEREF); dbgassert(mat,NULLPTRDEREF);
if(likely(mat->n_cols * mat->n_rows > 0)) { if(islikely(mat->n_cols * mat->n_rows > 0)) {
for(us col=0;col<mat->n_cols;col++) { for(us col=0;col<mat->n_cols;col++) {
c_set(getcmatval(mat,0,col),value,mat->n_rows); c_set(getcmatval(mat,0,col),value,mat->n_rows);
} }

View File

@ -9,8 +9,6 @@
#pragma once #pragma once
#ifndef LASP_PYARRAY_H #ifndef LASP_PYARRAY_H
#define LASP_PYARRAY_H #define LASP_PYARRAY_H
#define TRACERPLUS (-10)
#include <numpy/ndarrayobject.h> #include <numpy/ndarrayobject.h>
#ifdef LASP_DOUBLE_PRECISION #ifdef LASP_DOUBLE_PRECISION
#define LASP_NUMPY_FLOAT_TYPE NPY_FLOAT64 #define LASP_NUMPY_FLOAT_TYPE NPY_FLOAT64

View File

@ -8,7 +8,6 @@
#pragma once #pragma once
#ifndef LASP_PYTHON_H #ifndef LASP_PYTHON_H
#define LASP_PYTHON_H #define LASP_PYTHON_H
#define TRACERPLUS (-10)
#include "lasp_pyarray.h" #include "lasp_pyarray.h"
/** /**

View File

@ -209,7 +209,7 @@ dmat Slm_run(Slm *slm, vd *input_data) {
} }
iVARTRACE(15, cur_offset); iVARTRACE(15, cur_offset);
iVARTRACE(15, i); iVARTRACE(15, i);
dbgassert(i == (int) nsamples_output, "BUG"); dbgassert(i == nsamples_output, "BUG");
vd_free(&power_filtered); vd_free(&power_filtered);
vd_free(&chan); vd_free(&chan);

View File

@ -39,10 +39,10 @@ us Sosfilterbank_getFilterbankSize(const Sosfilterbank* fb) {
int filter_single(void* worker_data,void* job); int filter_single(void* worker_data,void* job);
static inline min(us a, us b){ static inline us min(us a, us b){
return a<b?a:b; return a<b?a:b;
} }
static inline max(us a, us b){ static inline us max(us a, us b){
return a>b?a:b; return a>b?a:b;
} }

View File

@ -11,15 +11,12 @@
#define LASP_TYPES_H #define LASP_TYPES_H
#include <stddef.h> #include <stddef.h>
// // Branch prediction performance improvement // // Branch prediction performance improvement
#if !defined(likely) #if !defined(islikely) && defined(__GNUC__) && !defined(LASP_DEBUG)
#if defined(__GNUC__) && !defined(LASP_DEBUG) #define islikely(x) __builtin_expect(!!(x), 1)
#define likely(x) __builtin_expect(!!(x), 1) #define isunlikely(x) __builtin_expect(!!(x), 0)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else #else
#define likely(x) (x) #define islikely(x) (x)
#define unlikely(x) (x) #define isunlikely(x) (x)
#endif // if defined(__GNUC__) && !defined(LASP_DEBUG)
#endif // !defined(likely) #endif // !defined(likely)
/// We often use boolean values /// We often use boolean values

View File

@ -1,22 +1,21 @@
set(cpp_daq_files lasp_cppdaq.cpp) set(cpp_daq_files lasp_cppdaq.cpp)
# set(cpp_daq_linklibs pthread) set(mycpp_daq_linklibs pthread)
# set(cpp_daq_linklibs PARENT_SCOPE)
if(LASP_RTAUDIO) if(LASP_RTAUDIO)
include_directories(/usr/include/rtaudio) include_directories(/usr/include/rtaudio)
list(APPEND cpp_daq_files lasp_cpprtaudio.cpp) list(APPEND cpp_daq_files lasp_cpprtaudio.cpp)
list(PREPEND cpp_daq_linklibs rtaudio) list(PREPEND mycpp_daq_linklibs rtaudio)
endif() endif()
if(LASP_ULDAQ) if(LASP_ULDAQ)
list(APPEND cpp_daq_files lasp_cppuldaq.cpp) list(APPEND cpp_daq_files lasp_cppuldaq.cpp)
list(PREPEND cpp_daq_linklibs uldaq) list(PREPEND mycpp_daq_linklibs uldaq)
endif() endif()
if(win32) if(win32)
list(APPEND cpp_daq_linklibs python) list(APPEND mycpp_daq_linklibs python)
endif(win32) endif(win32)
message("Linklibs: ${cpp_daq_linklibs}")
add_library(cpp_daq ${cpp_daq_files}) add_library(cpp_daq ${cpp_daq_files})
target_link_libraries(cpp_daq ${mycpp_daq_linklibs})
foreach(cython_file lasp_daq lasp_deviceinfo lasp_daqconfig) foreach(cython_file lasp_daq lasp_deviceinfo lasp_daqconfig)
@ -28,7 +27,13 @@ foreach(cython_file lasp_daq lasp_deviceinfo lasp_daqconfig)
cython_add_module(${cython_file} ${cython_file}.pyx) cython_add_module(${cython_file} ${cython_file}.pyx)
target_link_libraries(${cython_file} ${cpp_daq_linklibs}) target_link_libraries(${cython_file} ${mycpp_daq_linklibs})
endforeach() endforeach()
# This is the way to make this variable work in all CMakeLists files. It is
# also used in the testing directory. But better to already link cpp_daq with
# linklibs.
# set(cpp_daq_linklibs "${mycpp_daq_linklibs}" CACHE INTERNAL "cpp_daq_linklibs")

View File

@ -7,9 +7,9 @@ add_executable(test_fft test_fft.c)
add_executable(test_math test_math.c) add_executable(test_math test_math.c)
target_link_libraries(test_bf lasp_lib) target_link_libraries(test_bf lasp_lib)
target_link_libraries(test_fft lasp_lib pthread) target_link_libraries(test_fft lasp_lib)
target_link_libraries(test_workers lasp_lib pthread) target_link_libraries(test_workers lasp_lib)
target_link_libraries(test_math lasp_lib pthread) target_link_libraries(test_math lasp_lib)
add_executable(test_uldaq test_uldaq.cpp) add_executable(test_uldaq test_uldaq.cpp)
target_link_libraries(test_uldaq cpp_daq ${cpp_daq_linklibs}) target_link_libraries(test_uldaq cpp_daq)