[GRASS-dev] No more compiler warnings

Hi all!

At the beginning of this year, compiling GRASS raised a very high number of compiler warnings. For example with GCC there were about 140 and with Clang about 300 warnings. This was reported with GitHub issue #1247 [1]. Since then these warnings has been addressed in a number of PRs. Today we have reached the point where there are no warnings at all (!) for either GCC and Clang (with default settings) on the main branch.

To keep this level of warning frequency to zero, the compiler flag -Werror has been added to the GitHub "GCC C/C++ standards check" CI builds. This will treat a compiler warning as an error, and will cause the build to fail.

For those who have a PR in the pipeline affecting C or C++ code, should consider making a rebase to main (or otherwise trigger a CI check) before merging.

Cheers,
Nicklas

[1] https://github.com/OSGeo/grass/issues/1247

That’s great, thank you and others involved for working on this, it is an impressive amount of work!

Anna

On Thu, Aug 26, 2021 at 4:22 PM Nicklas Larsson via grass-dev <grass-dev@lists.osgeo.org> wrote:

Hi all!

At the beginning of this year, compiling GRASS raised a very high number of compiler warnings. For example with GCC there were about 140 and with Clang about 300 warnings. This was reported with GitHub issue #1247 [1]. Since then these warnings has been addressed in a number of PRs. Today we have reached the point where there are no warnings at all (!) for either GCC and Clang (with default settings) on the main branch.

To keep this level of warning frequency to zero, the compiler flag -Werror has been added to the GitHub “GCC C/C++ standards check” CI builds. This will treat a compiler warning as an error, and will cause the build to fail.

For those who have a PR in the pipeline affecting C or C++ code, should consider making a rebase to main (or otherwise trigger a CI check) before merging.

Cheers,
Nicklas

[1] https://github.com/OSGeo/grass/issues/1247


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Awesome!

I’m not suggesting to do it right now, but for the future, what do you think about adding more warnings/errors? There is, for example, -Wunused-result or -Wunused-but-set-variable which we have in the code.

warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
warning: variable ‘mapone’ set but not used [-Wunused-but-set-variable]

Many thanks,
Vaclav

On Thu, Aug 26, 2021 at 8:50 PM Anna Petrášová <kratochanna@gmail.com> wrote:

That’s great, thank you and others involved for working on this, it is an impressive amount of work!

Anna

On Thu, Aug 26, 2021 at 4:22 PM Nicklas Larsson via grass-dev <grass-dev@lists.osgeo.org> wrote:

Hi all!

At the beginning of this year, compiling GRASS raised a very high number of compiler warnings. For example with GCC there were about 140 and with Clang about 300 warnings. This was reported with GitHub issue #1247 [1]. Since then these warnings has been addressed in a number of PRs. Today we have reached the point where there are no warnings at all (!) for either GCC and Clang (with default settings) on the main branch.

To keep this level of warning frequency to zero, the compiler flag -Werror has been added to the GitHub “GCC C/C++ standards check” CI builds. This will treat a compiler warning as an error, and will cause the build to fail.

For those who have a PR in the pipeline affecting C or C++ code, should consider making a rebase to main (or otherwise trigger a CI check) before merging.

Cheers,
Nicklas

[1] https://github.com/OSGeo/grass/issues/1247


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev