add clang-format support for fastdep tool

This commit is contained in:
Axel Kohlmeyer
2021-05-05 23:46:26 -04:00
parent 97cd87a198
commit 9e4c618d30
2 changed files with 115 additions and 90 deletions

31
src/DEPEND/.clang-format Normal file
View File

@ -0,0 +1,31 @@
---
BasedOnStyle: LLVM
AccessModifierOffset: -1
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: false
AllowShortBlocksOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: true
BraceWrapping:
AfterFunction: true
BreakBeforeBraces: Custom
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
ColumnLimit: 80
IndentCaseLabels: true
IndentWidth: 4
NamespaceIndentation: Inner
ObjCBlockIndentWidth: 2
PenaltyBreakAssignment: 4
ReflowComments: false
SpaceAfterCStyleCast: false
SpacesBeforeTrailingComments: 4
SpacesInContainerLiterals: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
...

View File

@ -28,10 +28,10 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h>
const char version[] = "2.1"; const char version[] = "2.1";
@ -60,8 +60,7 @@ static char *my_strdup(const char *src)
char *trim_path(char *path) char *trim_path(char *path)
{ {
int last = strlen(path) - 1; int last = strlen(path) - 1;
while ((path[last] == '/') || (path[last] == '\\')) while ((path[last] == '/') || (path[last] == '\\')) --last;
--last;
path[++last] = '\0'; path[++last] = '\0';
return path; return path;
} }
@ -249,7 +248,6 @@ static void llist_print(llist_t *ll)
fputc('\n', stdout); fputc('\n', stdout);
} }
/************************************************************************ /************************************************************************
* set functions * set functions
************************************************************************/ ************************************************************************/
@ -553,7 +551,6 @@ static void add_depend(const char *source, set_t *incl, map_t *deps)
} }
} }
} }
} }
/************************************************************************/ /************************************************************************/
@ -614,8 +611,6 @@ static void do_depend(llnode_t *head, map_t *deps)
} }
} }
/************************************************************************/ /************************************************************************/
int main(int argc, char **argv) int main(int argc, char **argv)
@ -625,7 +620,8 @@ int main(int argc, char **argv)
map_t *deps; map_t *deps;
if (argc < 2) { if (argc < 2) {
fprintf(stderr,"FastDep v%s for LAMMPS\n" fprintf(stderr,
"FastDep v%s for LAMMPS\n"
"Usage: %s [-I <path> ...] -- <src1> [<src2> ...]\n", "Usage: %s [-I <path> ...] -- <src1> [<src2> ...]\n",
version, argv[0]); version, argv[0]);
fprintf(stderr, "Supported extensions: %d, %s, %s\n", numextensions, fprintf(stderr, "Supported extensions: %d, %s, %s\n", numextensions,
@ -664,9 +660,7 @@ int main(int argc, char **argv)
} }
src = llist_init(); src = llist_init();
while (++argv, --argc > 0) { while (++argv, --argc > 0) { llist_append(src, *argv); }
llist_append(src,*argv);
}
/* process files to look for includes */ /* process files to look for includes */
todo = llist_init(); todo = llist_init();