From 166567f0cbae018517d8a251ad1d3510f8c7e233 Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Wed, 23 Nov 2022 11:09:51 +0100 Subject: [PATCH 1/8] Disable all warnings currently generated. These warnings can be switched on one by one afterwards and be dealt with accordingly since they are clearly visible. --- libs/qm-dsp/maths/pca/pca.c | 6 ++++++ wscript | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libs/qm-dsp/maths/pca/pca.c b/libs/qm-dsp/maths/pca/pca.c index 1a7bfdd549c..a0e88f6a5d5 100644 --- a/libs/qm-dsp/maths/pca/pca.c +++ b/libs/qm-dsp/maths/pca/pca.c @@ -1,5 +1,6 @@ /*********************************/ /* Principal Components Analysis */ +/* */ /*********************************/ /*********************************************************************/ @@ -27,6 +28,11 @@ #define SIGN(a, b) ( (b) < 0 ? -fabs(a) : fabs(a) ) +void covcol(double** data, int n, int m, double** symmat); +void erhand(char* err_msg); +void tred2(double** a, int n, double* d, double* e); +void tqli(double* d, double* e, int n, double** z); + /** Variance-covariance matrix: creation *****************************/ /* Create m * m covariance matrix from given n * m data matrix. */ diff --git a/wscript b/wscript index 05f271c91f4..f694061fc18 100644 --- a/wscript +++ b/wscript @@ -70,6 +70,14 @@ compiler_flags_dictionaries= { 'generic-arm64' : '', # All flags required to get basic warnings to be generated by the compiler 'basic-warnings' : [ '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter' ], + # All flags for a quiet build + 'quiet-build' : [ '-Wno-deprecated-declarations', '-Wno-unused-value', '-Wno-unused-result', + '-Wno-use-after-free', '-Wno-unknown-pragmas', '-Wno-cast-qual', + '-Wno-maybe-uninitialized', '-Wno-cpp', '-Wno-switch', '-Wno-free-nonheap-object', + '-Wno-reorder' ], + 'quiet-build-c': [ '-Wno-strict-prototypes' ], + # All warnings (left from quiet-build) are errors + 'error-warnings' : [ '-Werror' ], # Any additional flags for warnings that are specific to C (not C++) 'extra-c-warnings' : [ '-Wstrict-prototypes', '-Wmissing-prototypes' ], # Any additional flags for warnings that are specific to C++ (not C) @@ -150,7 +158,7 @@ clang_dict['xsaveintrin'] = '' clang_dict['xmmintrinsics'] = '' clang_dict['silence-unused-arguments'] = '-Qunused-arguments' clang_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual', '-Wno-mismatched-tags', '-Wno-cast-align', '-Wno-unused-local-typedefs', '-Wunneeded-internal-declaration' ] -clang_dict['basic-warnings'] = [ '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter', '-Wno-deprecated-declarations', '-Wno-deprecated-copy-with-user-provided-copy' ] +clang_dict['basic-warnings'] = [ '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter', '-Wno-deprecated-copy-with-user-provided-copy' ] clang_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ] clang_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ] clang_dict['generic-x86'] = [ '-arch', 'i386' ] @@ -744,7 +752,11 @@ int main() { return 0; }''', compiler_flags.extend(flags_dict['basic-warnings']) + compiler_flags.extend(flags_dict['quiet-build']) + #compiler_flags.extend(flags_dict['error-warnings']) + c_flags.extend(flags_dict['extra-c-warnings']) + c_flags.extend(flags_dict['quiet-build-c']) cxx_flags.extend (flags_dict['extra-cxx-warnings']) # From 450df7fd1da048011af3b42f5199b5261f958e6f Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Wed, 23 Nov 2022 11:42:28 +0100 Subject: [PATCH 2/8] Switch Werror and fix resulting failures. --- libs/pbd/mountpoint.cc | 12 ++++++++++++ wscript | 8 +++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libs/pbd/mountpoint.cc b/libs/pbd/mountpoint.cc index df128aaf62a..09c89f41456 100644 --- a/libs/pbd/mountpoint.cc +++ b/libs/pbd/mountpoint.cc @@ -110,6 +110,16 @@ mountpoint (string path) #else // !HAVE_GETMNTENT +#ifdef __linux__ + +string +mountpoint (string path) +{ + return ""; +} + +#else // !__linux__ + #include #include #include @@ -171,6 +181,8 @@ mountpoint (string path) return best; } +#endif // __linux__ + #endif // HAVE_GETMNTENT #ifdef TEST_MOUNTPOINT diff --git a/wscript b/wscript index f694061fc18..3c28d2ff854 100644 --- a/wscript +++ b/wscript @@ -73,9 +73,9 @@ compiler_flags_dictionaries= { # All flags for a quiet build 'quiet-build' : [ '-Wno-deprecated-declarations', '-Wno-unused-value', '-Wno-unused-result', '-Wno-use-after-free', '-Wno-unknown-pragmas', '-Wno-cast-qual', - '-Wno-maybe-uninitialized', '-Wno-cpp', '-Wno-switch', '-Wno-free-nonheap-object', - '-Wno-reorder' ], + '-Wno-maybe-uninitialized', '-Wno-cpp', '-Wno-switch', '-Wno-free-nonheap-object' ], 'quiet-build-c': [ '-Wno-strict-prototypes' ], + 'quiet-build-cxx': [ '-Wno-reorder' ], # All warnings (left from quiet-build) are errors 'error-warnings' : [ '-Werror' ], # Any additional flags for warnings that are specific to C (not C++) @@ -753,11 +753,13 @@ int main() { return 0; }''', compiler_flags.extend(flags_dict['basic-warnings']) compiler_flags.extend(flags_dict['quiet-build']) - #compiler_flags.extend(flags_dict['error-warnings']) + compiler_flags.extend(flags_dict['error-warnings']) c_flags.extend(flags_dict['extra-c-warnings']) c_flags.extend(flags_dict['quiet-build-c']) + cxx_flags.extend (flags_dict['extra-cxx-warnings']) + cxx_flags.extend(flags_dict['quiet-build-cxx']) # # more boilerplate From 92514dc54c14b9ee2d323cb0033bb73fe23d5e75 Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Wed, 23 Nov 2022 11:50:14 +0100 Subject: [PATCH 3/8] Remove overlooked change. --- libs/qm-dsp/maths/pca/pca.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/qm-dsp/maths/pca/pca.c b/libs/qm-dsp/maths/pca/pca.c index a0e88f6a5d5..8ad33179624 100644 --- a/libs/qm-dsp/maths/pca/pca.c +++ b/libs/qm-dsp/maths/pca/pca.c @@ -1,6 +1,5 @@ /*********************************/ /* Principal Components Analysis */ -/* */ /*********************************/ /*********************************************************************/ From 7f0a92bfa01202a6d90c31f406e72f924c864a6d Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Mon, 28 Nov 2022 09:41:35 +0100 Subject: [PATCH 4/8] Fix getmntent check with -Werror. --- libs/pbd/wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/pbd/wscript b/libs/pbd/wscript index bad6925f923..a877909df82 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -121,7 +121,7 @@ def configure(conf): define_name='HAVE_POSIX_MEMALIGN', execute = False, mandatory=False) conf.check_cc( msg="Checking for function 'getmntent' in mntent.h", - fragment = "#include \n int main(void) { return (int)getmntent(0); }\n", + fragment = "#include \n int main(void) { getmntent(0); }\n", define_name='HAVE_GETMNTENT', execute = False, mandatory=False) conf.check_cc( msg="Checking for function 'localtime_r' in time.h", From 5f670878b6216104a419ed9eecb4fc3bfe4edfc3 Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Mon, 28 Nov 2022 09:54:30 +0100 Subject: [PATCH 5/8] Error if there is no getmntent found on Linux. --- libs/pbd/mountpoint.cc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libs/pbd/mountpoint.cc b/libs/pbd/mountpoint.cc index 09c89f41456..7a118cbc863 100644 --- a/libs/pbd/mountpoint.cc +++ b/libs/pbd/mountpoint.cc @@ -111,14 +111,8 @@ mountpoint (string path) #else // !HAVE_GETMNTENT #ifdef __linux__ - -string -mountpoint (string path) -{ - return ""; -} - -#else // !__linux__ +#error "getmntent is supported on Linux. Is this a configuration error?" +#endif #include #include @@ -181,8 +175,6 @@ mountpoint (string path) return best; } -#endif // __linux__ - #endif // HAVE_GETMNTENT #ifdef TEST_MOUNTPOINT From 360a21052f24a7d3f5b6c0c9317869b8c4700070 Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Mon, 28 Nov 2022 10:01:46 +0100 Subject: [PATCH 6/8] Make pca functions static. --- libs/qm-dsp/maths/pca/pca.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libs/qm-dsp/maths/pca/pca.c b/libs/qm-dsp/maths/pca/pca.c index 8ad33179624..0db27e152b2 100644 --- a/libs/qm-dsp/maths/pca/pca.c +++ b/libs/qm-dsp/maths/pca/pca.c @@ -27,15 +27,10 @@ #define SIGN(a, b) ( (b) < 0 ? -fabs(a) : fabs(a) ) -void covcol(double** data, int n, int m, double** symmat); -void erhand(char* err_msg); -void tred2(double** a, int n, double* d, double* e); -void tqli(double* d, double* e, int n, double** z); - /** Variance-covariance matrix: creation *****************************/ /* Create m * m covariance matrix from given n * m data matrix. */ -void covcol(double** data, int n, int m, double** symmat) +static void covcol(double** data, int n, int m, double** symmat) { double *mean; int i, j, j1, j2; @@ -94,7 +89,7 @@ return; /** Error handler **************************************************/ -void erhand(char* err_msg) +static void erhand(char* err_msg) { fprintf(stderr,"Run-time error:\n"); fprintf(stderr,"%s\n", err_msg); @@ -111,7 +106,7 @@ Ref: Smith et al., Matrix Eigensystem Routines -- EISPACK Guide Springer-Verlag, 1976, pp. 489-494. W H Press et al., Numerical Recipes in C, Cambridge U P, 1988, pp. 373-374. */ -void tred2(double** a, int n, double* d, double* e) +static void tred2(double** a, int n, double* d, double* e) { int l, k, j, i; double scale, hh, h, g, f; @@ -189,7 +184,7 @@ void tred2(double** a, int n, double* d, double* e) /** Tridiagonal QL algorithm -- Implicit **********************/ -void tqli(double* d, double* e, int n, double** z) +static void tqli(double* d, double* e, int n, double** z) { int m, l, iter, i, k; double s, r, p, g, f, dd, c, b; From 31a7cd8ec603656c01e58b8b4716064cea101a7a Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Sat, 3 Dec 2022 13:01:38 +0100 Subject: [PATCH 7/8] Omit new warnings. --- wscript | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 5cb210656e4..4c268145f14 100644 --- a/wscript +++ b/wscript @@ -74,7 +74,8 @@ compiler_flags_dictionaries= { # All flags for a quiet build 'quiet-build' : [ '-Wno-deprecated-declarations', '-Wno-unused-value', '-Wno-unused-result', '-Wno-use-after-free', '-Wno-unknown-pragmas', '-Wno-cast-qual', - '-Wno-maybe-uninitialized', '-Wno-cpp', '-Wno-switch', '-Wno-free-nonheap-object' ], + '-Wno-maybe-uninitialized', '-Wno-cpp', '-Wno-switch', '-Wno-free-nonheap-object', + '-Wno-unused-variable', '-Wno-dangling-pointer', '-Wno-unused-but-set-variable' ], 'quiet-build-c': [ '-Wno-strict-prototypes' ], 'quiet-build-cxx': [ '-Wno-reorder' ], # All warnings (left from quiet-build) are errors From da2c823a5fa9a569e6c1cdfc468cb78e792033be Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Sat, 3 Dec 2022 13:22:07 +0100 Subject: [PATCH 8/8] Omit one more warning. --- wscript | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 4c268145f14..6bc5772b363 100644 --- a/wscript +++ b/wscript @@ -75,7 +75,8 @@ compiler_flags_dictionaries= { 'quiet-build' : [ '-Wno-deprecated-declarations', '-Wno-unused-value', '-Wno-unused-result', '-Wno-use-after-free', '-Wno-unknown-pragmas', '-Wno-cast-qual', '-Wno-maybe-uninitialized', '-Wno-cpp', '-Wno-switch', '-Wno-free-nonheap-object', - '-Wno-unused-variable', '-Wno-dangling-pointer', '-Wno-unused-but-set-variable' ], + '-Wno-dangling-pointer', '-Wno-stringop-overflow', '-Wno-unused-variable', + '-Wno-unused-but-set-variable' ], 'quiet-build-c': [ '-Wno-strict-prototypes' ], 'quiet-build-cxx': [ '-Wno-reorder' ], # All warnings (left from quiet-build) are errors