ublk-org / ublksrv

ublk: userspace block device driver
MIT License
138 stars 47 forks source link

Enable more warnings on C++ code #32

Closed reubeno closed 1 year ago

reubeno commented 1 year ago

This adds additional warnings when configuring with --enable-gcc-warnings.

A few warning types were specifically disabled with TODOs; they would be best to address in separate changes.

Signed-off-by: reuben olinsky reubeno.dev@gmail.com

ming1 commented 1 year ago

The following build failure is triggered:

gcc -DHAVE_CONFIG_H -I. -Wall -Werror -Wuninitialized -Wmaybe-uninitialized -Wno-sign-compare -Wno-reorder -Wno-parentheses -Wvla -Wframe-larger-than=5000 -Wstack-usage=10000 -pthread -I./include -Wall -Werror -Wuninitialized -Wmaybe-uninitialized -Wno-sign-compare -Wno-reorder -Wno-parentheses -Wvla -Wframe-larger-than=5000 -Wstack-usage=10000 -pthread -I/root/git/liburing/src/include -g -O0 -MT demo_null-demo_null.o -MD -MP -MF .deps/demo_null-demo_null.Tpo -c -o demo_null-demo_null.o test -f 'demo_null.c' || echo './'demo_null.c cc1: error: command-line option '-Wno-reorder' is valid for C++/ObjC++ but not for C [-Werror] cc1: all warnings being treated as errors

reubeno commented 1 year ago

I missed that because I was only doing incremental builds, my apologies. I've pushed an update that just resolves all instances of that warning - largely it entailed shuffling initializers.

As far as catching build errors goes, would you be open to a PR that adds a github workflow to build the code (with warnings on) for all PRs? (CI style.)

ming1 commented 1 year ago

I missed that because I was only doing incremental builds, my apologies. I've pushed an update that just resolves all instances of that warning - largely it entailed shuffling initializers.

As far as catching build errors goes, would you be open to a PR that adds a github workflow to build the code (with warnings on) for all PRs? (CI style.)

Sure, I just don't know how to do that, can you share the steps or would you like to add the support?

Thanks,