Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
merr was a fantastic piece of code from HSE, so libmerr is a static
library which pulls this code out and makes it available for anyone to
use.

Signed-off-by: Tristan Partin <tristan@partin.io>
  • Loading branch information
tristan957 committed Apr 13, 2023
0 parents commit 7f448dd
Show file tree
Hide file tree
Showing 30 changed files with 1,624 additions and 0 deletions.
159 changes: 159 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: 2023 Tristan Partin <tristan@partin.io>

Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: Consecutive
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: TopLevel
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine

# AttributeMacros only work with macros that do not take parameters.
AttributeMacros:
- MERR_ALWAYS_INLINE
- MERR_UNUSED
- MERR_USED
- MERR_WARN_UNUSED_RESULT

BinPackArguments: true
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: MultiLine
AfterEnum: false
AfterFunction: true
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: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: AfterColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 100
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: Always
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '"config.h"'
Priority: 1
- Regex: "^<sys/"
Priority: 3
- Regex: "^<glib.h>"
Priority: 4
- Regex: "^<bsd/"
Priority: 4
- Regex: "^<merr.h>"
Priority: 5
- Regex: "^<"
Priority: 2
- Regex: '^"'
Priority: 20
- Regex: "."
Priority: 100
IncludeIsMainRegex: ""
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Right
ReflowComments: true
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpaceAroundPointerQualifiers: Both
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
TabWidth: 4
UseCRLF: false
UseTab: Never
17 changes: 17 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: Copyright 2022 Micron Technology, Inc.
# SPDX-FileCopyrightText: 2023 Tristan Partin <tristan@partin.io>

# https://clang.llvm.org/extra/clang-tidy/checks/list.html
Checks: >
clang-diagnostic-*,
clang-analyzer-*,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-analyzer-valist.Uninitialized,
-clang-diagnostic-unused-function
WarningsAsErrors: >
clang-analyzer-core.CallAndMessage,
clang-analyzer-core.NonNullParamChecker,
clang-analyzer-unix.cstring.NullArg
FormatStyle: none
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: 2023 Tristan Partin <tristan@partin.io>

* text=auto

# https://github.com/github/linguist/blob/master/docs/overrides.md

subprojects/*.wrap linguist-language=INI
16 changes: 16 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: 2023 Tristan Partin <tristan@partin.io>

version: 2

updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
93 changes: 93 additions & 0 deletions .github/workflows/builds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: 2023 Tristan Partin <tristan@partin.io>

name: Builds

on:
release:
types: [created]
push:
branches:
- master
- "v[0-9]+.[0-9]+"
paths:
- "**.c"
- "**.h"
- "**/meson.build"
- .github/workflows/builds.yaml
- meson_options.txt
- VERSION
pull_request:
types: [opened, synchronize, reopened]
paths:
- "**.c"
- "**.h"
- "**/meson.build"
- .github/workflows/builds.yaml
- meson_options.txt
- VERSION

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
normal:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
buildtype: [debug, release]

steps:
- name: Install dependencies
run: |
sudo apt-get install -y meson
- name: Checkout libmerr
uses: actions/checkout@v3

- name: Setup
run: |
meson setup build --fatal-meson-warnings --werror \
--buildtype=${{ matrix.buildtype }}
- name: Build
run: |
ninja -C build
- name: Test
run: |
meson test -C build --print-errorlogs --no-stdsplit
asan-ubsan:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
buildtype: [debug, release]

steps:
- name: Install dependencies
run: |
sudo apt-get install -y meson
- name: Checkout libmerr
uses: actions/checkout@v3

- name: Setup
run: |
meson setup build --fatal-meson-warnings --werror \
--buildtype=${{ matrix.buildtype }} -Db_sanitize=address,undefined
- name: Build
run: |
ninja -C build
- name: Test
run: |
meson test -C build --print-errorlogs --no-stdsplit
57 changes: 57 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: 2023 Tristan Partin <tristan@partin.io>

name: CodeQL

on:
push:
branches:
- master
- "v[0-9]+.[0-9]+"
paths:
- "**.c"
- "**.h"
- .github/workflows/codeql.yaml
pull_request:
branches:
- master
- "v[0-9]+.[0-9]+"
paths:
- "**.c"
- "**.h"
- .github/workflows/codeql.yaml

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

permissions:
contents: read
security-events: write

jobs:
codeql:
runs-on: ubuntu-latest

steps:
- name: Install dependencies
run: |
sudo apt-get install -y meson
- name: Checkout libmerr
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2

- name: Setup
run: |
meson setup build --fatal-meson-warnings --werror
- name: Build
run: |
ninja -C build
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v2
40 changes: 40 additions & 0 deletions .github/workflows/markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: 2023 Tristan Partin <tristan@partin.io>

name: markdownlint

on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- README.md

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
markdownlint:
runs-on: ubuntu-latest

steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: latest
cache: npm

- name: Checkout libmerr
uses: actions/checkout@v3

- name: Install dependencies
run: |
npm ci
- name: markdownlint check
run: |
npm run markdownlint:check
Loading

0 comments on commit 7f448dd

Please sign in to comment.