Skip to content

Build in debug mode, add flags, and fix warnings

Rohit Kothur requested to merge rkothur/build-debug into master

This MR builds buildbox-common in debug mode during the build stage of the CI with some additional flags, include -Werror. It also fixes the warnings generated by those flags in the codebase.

I selected the warning flags from this blogpost: https://foonathan.net/blog/2018/10/17/cmake-warnings.html I used all of the warnings except -Wsign-conversion because many of the API calls we make don't play well with it at all, e.g.

/home/rkothur/buildbox-common/buildboxcommon/buildboxcommon_cashash.cpp: In static member function ‘static build::bazel::remote::execution::v2::Digest buildboxcommon::CASHash::hash(const string&)’:
/home/rkothur/buildbox-common/buildboxcommon/buildboxcommon_cashash.cpp:73:35: error: conversion to ‘google::protobuf::int64 aka long int <GO>’ from ‘std::__cxx11::basic_string<char>::size_type aka long unsigned int <GO>’ may change the sign of the result [-Werror=sign-conversion]
     result.set_size_bytes(str.size());
                           ~~~~~~~~^~

To test this locally on your machine, pass -DCMAKE_BUILD_TYPE=DEBUG as an argument to cmake.

Edited by Rohit Kothur

Merge request reports