mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-03 14:52:21 +02:00
Conditional compilation of Perl logic in exit.c.
This file is the only one to contain Perl logic outside of the perl module. Make the Perl logic conditional to improve reusability.
This commit is contained in:
parent
78fe642eae
commit
315aa2c451
@ -59,6 +59,10 @@
|
||||
<p>Add <code>ServiceError</code> for errors from a service that can be retried.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Conditional compilation of Perl logic in <file>exit.c</file>.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Remove extraneous <code>use</code>/<code>include</code> statements.</p>
|
||||
</release-item>
|
||||
|
@ -21,7 +21,7 @@ CWARN = -Wfatal-errors -Wall -Wextra -Wwrite-strings -Wswitch-enum -Wconversion
|
||||
-Wno-clobbered -Wno-missing-field-initializers -Wstrict-prototypes -Wpointer-arith -Wvla
|
||||
|
||||
# Automatically generate Perl compile options for the local system
|
||||
CPERL = `perl -MExtUtils::Embed -e ccopts`
|
||||
CPERL = `perl -MExtUtils::Embed -e ccopts` -DWITH_PERL
|
||||
|
||||
# Automatically generate xml compile options for the local system
|
||||
CXML = `xml2-config --cflags`
|
||||
@ -201,7 +201,7 @@ common/exit.o: common/exit.c command/command.h common/debug.h common/error.auto.
|
||||
common/fork.o: common/fork.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
||||
$(CC) $(CFLAGS) -c common/fork.c -o common/fork.o
|
||||
|
||||
common/ini.o: common/ini.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
common/ini.o: common/ini.c common/debug.h common/error.auto.h common/error.h common/ini.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||
$(CC) $(CFLAGS) -c common/ini.c -o common/ini.o
|
||||
|
||||
common/io/bufferRead.o: common/io/bufferRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferRead.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||
|
@ -11,7 +11,10 @@ Exit Routines
|
||||
#include "common/lock.h"
|
||||
#include "common/log.h"
|
||||
#include "config/config.h"
|
||||
#include "perl/exec.h"
|
||||
|
||||
#ifdef WITH_PERL
|
||||
#include "perl/exec.h"
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Return signal names
|
||||
@ -98,8 +101,10 @@ exitSafe(int result, bool error, SignalType signalType)
|
||||
if (error)
|
||||
{
|
||||
// Don't log the error if it has already been logged by Perl
|
||||
#ifdef WITH_PERL
|
||||
if (strcmp(errorMessage(), PERL_EMBED_ERROR) != 0)
|
||||
{
|
||||
#endif
|
||||
LogLevel logLevel = errorCode() == errorTypeCode(&AssertError) ? logLevelAssert : logLevelError;
|
||||
|
||||
// Assert errors always output a stack trace
|
||||
@ -118,7 +123,9 @@ exitSafe(int result, bool error, SignalType signalType)
|
||||
errorStackTrace());
|
||||
}
|
||||
}
|
||||
#ifdef WITH_PERL
|
||||
}
|
||||
#endif
|
||||
|
||||
result = errorCode();
|
||||
}
|
||||
@ -131,11 +138,13 @@ exitSafe(int result, bool error, SignalType signalType)
|
||||
TRY_END();
|
||||
|
||||
// Free Perl but ignore errors
|
||||
#ifdef WITH_PERL
|
||||
TRY_BEGIN()
|
||||
{
|
||||
perlFree(result);
|
||||
}
|
||||
TRY_END();
|
||||
#endif
|
||||
|
||||
// Log command end if a command is set
|
||||
if (cfgCommand() != cfgCmdNone)
|
||||
|
@ -383,8 +383,8 @@ sub run
|
||||
|
||||
# Flags that are common to all builds
|
||||
my $strCommonFlags =
|
||||
'-I. -Itest -std=c99 -fPIC -g -Wno-clobbered `perl -MExtUtils::Embed -e ccopts` `xml2-config --cflags`'
|
||||
. ($self->{bProfile} ? " -pg" : '') .
|
||||
'-I. -Itest -std=c99 -fPIC -g -Wno-clobbered `perl -MExtUtils::Embed -e ccopts` -DWITH_PERL' .
|
||||
' `xml2-config --cflags`' . ($self->{bProfile} ? " -pg" : '') .
|
||||
($self->{oTest}->{&TEST_DEBUG_UNIT_SUPPRESS} ? '' : " -DDEBUG_UNIT") .
|
||||
(vmWithBackTrace($self->{oTest}->{&TEST_VM}) && $self->{bBackTrace} ? ' -DWITH_BACKTRACE' : '') .
|
||||
($self->{oTest}->{&TEST_CDEF} ? " $self->{oTest}->{&TEST_CDEF}" : '') .
|
||||
|
Loading…
x
Reference in New Issue
Block a user