1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-18 04:58:51 +02:00

Add -ftree-coalesce-vars option to unit test compilation.

This is a workaround for inefficient handling of many setjmps in gcc >= 4.9.  Setjmp is used in all error handling, but in the unit tests each test macro contains an error handling block so they add up pretty quickly for large unit tests.

Enabling -ftree-coalesce-vars in affected versions reduces build time and memory requirements by nearly an order of magnitude.  Even so, compiles are much slower than gcc <= 4.8.

We submitted a bug for this at: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87316
Which was marked as a duplicate of: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63155
This commit is contained in:
David Steele 2018-09-17 11:38:10 -04:00
parent b5f749b21c
commit e55d733041
2 changed files with 5 additions and 0 deletions

View File

@ -121,6 +121,10 @@
<p>Make Valgrind return an error even when a non-fatal issue is detected. Update some minor issues discovered in the tests as a result.</p>
</release-item>
<release-item>
<p>Add <id>-ftree-coalesce-vars</id> option to unit test compilation.</p>
</release-item>
<release-item>
<p>Clear test directory between test runs.</p>
</release-item>

View File

@ -400,6 +400,7 @@ sub run
"\n" .
"test.o: test.c\n" .
"\t\$(CC) \$(CFLAGS) \$(TESTFLAGS) -O0" .
($self->{oTest}->{&TEST_VM} ne VM_U12 ? ' -ftree-coalesce-vars' : '') .
(vmCoverageC($self->{oTest}->{&TEST_VM}) && $self->{bCoverageUnit} ?
' -fprofile-arcs -ftest-coverage' : '') .
" -c test.c\n" .