Skip to content

Commit 5e29e01

Browse files
enable posix c
1 parent 422a4c0 commit 5e29e01

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SHELL = /bin/sh
22
CC = clang-10
33

4-
FLAGS = -std=c11 -fsanitize=cfi -fvisibility=hidden
4+
FLAGS = -std=c11 -fsanitize=cfi -fvisibility=hidden -D_POSIX_C_SOURCE=200809L
55
CFLAGS = -pedantic-errors -Wall -Wextra -Werror -Wthread-safety
66
DEBUGFLAGS = -O0 -Wno-unused -Wno-unused-parameter -fno-omit-frame-pointer -fno-sanitize-recover=all -g -D _DEBUG
77
RELEASEFLAGS = -O3 -fsanitize=safe-stack -D NDEBUG
@@ -54,7 +54,7 @@ lint:
5454
cpplint src/*.[ch] src/*/*.[ch]
5555

5656
format:
57-
clang-format-10 -i src/*.[ch]
57+
clang-format-10 -i src/*.[ch] src/*/*.[ch]
5858

5959
tidy:
6060
clang-tidy-10 src/*.[ch] src/*/*.[ch]

src/closest_pair/closest_pair_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Copyright 2020 Dale Alleshouse
12
#include "./closest_pair.h"
23

34
#include <float.h>

src/hashing/farmhash.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ static inline uint32_t bswap32(const uint32_t x) {
9797

9898
// clang-format off
9999
for (size_t i = 0; i<sizeof(uint32_t)>> 1; i++) {
100+
// clang-format on
100101
uint32_t d = sizeof(uint32_t) - i - 1;
101102

102103
uint32_t mh = ((uint32_t)0xff) << (d << 3);
@@ -109,15 +110,16 @@ static inline uint32_t bswap32(const uint32_t x) {
109110

110111
y = t | (y & ~(mh | ml));
111112
}
112-
// clang-format on
113113

114114
return y;
115115
}
116116

117117
static inline uint64_t bswap64(const uint64_t x) {
118118
uint64_t y = x;
119119

120+
// clang-format off
120121
for (size_t i = 0; i<sizeof(uint64_t)>> 1; i++) {
122+
// clang-format on
121123
uint64_t d = sizeof(uint64_t) - i - 1;
122124

123125
uint64_t mh = ((uint64_t)0xff) << (d << 3);

src/list_data_structures/array_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Copyright 2020 Dale Alleshouse
12
#include "./array.h"
23

34
#include <stdbool.h>

src/list_data_structures/sorted_array_test.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
// Copyright 2020 Dale Alleshouse
12
#include "./sorted_array.h"
23

4+
#include <pthread.h>
35
#include <stdlib.h>
6+
#include <time.h>
7+
#include <unistd.h>
48

59
#include "../utils/error_reporter.h"
610
#include "../utils/math.h"
@@ -151,7 +155,9 @@ static void SortedArray_Max_standard() {
151155
Array* sut = CreateSut(10);
152156

153157
void* result = SortedArray_Max(sut);
154-
CU_ASSERT_EQUAL(&((int*)sut->array)[9], result);
158+
int* arr = sut->array;
159+
160+
CU_ASSERT_EQUAL(&arr[9], result);
155161

156162
Array_Destroy(sut);
157163
}

0 commit comments

Comments
 (0)