1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-26 20:05:17 +00:00

Transition to clang-format 19

This commit is contained in:
Carles Fernandez
2024-12-26 11:18:41 +01:00
parent e805a08ff5
commit 700d4403d5
66 changed files with 628 additions and 458 deletions

View File

@@ -1,100 +1,289 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2018-2020 Carles Fernandez-Prades <carles.fernandez@cttc.es> # SPDX-FileCopyrightText: 2018-2024 Carles Fernandez-Prades <carles.fernandez@cttc.es>
--- ---
Language: Cpp Language: Cpp
# BasedOnStyle: Google # BasedOnStyle: Google
# More info: https://clang.llvm.org/docs/ClangFormatStyleOptions.html # More info: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
AccessModifierOffset: -4 AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false AlignArrayOfStructures: None
AlignConsecutiveDeclarations: false AlignConsecutiveAssignments:
AlignEscapedNewlinesLeft: true Enabled: false
AlignOperands: true AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseArrows: false
AlignCaseColons: false
AlignConsecutiveTableGenBreakingDAGArgColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenCondOperatorColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenDefinitionColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: AlignTrailingComments:
Kind: Always Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: false AttributeMacros:
- __capability
BinPackArguments: true BinPackArguments: true
BinPackParameters: true BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping: BraceWrapping:
AfterClass: false AfterCaseLabel: true
AfterControlStatement: false AfterClass: true
AfterEnum: false AfterControlStatement: Always
AfterFunction: false AfterEnum: true
AfterNamespace: false AfterExternBlock: true
AfterObjCDeclaration: false AfterFunction: true
AfterStruct: false AfterNamespace: true
AfterUnion: false AfterObjCDeclaration: true
BeforeCatch: false AfterStruct: true
BeforeElse: false AfterUnion: true
IndentBraces: false BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: true
IndentBraces: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakAfterReturnType: None
BreakArrays: true
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: GNU BreakBeforeBraces: GNU
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon
BreakFunctionDefinitionParameters: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
BreakTemplateDeclarations: MultiLine
ColumnLimit: 0 ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:' CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true CompactNamespaces: false
ConstructorInitializerIndentWidth: 4 ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4 ContinuationIndentWidth: 4
Cpp11BracedListStyle: true Cpp11BracedListStyle: true
DerivePointerAlignment: true DerivePointerAlignment: true
DisableFormat: false DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Merge IncludeBlocks: Merge
IncludeCategories: IncludeCategories:
- Regex: '^.*.h"' - Regex: '^.*.h"'
Priority: 1 Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^.*(benchmark|boost|gflags|glog|gnsssdr|gnuradio|gnsstk|gsl|gtest|pmt|uhd|volk)/' - Regex: '^.*(benchmark|boost|gflags|glog|gnsssdr|gnuradio|gnsstk|gsl|gtest|pmt|uhd|volk)/'
Priority: 2 Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^.*(armadillo|iio|matio|pugixml)' - Regex: '^.*(armadillo|iio|matio|pugixml)'
Priority: 2 Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*' - Regex: '.*'
Priority: 3 Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>' - Regex: '^<.*\.h>'
Priority: 4 Priority: 4
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*' - Regex: '^<.*'
Priority: 5 Priority: 5
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 4 IndentWidth: 4
IndentWrappedFunctionNames: false IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLines:
AtEndOfFile: false
AtStartOfBlock: false
AtStartOfFile: true
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: '' MacroBlockBegin: ''
MacroBlockEnd: '' MacroBlockEnd: ''
MainIncludeChar: Quote
MaxEmptyLinesToKeep: 2 MaxEmptyLinesToKeep: 2
NamespaceIndentation: None NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2 ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false ObjCSpaceBeforeProtocolList: false
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300 PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120 PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000 PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000 PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200 PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true ReflowComments: true
SortIncludes: true RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 2 SpacesBeforeTrailingComments: 2
SpacesInAngles: false SpacesInAngles: Never
SpacesInContainerLiterals: true SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false SpacesInLineCommentPrefix:
SpacesInParentheses: false Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
ExceptDoubleParentheses: false
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false SpacesInSquareBrackets: false
Standard: Auto Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TableGenBreakInsideDAGArg: DontBreak
TabWidth: 8 TabWidth: 8
UseTab: Never UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
... ...

View File

@@ -62,6 +62,7 @@ All notable changes to GNSS-SDR will be documented in this file.
- Updated GSL implementation to v0.42.0. See the - Updated GSL implementation to v0.42.0. See the
[gsl-lite release](https://github.com/gsl-lite/gsl-lite/releases/tag/v0.42.0). [gsl-lite release](https://github.com/gsl-lite/gsl-lite/releases/tag/v0.42.0).
- Code formatting now based on clang-format 19.
### Improvements in Portability: ### Improvements in Portability:

View File

@@ -1777,9 +1777,7 @@ gtime_t timeget()
{ {
gtime_t time; gtime_t time;
double ep[6] = {}; double ep[6] = {};
struct timeval tv struct timeval tv{};
{
};
struct tm *tt; struct tm *tt;
if (!gettimeofday(&tv, nullptr) && (tt = gmtime(&tv.tv_sec))) if (!gettimeofday(&tv, nullptr) && (tt = gmtime(&tv.tv_sec)))

View File

@@ -87,9 +87,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
const speed_t bs[] = { const speed_t bs[] = {
B300, B600, B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400}; B300, B600, B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400};
struct termios ios struct termios ios{};
{
};
int rw = 0; int rw = 0;
tracet(3, "openserial: path=%s mode=%d\n", path, mode); tracet(3, "openserial: path=%s mode=%d\n", path, mode);
@@ -1104,9 +1102,7 @@ void updatetcpsvr(tcpsvr_t *tcpsvr, char *msg)
/* accept client connection --------------------------------------------------*/ /* accept client connection --------------------------------------------------*/
int accsock(tcpsvr_t *tcpsvr, char *msg) int accsock(tcpsvr_t *tcpsvr, char *msg)
{ {
struct sockaddr_in addr struct sockaddr_in addr{};
{
};
socket_t sock; socket_t sock;
socklen_t len = sizeof(addr); socklen_t len = sizeof(addr);
int i; int i;

View File

@@ -84,9 +84,7 @@ private:
boost::thread *d_pcap_thread; boost::thread *d_pcap_thread;
// boost::mutex d_mutex; // boost::mutex d_mutex;
struct sockaddr_in si_me struct sockaddr_in si_me{};
{
};
std::string d_src_device; std::string d_src_device;
std::string d_origin_address; std::string d_origin_address;
pcap_t *descr; // ethernet pcap device descriptor pcap_t *descr; // ethernet pcap device descriptor

View File

@@ -244,9 +244,7 @@ void ControlThread::init()
else else
{ {
// fill agnss_ref_time_ // fill agnss_ref_time_
struct tm tm struct tm tm{};
{
};
if (strptime(ref_time_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) != nullptr) if (strptime(ref_time_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) != nullptr)
{ {
agnss_ref_time_.seconds = timegm(&tm); agnss_ref_time_.seconds = timegm(&tm);
@@ -1046,9 +1044,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
std::vector<unsigned int> visible_gps; std::vector<unsigned int> visible_gps;
std::vector<unsigned int> visible_gal; std::vector<unsigned int> visible_gal;
const std::shared_ptr<PvtInterface> pvt_ptr = flowgraph_->get_pvt(); const std::shared_ptr<PvtInterface> pvt_ptr = flowgraph_->get_pvt();
struct tm tstruct struct tm tstruct{};
{
};
char buf[80]; char buf[80];
tstruct = *gmtime(&rx_utc_time); tstruct = *gmtime(&rx_utc_time);
strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S ", &tstruct); strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S ", &tstruct);

View File

@@ -146,9 +146,7 @@ std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine
&course_over_ground_deg, &course_over_ground_deg,
&UTC_time) == true) &UTC_time) == true)
{ {
struct tm tstruct struct tm tstruct{};
{
};
std::array<char, 80> buf1{}; std::array<char, 80> buf1{};
tstruct = *gmtime(&UTC_time); tstruct = *gmtime(&UTC_time);
strftime(buf1.data(), buf1.size(), "%d/%m/%Y %H:%M:%S", &tstruct); strftime(buf1.data(), buf1.size(), "%d/%m/%Y %H:%M:%S", &tstruct);
@@ -179,9 +177,7 @@ std::string TcpCmdInterface::hotstart(const std::vector<std::string> &commandLin
if (commandLine.size() > 5) if (commandLine.size() > 5)
{ {
// Read commandline time parameter // Read commandline time parameter
struct tm tm struct tm tm{};
{
};
const std::string tmp_str = commandLine.at(1) + commandLine.at(2); const std::string tmp_str = commandLine.at(1) + commandLine.at(2);
if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
{ {
@@ -227,9 +223,7 @@ std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLi
if (commandLine.size() > 5) if (commandLine.size() > 5)
{ {
// Read commandline time parameter // Read commandline time parameter
struct tm tm struct tm tm{};
{
};
const std::string tmp_str = commandLine.at(1) + commandLine.at(2); const std::string tmp_str = commandLine.at(1) + commandLine.at(2);
if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
{ {

View File

@@ -89,8 +89,7 @@ constexpr int32_t GLONASS_L1_CA_HISTORY_DEEP = 100;
// NAVIGATION MESSAGE DEMODULATION AND DECODING // NAVIGATION MESSAGE DEMODULATION AND DECODING
#define GLONASS_GNAV_PREAMBLE \ #define GLONASS_GNAV_PREAMBLE \
{ \ { \
1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0 \ 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0}
}
constexpr double GLONASS_GNAV_PREAMBLE_DURATION_S = 0.300; constexpr double GLONASS_GNAV_PREAMBLE_DURATION_S = 0.300;
constexpr int32_t GLONASS_GNAV_PREAMBLE_LENGTH_BITS = 30; constexpr int32_t GLONASS_GNAV_PREAMBLE_LENGTH_BITS = 30;
constexpr int32_t GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS = 300; constexpr int32_t GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS = 300;

View File

@@ -37,8 +37,7 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime)
unsigned int fft_sizes[19] = {16, 25, 32, 45, 64, 95, 128, 195, 256, 325, 512, 785, 1024, 1503, 2048, 3127, 4096, 6349, 8192}; unsigned int fft_sizes[19] = {16, 25, 32, 45, 64, 95, 128, 195, 256, 325, 512, 785, 1024, 1503, 2048, 3127, 4096, 6349, 8192};
double d_execution_time; double d_execution_time;
EXPECT_NO_THROW( EXPECT_NO_THROW(
for (unsigned int fft_size for (unsigned int fft_size : fft_sizes) {
: fft_sizes) {
d_fft_size = fft_size; d_fft_size = fft_size;
auto d_gr_fft = gnss_fft_fwd_make_unique(d_fft_size); auto d_gr_fft = gnss_fft_fwd_make_unique(d_fft_size);
arma::arma_rng::set_seed_random(); arma::arma_rng::set_seed_random();