mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-04 09:43:08 +02:00
Add .inc extension to C files included in other C files.
These files were never intended to be compiled on their own so the .c extension was a bit misleading. In particular Meson does not like .c files that are not intended to be compiled independently. Leave header files as is since they are already protected against being included more than once and are never expected to be compiled.
This commit is contained in:
parent
cb891fa2d4
commit
2feaaeaac8
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1,2 +1,3 @@
|
||||
# Classify all .h files as C
|
||||
# Classify all .h/c.inc files as C
|
||||
*.h linguist-language=C
|
||||
*.c.inc linguist-language=C
|
||||
|
@ -243,7 +243,7 @@ pgbackrest/test/test.pl --vm=none --dry-run
|
||||
P00 INFO: configure build
|
||||
P00 INFO: builds required: bin
|
||||
--> P00 INFO: 72 tests selected
|
||||
|
||||
|
||||
P00 INFO: P1-T01/72 - vm=none, module=common, test=error
|
||||
[filtered 69 lines of output]
|
||||
P00 INFO: P1-T71/72 - vm=none, module=performance, test=type
|
||||
@ -265,12 +265,12 @@ pgbackrest/test/test.pl --vm=none --vm-out --module=common --test=wait
|
||||
P00 INFO: cleanup old data
|
||||
P00 INFO: builds required: none
|
||||
P00 INFO: 1 test selected
|
||||
|
||||
|
||||
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
|
||||
|
||||
|
||||
run 1 - waitNew(), waitMore, and waitFree()
|
||||
L0018 expect AssertError: assertion 'waitTime <= 999999000' failed
|
||||
|
||||
|
||||
run 1/1 ------------- L0021 0ms wait
|
||||
L0025 new wait
|
||||
L0026 check remaining time
|
||||
@ -295,9 +295,9 @@ pgbackrest/test/test.pl --vm=none --vm-out --module=common --test=wait
|
||||
L0062 lower range check
|
||||
L0063 upper range check
|
||||
L0065 free wait
|
||||
|
||||
|
||||
TESTS COMPLETED SUCCESSFULLY
|
||||
|
||||
|
||||
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
|
||||
P00 INFO: tested modules have full coverage
|
||||
P00 INFO: writing C coverage report
|
||||
@ -320,7 +320,7 @@ pgbackrest/test/test.pl --vm=none --module=postgres
|
||||
P00 INFO: cleanup old data
|
||||
P00 INFO: builds required: none
|
||||
P00 INFO: 2 tests selected
|
||||
|
||||
|
||||
P00 INFO: P1-T1/2 - vm=none, module=postgres, test=client
|
||||
P00 INFO: P1-T2/2 - vm=none, module=postgres, test=interface
|
||||
P00 INFO: tested modules have full coverage
|
||||
@ -363,7 +363,7 @@ pgbackrest/test/test.pl --vm=u20 --module=mock --test=archive --run=2
|
||||
P00 INFO: build bin for none (/home/vagrant/test/bin/none)
|
||||
P00 INFO: bin dependencies have changed, rebuilding
|
||||
P00 INFO: 1 test selected
|
||||
|
||||
|
||||
P00 INFO: P1-T1/1 - vm=u20, module=mock, test=archive, run=2
|
||||
P00 INFO: no code modules had all tests run required for coverage
|
||||
P00 INFO: TESTS COMPLETED SUCCESSFULLY
|
||||
@ -561,7 +561,7 @@ run 8/1 ------------- L2285 no current backups
|
||||
|
||||
## Adding an Option
|
||||
|
||||
Options can be added to a command or multiple commands. Options can be configuration file only, command-line only or valid for both. Once an option is successfully added, the `config.auto.h` and `parse.auto.c` files will automatically be generated by the build system.
|
||||
Options can be added to a command or multiple commands. Options can be configuration file only, command-line only or valid for both. Once an option is successfully added, the `config.auto.h` and `parse.auto.c.inc` files will automatically be generated by the build system.
|
||||
|
||||
To add an option, two files need be to be modified:
|
||||
|
||||
|
@ -648,7 +648,7 @@ run 8/1 ------------- L2285 no current backups
|
||||
<section id="option">
|
||||
<title>Adding an Option</title>
|
||||
|
||||
<p>Options can be added to a command or multiple commands. Options can be configuration file only, command-line only or valid for both. Once an option is successfully added, the <file>config.auto.h</file> and <file>parse.auto.c</file> files will automatically be generated by the build system.</p>
|
||||
<p>Options can be added to a command or multiple commands. Options can be configuration file only, command-line only or valid for both. Once an option is successfully added, the <file>config.auto.h</file> and <file>parse.auto.c.inc</file> files will automatically be generated by the build system.</p>
|
||||
|
||||
<p>To add an option, two files need be to be modified:</p>
|
||||
<list>
|
||||
|
2
src/.gitignore
vendored
2
src/.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
/.build
|
||||
autom4te.cache
|
||||
/command/help/help.auto.c
|
||||
/command/help/help.auto.c.inc
|
||||
/config.log
|
||||
/config.status
|
||||
/Makefile
|
||||
|
@ -216,7 +216,7 @@ SRCS_BUILD_CONFIG = \
|
||||
|
||||
OBJS_BUILD_CONFIG = $(patsubst %.c,$(BUILDDIR)/%.o,$(SRCS_BUILD) $(SRCS_BUILD_CONFIG))
|
||||
|
||||
build-config: $(OBJS_BUILD_CONFIG) build/config/config.yaml config/config.auto.h config/parse.auto.c
|
||||
build-config: $(OBJS_BUILD_CONFIG) build/config/config.yaml config/config.auto.h config/parse.auto.c.inc
|
||||
$(CC) -o build-config $(OBJS_BUILD_CONFIG) $(LDFLAGS) $(LIBS) $(LIBS_BUILD)
|
||||
./build-config $(VPATH)
|
||||
|
||||
@ -252,7 +252,7 @@ OBJS_BUILD_HELP = $(patsubst %.c,$(BUILDDIR)/%.o,$(SRCS_BUILD) $(SRCS_BUILD_HELP
|
||||
build-help: $(OBJS_BUILD_HELP) build/config/config.yaml build/help/help.xml
|
||||
$(CC) -o build-help $(OBJS_BUILD_HELP) $(LDFLAGS) $(LIBS) $(LIBS_BUILD)
|
||||
|
||||
command/help/help.auto.c: build-help
|
||||
command/help/help.auto.c.inc: build-help
|
||||
./build-help $(VPATH)
|
||||
|
||||
####################################################################################################################################
|
||||
@ -276,7 +276,7 @@ uninstall:
|
||||
# Clean build files and executable created by make
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)
|
||||
rm -f pgbackrest build-config build-error build-help command/help/help.auto.c
|
||||
rm -f pgbackrest build-config build-error build-help command/help/help.auto.c.inc
|
||||
|
||||
.PHONY = clean-all
|
||||
|
||||
@ -288,7 +288,7 @@ clean-all: clean
|
||||
# Special per-object flags
|
||||
####################################################################################################################################
|
||||
$(BUILDDIR)/postgres/interface/page.o: CFLAGS += @CFLAGS_PAGE_CHECKSUM@
|
||||
$(BUILDDIR)/main.o: command/help/help.auto.c
|
||||
$(BUILDDIR)/main.o: command/help/help.auto.c.inc
|
||||
|
||||
####################################################################################################################################
|
||||
# Compile and generate dependencies
|
||||
|
@ -278,7 +278,7 @@ bldCfgRenderConfigAutoH(const Storage *const storageRepo, const BldCfg bldCfg)
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Render parse.auto.c
|
||||
Render parse.auto.c.inc
|
||||
***********************************************************************************************************************************/
|
||||
#define PARSE_AUTO_COMMENT "Config Parse Rules"
|
||||
|
||||
@ -1309,7 +1309,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg, co
|
||||
// Write to storage
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
bldPut(
|
||||
storageRepo, "src/config/parse.auto.c",
|
||||
storageRepo, "src/config/parse.auto.c.inc",
|
||||
BUFSTR(strNewFmt("%s%s%s", strZ(bldHeader(CONFIG_MODULE, PARSE_AUTO_COMMENT)), strZ(configVal), strZ(config))));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Error Definitions
|
||||
#
|
||||
# Definitions for all C errors, auto-generated to src/common/error.auto.c/h.
|
||||
# Definitions for all C errors, auto-generated to src/common/error.auto.c.inc/.h.
|
||||
|
||||
# Errors in the code that it should not be possible for the user to encounter -- i.e., a likely bug
|
||||
assert:
|
||||
|
@ -82,7 +82,7 @@ bldErrRenderErrorAutoH(const Storage *const storageRepo, const BldErr bldErr)
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Render error.auto.c
|
||||
Render error.auto.c.inc
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
bldErrRenderErrorAutoC(const Storage *const storageRepo, const BldErr bldErr)
|
||||
@ -130,7 +130,7 @@ bldErrRenderErrorAutoC(const Storage *const storageRepo, const BldErr bldErr)
|
||||
" NULL,\n"
|
||||
"};\n");
|
||||
|
||||
bldPut(storageRepo, "src/common/error.auto.c", BUFSTR(error));
|
||||
bldPut(storageRepo, "src/common/error.auto.c.inc", BUFSTR(error));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
|
@ -325,7 +325,7 @@ bldHlpRenderHelpAutoC(const Storage *const storageRepo, const BldCfg bldCfg, con
|
||||
strCatZ(help, "\n};\n");
|
||||
|
||||
// Write to storage
|
||||
bldPut(storageRepo, "command/help/help.auto.c", BUFSTR(help));
|
||||
bldPut(storageRepo, "command/help/help.auto.c.inc", BUFSTR(help));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
|
@ -26,7 +26,7 @@ STRING_EXTERN(HASH_TYPE_SHA256_ZERO_STR, HASH_TYPE_SH
|
||||
/***********************************************************************************************************************************
|
||||
Include local MD5 code
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/crypto/md5.vendor.c"
|
||||
#include "common/crypto/md5.vendor.c.inc"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
|
@ -34,7 +34,7 @@ struct ErrorType
|
||||
#endif
|
||||
|
||||
// Include error type definitions
|
||||
#include "common/error.auto.c"
|
||||
#include "common/error.auto.c.inc"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Maximum allowed number of nested try blocks
|
||||
|
@ -71,7 +71,7 @@ typedef struct ParseRuleCommand
|
||||
bool parameterAllowed:1; // Command-line parameters are allowed
|
||||
} ParseRuleCommand;
|
||||
|
||||
// Macros used to define parse rules in parse.auto.c in a format that diffs well
|
||||
// Macros used to define parse rules in parse.auto.c.inc in a format that diffs well
|
||||
#define PARSE_RULE_COMMAND(...) \
|
||||
{__VA_ARGS__}
|
||||
|
||||
@ -110,7 +110,7 @@ typedef struct ParseRuleOptionGroup
|
||||
const char *name; // All options in the group must be prefixed with this name
|
||||
} ParseRuleOptionGroup;
|
||||
|
||||
// Macros used to define parse rules in parse.auto.c in a format that diffs well
|
||||
// Macros used to define parse rules in parse.auto.c.inc in a format that diffs well
|
||||
#define PARSE_RULE_OPTION_GROUP(...) \
|
||||
{__VA_ARGS__}
|
||||
|
||||
@ -157,7 +157,7 @@ typedef enum
|
||||
parseRuleFilterTypeCommand = 1,
|
||||
} ParseRuleFilterType;
|
||||
|
||||
// Macros used to define parse rules in parse.auto.c in a format that diffs well
|
||||
// Macros used to define parse rules in parse.auto.c.inc in a format that diffs well
|
||||
#define PARSE_RULE_OPTION(...) \
|
||||
{__VA_ARGS__}
|
||||
|
||||
@ -265,7 +265,7 @@ typedef struct ParseRuleOptionDeprecate
|
||||
/***********************************************************************************************************************************
|
||||
Include automatically generated parse data
|
||||
***********************************************************************************************************************************/
|
||||
#include "config/parse.auto.c"
|
||||
#include "config/parse.auto.c.inc"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Struct to hold options parsed from the command line
|
||||
|
@ -51,7 +51,7 @@ Main
|
||||
/***********************************************************************************************************************************
|
||||
Include automatically generated help data
|
||||
***********************************************************************************************************************************/
|
||||
#include "command/help/help.auto.c"
|
||||
#include "command/help/help.auto.c.inc"
|
||||
|
||||
int
|
||||
main(int argListSize, const char *argList[])
|
||||
|
@ -10,7 +10,7 @@ PostgreSQL Page Interface
|
||||
/***********************************************************************************************************************************
|
||||
Include the page checksum code
|
||||
***********************************************************************************************************************************/
|
||||
#include "postgres/interface/pageChecksum.vendor.c"
|
||||
#include "postgres/interface/pageChecksum.vendor.c.inc"
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
uint16_t
|
||||
|
@ -727,7 +727,7 @@ src/common/crypto/hash.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/common/crypto/md5.vendor.c:
|
||||
src/common/crypto/md5.vendor.c.inc:
|
||||
class: core/vendor
|
||||
type: c
|
||||
|
||||
@ -747,7 +747,7 @@ src/common/encode.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/common/error.auto.c:
|
||||
src/common/error.auto.c.inc:
|
||||
class: core/auto
|
||||
type: c
|
||||
|
||||
@ -1311,7 +1311,7 @@ src/config/load.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/config/parse.auto.c:
|
||||
src/config/parse.auto.c.inc:
|
||||
class: core/auto
|
||||
type: c
|
||||
|
||||
@ -1423,7 +1423,7 @@ src/postgres/interface/page.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/postgres/interface/pageChecksum.vendor.c:
|
||||
src/postgres/interface/pageChecksum.vendor.c.inc:
|
||||
class: core/vendor
|
||||
type: c
|
||||
|
||||
|
@ -94,13 +94,13 @@ sub codeCountScan
|
||||
}
|
||||
|
||||
# Append auto if an auto-generated file
|
||||
if ($strFile =~ '\.auto\..$' | $strFile =~ 'Auto\.pm$')
|
||||
if ($strFile =~ '\.auto\..$' || $strFile =~ '\.auto\..\.inc$' || $strFile =~ 'Auto\.pm$')
|
||||
{
|
||||
$strClass .= '/auto';
|
||||
}
|
||||
|
||||
# Append vendor if a vendorized file
|
||||
if ($strFile =~ '\.vendor\..$')
|
||||
if ($strFile =~ '\.vendor\..$' || $strFile =~ '\.vendor\..\.inc$')
|
||||
{
|
||||
$strClass .= '/vendor';
|
||||
}
|
||||
@ -119,7 +119,7 @@ sub codeCountScan
|
||||
$strType = 'c/h';
|
||||
$strForceLang = 'C/C++ Header';
|
||||
}
|
||||
elsif ($strFile =~ '\.c$')
|
||||
elsif ($strFile =~ '\.c$' || $strFile =~ '\.c.inc$')
|
||||
{
|
||||
$strType = 'c';
|
||||
$strForceLang = 'C';
|
||||
|
@ -140,16 +140,18 @@ sub coverageExtract
|
||||
'test/src/module/' . substr(${strModuleOutName}, 5) : "src/${strModuleOutName}");
|
||||
my $strLCovFile = "${strTestResultCoveragePath}/raw/${strModuleOutName}.lcov";
|
||||
my $strLCovTotal = "${strWorkTmpPath}/all.lcov";
|
||||
my $bInc = $strModuleName =~ '\.vendor$' || $strModuleName =~ '\.auto$';
|
||||
my $strModuleSourceFile = $strModulePath . '.c' . ($bInc ? '.inc' : '');
|
||||
|
||||
executeTest(
|
||||
"${strLCovExe}" . ($bTest ? ' --rc lcov_branch_coverage=0' : '') . " --extract=${strLCovOut} */${strModuleName}.c" .
|
||||
" --o=${strLCovOutTmp}");
|
||||
($bInc ? '.inc' : '') . " --o=${strLCovOutTmp}");
|
||||
|
||||
# Combine with prior run if there was one
|
||||
if ($oStorage->exists($strLCovFile))
|
||||
{
|
||||
my $strCoverage = ${$oStorage->get($strLCovOutTmp)};
|
||||
$strCoverage =~ s/^SF\:.*$/SF:$strModulePath\.c/mg;
|
||||
$strCoverage =~ s/^SF\:.*$/SF:$strModuleSourceFile/mg;
|
||||
$oStorage->put($strLCovOutTmp, $strCoverage);
|
||||
|
||||
executeTest("${strLCovExe} --add-tracefile=${strLCovOutTmp} --add-tracefile=${strLCovFile} --o=${strLCovOutTmp}");
|
||||
@ -185,7 +187,7 @@ sub coverageExtract
|
||||
if (!$bTest || $iTotalLines != $iCoveredLines || $iTotalBranches != $iCoveredBranches)
|
||||
{
|
||||
# Fix source file name
|
||||
$strCoverage =~ s/^SF\:.*$/SF:$strModulePath\.c/mg;
|
||||
$strCoverage =~ s/^SF\:.*$/SF:$strModuleSourceFile/mg;
|
||||
|
||||
$oStorage->put($oStorage->openWrite($strLCovFile, {bPathCreate => true}), $strCoverage);
|
||||
|
||||
|
@ -561,11 +561,11 @@ testRun(void)
|
||||
"#endif\n");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("check parse.auto.c");
|
||||
TEST_TITLE("check parse.auto.c.inc");
|
||||
|
||||
TEST_STORAGE_GET(
|
||||
storageTest,
|
||||
"src/config/parse.auto.c",
|
||||
"src/config/parse.auto.c.inc",
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
"Config Parse Rules\n"
|
||||
"\n"
|
||||
|
@ -76,11 +76,11 @@ testRun(void)
|
||||
"#endif\n");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("check error.auto.c");
|
||||
TEST_TITLE("check error.auto.c.inc");
|
||||
|
||||
TEST_STORAGE_GET(
|
||||
storageTest,
|
||||
"src/common/error.auto.c",
|
||||
"src/common/error.auto.c.inc",
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
"Error Type Definition\n"
|
||||
"\n"
|
||||
|
@ -402,7 +402,7 @@ testRun(void)
|
||||
TEST_TITLE("check help file");
|
||||
|
||||
TEST_RESULT_VOID(bldHlpRender(storageTest, bldCfg, bldHlpParse(storageTest, bldCfg)), "write file");
|
||||
TEST_STORAGE_EXISTS(storageTest, "command/help/help.auto.c");
|
||||
TEST_STORAGE_EXISTS(storageTest, "command/help/help.auto.c.inc");
|
||||
}
|
||||
|
||||
FUNCTION_HARNESS_RETURN_VOID();
|
||||
|
Loading…
Reference in New Issue
Block a user