diff options
| author | mhsn <mail@mhsn.net> | 2025-12-02 21:50:37 +0000 |
|---|---|---|
| committer | mhsn <mail@mhsn.net> | 2025-12-02 21:50:37 +0000 |
| commit | e0e455270f4657e2294fefbd03d9ad0b469a87e0 (patch) | |
| tree | 3f9ce64e7ea3b0fea7e1f61287c4dba9c66c7ee3 | |
| parent | a9652699e602a2656aaa295d12b4530b42432c5f (diff) | |
| download | aoc-e0e455270f4657e2294fefbd03d9ad0b469a87e0.tar.gz aoc-e0e455270f4657e2294fefbd03d9ad0b469a87e0.zip | |
add c
| -rw-r--r-- | .clang-format | 109 | ||||
| -rw-r--r-- | 2025/01/c.c | 6 | ||||
| -rwxr-xr-x | check | 8 |
3 files changed, 123 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..245e939 --- /dev/null +++ b/.clang-format @@ -0,0 +1,109 @@ +--- +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 8 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: false + +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 8 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 8 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true + +# Taken from git's rules +PenaltyBreakAssignment: 10 +PenaltyBreakBeforeFirstCallParameter: 30 +PenaltyBreakComment: 10 +PenaltyBreakFirstLessLess: 0 +PenaltyBreakString: 10 +PenaltyExcessCharacter: 100 +PenaltyReturnTypeOnItsOwnLine: 60 + +PointerAlignment: Right +ReflowComments: false +SortIncludes: false +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatementsExceptForEachMacros +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp03 +TabWidth: 8 +UseTab: Always +... diff --git a/2025/01/c.c b/2025/01/c.c new file mode 100644 index 0000000..44b9c78 --- /dev/null +++ b/2025/01/c.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main() { + printf("hello world!\n"); + return 0; +} @@ -30,6 +30,14 @@ rustc) cargo build --release --target-dir /tmp/aoc_rust --manifest-path $aoc_path/rust/Cargo.toml solve=/tmp/aoc_rust/release/aoc_$year-$day ;; +c) + gcc $aoc_path/c.c -Wall -Wextra -Werror -std=c23 -o /tmp/aoc_c + solve=/tmp/aoc_c + ;; +cc) + gcc $aoc_path/c.c -Wall -Wextra -Werror -std=c23 -O3 -o /tmp/aoc_c + solve=/tmp/aoc_c + ;; *) echo "unknown lang: $lang" exit 1 |
