Move to LLVM ruleset for Clang autoformatter

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2024-09-15 07:54:31 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2024-09-15 07:54:31 +0200
Commit 12d299f552a5aa8b6ea711dbe67805c4a5aab10d (patch)
-rw-r--r-- c-asm/.clang-format 2
-rw-r--r-- c-embed/.clang-format 2
-rw-r--r-- c-signals/.clang-format 2
-rw-r--r-- c-signals/main.c 7
-rw-r--r-- c-structs/.clang-format 2
-rw-r--r-- c-structs/read.c 2
-rw-r--r-- c-structs/struct.h 1
-rw-r--r-- c-structs/write.c 2
-rw-r--r-- zig-c-interop/.clang-format 4
9 files changed, 13 insertions, 11 deletions
diff --git a/c-asm/.clang-format b/c-asm/.clang-format
1
BasedOnStyle: Chromium
1
BasedOnStyle: LLVM
2
ColumnLimit: 120
2
ColumnLimit: 120
3
IndentWidth: 4
3
IndentWidth: 4
4
  
4
  
diff --git a/c-embed/.clang-format b/c-embed/.clang-format
1
BasedOnStyle: Chromium
1
BasedOnStyle: LLVM
2
ColumnLimit: 120
2
ColumnLimit: 120
3
IndentWidth: 4
3
IndentWidth: 4
4
  
4
  
diff --git a/c-signals/.clang-format b/c-signals/.clang-format
1
BasedOnStyle: Chromium
1
BasedOnStyle: LLVM
2
ColumnLimit: 120
2
ColumnLimit: 120
3
IndentWidth: 4
3
IndentWidth: 4
4
  
4
  
diff --git a/c-signals/main.c b/c-signals/main.c
...
3
#include <stdlib.h>
3
#include <stdlib.h>
4
#include <unistd.h>
4
#include <unistd.h>
5
  
5
  
6
void handle_signal(int signal) {
6
void handle_signal(int signal) { printf("Signal received %d\n", signal); }
7
    printf("Signal received %d\n", signal);
  
8
}
  
9
  
7
  
10
// use “kill -10 pidof a.out“
8
// use “kill -10 pidof a.out“
11
// https://www.man7.org/linux/man-pages/man7/signal.7.html
9
// https://www.man7.org/linux/man-pages/man7/signal.7.html
...
14
    signal(SIGUSR2, handle_signal);
12
    signal(SIGUSR2, handle_signal);
15
  
13
  
16
    printf("Waiting for signals...\n");
14
    printf("Waiting for signals...\n");
17
    for (;;)
15
    for (;;) {
18
        sleep(1);
16
        sleep(1);
  
17
    }
19
  
18
  
20
    return 0;
19
    return 0;
21
}
20
}
diff --git a/c-structs/.clang-format b/c-structs/.clang-format
1
BasedOnStyle: Chromium
1
BasedOnStyle: LLVM
2
ColumnLimit: 120
2
ColumnLimit: 120
3
IndentWidth: 4
3
IndentWidth: 4
4
  
4
  
diff --git a/c-structs/read.c b/c-structs/read.c
...
7
  
7
  
8
    Character ch;
8
    Character ch;
9
  
9
  
10
    FILE* file = fopen("character.dat", "rb");
10
    FILE *file = fopen("character.dat", "rb");
11
    if (file == NULL) {
11
    if (file == NULL) {
12
        perror("Error opening file");
12
        perror("Error opening file");
13
        return 1;
13
        return 1;
...
diff --git a/c-structs/struct.h b/c-structs/struct.h
...
3
    int health;
3
    int health;
4
    float damage;
4
    float damage;
5
} Character;
5
} Character;
6
  
  
diff --git a/c-structs/write.c b/c-structs/write.c
...
12
    ch.health = 30;
12
    ch.health = 30;
13
    ch.damage = 5.9;
13
    ch.damage = 5.9;
14
  
14
  
15
    FILE* file = fopen("character.dat", "wb");
15
    FILE *file = fopen("character.dat", "wb");
16
    if (file == NULL) {
16
    if (file == NULL) {
17
        perror("Error opening file");
17
        perror("Error opening file");
18
        return 1;
18
        return 1;
...
diff --git a/zig-c-interop/.clang-format b/zig-c-interop/.clang-format
  
1
BasedOnStyle: LLVM
  
2
ColumnLimit: 120
  
3
IndentWidth: 4
  
4