Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence all warnings and switch on Werror #763

Closed
wants to merge 11 commits into from
4 changes: 4 additions & 0 deletions libs/pbd/mountpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ mountpoint (string path)

#else // !HAVE_GETMNTENT

#ifdef __linux__
#error "getmntent is supported on Linux. Is this a configuration error?"
#endif

#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
Expand Down
2 changes: 1 addition & 1 deletion libs/pbd/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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 <mntent.h>\n int main(void) { return (int)getmntent(0); }\n",
fragment = "#include <mntent.h>\n int main(void) { getmntent(0); }\n",
x42 marked this conversation as resolved.
Show resolved Hide resolved
define_name='HAVE_GETMNTENT', execute = False, mandatory=False)
conf.check_cc(
msg="Checking for function 'localtime_r' in time.h",
Expand Down
18 changes: 17 additions & 1 deletion wscript
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ 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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I really think a quiet build should just setWno-deprecated-declarations and Wno-unused-but-set-variable', and the rest should be fixed. Perhaps Wno-unknown-pragmas can remain as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about quiet and really-quiet?

On macOS there are many deprecated warnings (since openGL is deprecated, but it still works), and in some cases we do have "unused values" e.g. table ++row counters. which are fine. So we can safely hide those.

Copy link
Contributor Author

@gonsolo gonsolo Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had lots of gtk warnings about it's own deprecations and was trying to get an overview about what else is warned about. The nice thing about the quiet-build approach is that you can remove one warning at a time and fix it because it's only a few cases per warning (instead of hundreds of errors flying by). The nice thing about Werror would be that no fixed warning would ever be introduced again by new code.

'-Wno-use-after-free', '-Wno-unknown-pragmas', '-Wno-cast-qual',
'-Wno-maybe-uninitialized', '-Wno-cpp', '-Wno-switch', '-Wno-free-nonheap-object',
'-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
'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)
Expand Down Expand Up @@ -151,7 +161,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' ]
Expand Down Expand Up @@ -745,8 +755,14 @@ 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'])
cxx_flags.extend(flags_dict['quiet-build-cxx'])

#
# more boilerplate
Expand Down