Skip to content

Commit

Permalink
Merge pull request intel#4 from intel-sandbox/novafacing/repo-dev-prep
Browse files Browse the repository at this point in the history
Add build system, linter, and git hooks
  • Loading branch information
brandonmarken authored Feb 8, 2023
2 parents 25ffcea + 7dd9a6a commit bd2afbd
Show file tree
Hide file tree
Showing 53 changed files with 982 additions and 155 deletions.
176 changes: 176 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
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: 88
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
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: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
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
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: true
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
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: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
91 changes: 91 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,94 @@ confuse-host-if/lib
confuse-host-if/obj
simple-example/obj
simple-example/runme


# Source: C.gitignore

# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

# Source: C++.gitignore

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "AFLplusplus"]
path = AFLplusplus
url = https://github.com/AFLplusplus/AFLplusplus.git
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
files: ^(src/|include/)
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.0
hooks:
- id: clang-format
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"C_Cpp.clang_format_style": "{Language: Cpp, BasedOnStyle: LLVM, AccessModifierOffset: -4, AlignAfterOpenBracket: Align, AlignArrayOfStructures: None, AlignConsecutiveMacros: None, AlignConsecutiveAssignments: None, AlignConsecutiveBitFields: None, AlignConsecutiveDeclarations: None, AlignEscapedNewlines: Right, AlignOperands: Align, AlignTrailingComments: true, AllowAllArgumentsOnNextLine: true, AllowAllConstructorInitializersOnNextLine: true, AllowAllParametersOfDeclarationOnNextLine: true, AllowShortEnumsOnASingleLine: true, AllowShortBlocksOnASingleLine: Never, AllowShortCaseLabelsOnASingleLine: false, AllowShortFunctionsOnASingleLine: All, AllowShortLambdasOnASingleLine: All, AllowShortIfStatementsOnASingleLine: Never, AllowShortLoopsOnASingleLine: false, AlwaysBreakAfterDefinitionReturnType: None, AlwaysBreakAfterReturnType: None, AlwaysBreakBeforeMultilineStrings: false, AlwaysBreakTemplateDeclarations: MultiLine, 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: 88, CompactNamespaces: false, ConstructorInitializerAllOnOneLineOrOnePerLine: false, ConstructorInitializerIndentWidth: 4, ContinuationIndentWidth: 4, Cpp11BracedListStyle: true, DeriveLineEnding: true, DerivePointerAlignment: false, DisableFormat: false, EmptyLineAfterAccessModifier: Never, EmptyLineBeforeAccessModifier: LogicalBlock, ExperimentalAutoDetectBinPacking: false, FixNamespaceComments: true, IncludeBlocks: Preserve, IncludeIsMainRegex: '(Test)?$', IncludeIsMainSourceRegex: '', IndentAccessModifiers: false, IndentCaseLabels: true, IndentCaseBlocks: false, IndentGotoLabels: true, IndentPPDirectives: None, IndentExternBlock: AfterExternBlock, IndentRequires: false, IndentWidth: 4, IndentWrappedFunctionNames: false, InsertTrailingCommas: None, JavaScriptQuotes: Leave, JavaScriptWrapImports: true, KeepEmptyLinesAtTheStartOfBlocks: true, LambdaBodyIndentation: Signature, 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, PPIndentWidth: -1, ReferenceAlignment: Pointer, ReflowComments: true, ShortNamespaceLines: 1, SortIncludes: CaseSensitive, SortJavaStaticImport: Before, SortUsingDeclarations: true, SpaceAfterCStyleCast: false, 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: 1, SpacesInAngles: Never, SpacesInConditionalStatement: false, SpacesInContainerLiterals: true, SpacesInCStyleCastParentheses: false, SpacesInLineCommentPrefix: {, Minimum: 1, Maximum: 1, }, SpacesInParentheses: false, SpacesInSquareBrackets: false, SpaceBeforeSquareBrackets: false, BitFieldColonSpacing: Both, Standard: Latest, TabWidth: 4, UseCRLF: false, UseTab: Never}",
"C_Cpp.clang_format_fallbackStyle": "{Language: Cpp, BasedOnStyle: LLVM, AccessModifierOffset: -4, AlignAfterOpenBracket: Align, AlignArrayOfStructures: None, AlignConsecutiveMacros: None, AlignConsecutiveAssignments: None, AlignConsecutiveBitFields: None, AlignConsecutiveDeclarations: None, AlignEscapedNewlines: Right, AlignOperands: Align, AlignTrailingComments: true, AllowAllArgumentsOnNextLine: true, AllowAllConstructorInitializersOnNextLine: true, AllowAllParametersOfDeclarationOnNextLine: true, AllowShortEnumsOnASingleLine: true, AllowShortBlocksOnASingleLine: Never, AllowShortCaseLabelsOnASingleLine: false, AllowShortFunctionsOnASingleLine: All, AllowShortLambdasOnASingleLine: All, AllowShortIfStatementsOnASingleLine: Never, AllowShortLoopsOnASingleLine: false, AlwaysBreakAfterDefinitionReturnType: None, AlwaysBreakAfterReturnType: None, AlwaysBreakBeforeMultilineStrings: false, AlwaysBreakTemplateDeclarations: MultiLine, 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: 88, CompactNamespaces: false, ConstructorInitializerAllOnOneLineOrOnePerLine: false, ConstructorInitializerIndentWidth: 4, ContinuationIndentWidth: 4, Cpp11BracedListStyle: true, DeriveLineEnding: true, DerivePointerAlignment: false, DisableFormat: false, EmptyLineAfterAccessModifier: Never, EmptyLineBeforeAccessModifier: LogicalBlock, ExperimentalAutoDetectBinPacking: false, FixNamespaceComments: true, IncludeBlocks: Preserve, IncludeIsMainRegex: '(Test)?$', IncludeIsMainSourceRegex: '', IndentAccessModifiers: false, IndentCaseLabels: true, IndentCaseBlocks: false, IndentGotoLabels: true, IndentPPDirectives: None, IndentExternBlock: AfterExternBlock, IndentRequires: false, IndentWidth: 4, IndentWrappedFunctionNames: false, InsertTrailingCommas: None, JavaScriptQuotes: Leave, JavaScriptWrapImports: true, KeepEmptyLinesAtTheStartOfBlocks: true, LambdaBodyIndentation: Signature, 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, PPIndentWidth: -1, ReferenceAlignment: Pointer, ReflowComments: true, ShortNamespaceLines: 1, SortIncludes: CaseSensitive, SortJavaStaticImport: Before, SortUsingDeclarations: true, SpaceAfterCStyleCast: false, 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: 1, SpacesInAngles: Never, SpacesInConditionalStatement: false, SpacesInContainerLiterals: true, SpacesInCStyleCastParentheses: false, SpacesInLineCommentPrefix: {, Minimum: 1, Maximum: 1, }, SpacesInParentheses: false, SpacesInSquareBrackets: false, SpaceBeforeSquareBrackets: false, BitFieldColonSpacing: Both, Standard: Latest, TabWidth: 4, UseCRLF: false, UseTab: Never}",
"C_Cpp.clang_format_sortIncludes": true,
"C_Cpp.default.cStandard": "c17",
"C_Cpp.default.cppStandard": "c++20",
"C_Cpp.formatting": "clangFormat",
"C_Cpp.intelliSenseEngine": "disabled",
"clangd.arguments": [
"--compile-commands-dir=${workspaceFolder}/builddir"
],
"clangd.checkUpdates": true,
"files.associations": {
"*.in": "cpp",
}
}
1 change: 0 additions & 1 deletion AFLplusplus
Submodule AFLplusplus deleted from 2d6405
21 changes: 21 additions & 0 deletions bin/LICENSE-yq
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Mike Farah

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added bin/yq_linux_amd64
Binary file not shown.
11 changes: 0 additions & 11 deletions confuse-afl/Makefile

This file was deleted.

33 changes: 33 additions & 0 deletions confuse-afl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
confuse_afl_src = [
meson.current_source_dir() / 'confuse-afl-wrapper.cpp',
meson.current_source_dir() / 'fake_harness.cpp',
]

# There's actually no way to switch compilers for one subdir, so there are
# a few ways to make this more 'correct':
#
# * Make this a subproject using CC=afl-clang CXX=afl-clang++
# * Use a fake cross-compilation setup
instrumented_test = custom_target(
'instrumentedTest',
input: aflpp_afl_clangpp,
output: ['instrumentedTest'],
command: [
aflpp_afl_clangpp,
'-g',
'--std=c++11',
'-I',
meson.current_source_dir(),
'-o',
meson.current_build_dir() / 'instrumentedTest',
confuse_afl_src
],
build_by_default: true,
)

# afl_clangpp.process(confuse_afl_src, extra_args: [
# '-g',
# '--std=c++11',
# '-I',
# meson.current_source_dir(),
# ])
Loading

0 comments on commit bd2afbd

Please sign in to comment.