Skip to content

Commit

Permalink
Disable compiler optimizations when code coverage is enabled
Browse files Browse the repository at this point in the history
Compiler optimizations need to be disabled to not affect code coverage
report.

Signed-off-by: Martin Perina <[email protected]>
  • Loading branch information
mwperina authored and engelmi committed Apr 16, 2024
1 parent cd9cd5f commit 0a95258
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ if with_coverage
'-fprofile-dir=' + join_paths(get_option('prefix'), get_option('localstatedir'), 'tmp', 'bluechi-coverage'),
language : 'c')
add_project_link_arguments('-lgcov', language : 'c')

# Compiler should not perform any optimization when code coverage is reported, but meson RPM support sets -O2
# into CFLAGS, so we need to override here
common_cflags += '-Og'

# Coverage source code mapping files `*.gcno` are created as a part of the build for each `*.c` file, but it's
# very hard to tell meson to install files, which are created as a side effect from the build, so it's easier
# to use custom install script
Expand Down

0 comments on commit 0a95258

Please sign in to comment.