Skip to content

Commit

Permalink
c++17 replaces boost dependency (#124)
Browse files Browse the repository at this point in the history
* thanks to xgdgsc, for https://github.com/KjellKod/g3sinks/pull/104/files
* commenting out or removing boost for testing with pure std::cpp17 library std::filesystem
* big cleanup, some refactoring of redundant code, improved readability
* clang-formatting, sublime formatting file added.
  • Loading branch information
Kjell Hedström. We are hiring @ Ganaz authored Mar 20, 2022
1 parent aebf9c1 commit f703079
Show file tree
Hide file tree
Showing 26 changed files with 2,144 additions and 450 deletions.
212 changes: 212 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 3
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
PPIndentWidth: -1
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

4 changes: 2 additions & 2 deletions .github/workflows/buildAndRunTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
echo "MacOS Latest"
brew update --preinstall
brew install boost
- name: Linux Bootstrap
Expand All @@ -46,7 +46,7 @@ jobs:
sudo apt-get update
sudo apt-get install ninja-build cmake gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
sudo apt-get install -y unzip zlib1g-dev libboost-all-dev libc6-dev
sudo apt-get install -y unzip zlib1g-dev libc6-dev
echo gcc version after
gcc --version
cmake --version
Expand Down
28 changes: 28 additions & 0 deletions .sublime_formatting
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"ignored_packages":
[
"Vintage",
],
"AStyleFormatter":
{
"options_default":
{
"indent": "spaces",
"indent-modifiers": false,
"indent-namespaces": true,
"indent-preproc-block": true,
"indent-spaces": 3,
//"style": "googles"
}
},
//"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_size": 11,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
"tab_size": 3,
"translate_tabs_to_spaces": true,
"word_wrap": true
}
1 change: 1 addition & 0 deletions .vscode/configurationCache.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"buildTargets":[".PHONY",".SILENT",".SUFFIXES","Continuous","Continuous/fast","ContinuousBuild","ContinuousBuild/fast","ContinuousConfigure","ContinuousConfigure/fast","ContinuousCoverage","ContinuousCoverage/fast","ContinuousMemCheck","ContinuousMemCheck/fast","ContinuousStart","ContinuousStart/fast","ContinuousSubmit","ContinuousSubmit/fast","ContinuousTest","ContinuousTest/fast","ContinuousUpdate","ContinuousUpdate/fast","Experimental","Experimental/fast","ExperimentalBuild","ExperimentalBuild/fast","ExperimentalConfigure","ExperimentalConfigure/fast","ExperimentalCoverage","ExperimentalCoverage/fast","ExperimentalMemCheck","ExperimentalMemCheck/fast","ExperimentalStart","ExperimentalStart/fast","ExperimentalSubmit","ExperimentalSubmit/fast","ExperimentalTest","ExperimentalTest/fast","ExperimentalUpdate","ExperimentalUpdate/fast","Nightly","Nightly/fast","NightlyBuild","NightlyBuild/fast","NightlyConfigure","NightlyConfigure/fast","NightlyCoverage","NightlyCoverage/fast","NightlyMemCheck","NightlyMemCheck/fast","NightlyMemoryCheck","NightlyMemoryCheck/fast","NightlyStart","NightlyStart/fast","NightlySubmit","NightlySubmit/fast","NightlyTest","NightlyTest/fast","NightlyUpdate","NightlyUpdate/fast","all","clean","clean-cmake","clean-cmake/fast","clean/fast","cmake_check_build_system","cmake_force","default_target","depend","edit_cache","edit_cache/fast","example_coloredcout","example_coloredcout/fast","example_filedescriptor","example_filedescriptor/fast","example_logrotate_and_filter","example_logrotate_and_filter/fast","example_syslog","example_syslog/fast","g3logrotate","g3logrotate/fast","g3syslog","g3syslog/fast","gmock","gmock/fast","gmock_main","gmock_main/fast","gtest","gtest/fast","gtest_main","gtest_main/fast","help","install","install/fast","install/local","install/local/fast","install/strip","install/strip/fast","list_install_components","list_install_components/fast","package","package/fast","package_source","package_source/fast","preinstall","preinstall/fast","rebuild_cache","rebuild_cache/fast","test","test/fast","test_logrotate","test_logrotate/fast"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}}
21 changes: 21 additions & 0 deletions .vscode/dryrun.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
make -f /Users/kjell/ws/test/g3sinks/build/Makefile --dry-run --keep-going --print-directory
make: Entering directory `/Users/kjell/ws/test/g3sinks'
/usr/local/Cellar/cmake/3.21.4/bin/cmake -S/Users/kjell/ws/test/g3sinks -B/Users/kjell/ws/test/g3sinks/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.21.4/bin/cmake -E cmake_progress_start /Users/kjell/ws/test/g3sinks/build/CMakeFiles /Users/kjell/ws/test/g3sinks/build//CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -s -f CMakeFiles/Makefile2 all

make[1]: Entering directory `/Users/kjell/ws/test/g3sinks'

make[1]: CMakeFiles/Makefile2: No such file or directory

make[1]: *** No rule to make target `CMakeFiles/Makefile2'.
make[1]: Failed to remake makefile `CMakeFiles/Makefile2'.

make[1]: *** No rule to make target `all'.

make[1]: Leaving directory `/Users/kjell/ws/test/g3sinks'

make: *** [all] Error 2

make: Leaving directory `/Users/kjell/ws/test/g3sinks'

20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test/test_logrotate",
"args": ["--gtest_filter=*getDateFromFileName"],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
}
]
}
75 changes: 75 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"files.associations": {
"regex": "cpp",
"string": "cpp",
"__bit_reference": "cpp",
"__bits": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__functional_base": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"algorithm": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"exception": "cpp",
"fstream": "cpp",
"functional": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"set": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"variant": "cpp",
"vector": "cpp"
}
}
Loading

0 comments on commit f703079

Please sign in to comment.