Skip to content

Commit 87833a0

Browse files
.github/workflows/build.yml: run 'make tests'
This enables SHA tests to check if different compilers produce the same results. Definitions in string.h were moved outside of __STDC_HOSTED__ to avoid compiler warnings (promoted to errors because of -Werror) due to incompatible implicit declaration of built-in functions. Signed-off-by: Krystian Hebel <[email protected]>
1 parent f16a0d0 commit 87833a0

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ jobs:
2525
run: |
2626
make CC=${{matrix.compiler}} BITS=${{matrix.bits}} ${{matrix.lto}}
2727
./extend_skl_only.sh
28+
29+
- name: make tests
30+
run: |
31+
make CC=${{matrix.compiler}} BITS=64 ${{matrix.lto}} tests

include/string.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,31 @@
33

44
#if __STDC_HOSTED__
55

6-
#include <string.h> /* memcpy, memset */
6+
#include <string.h> /* memcpy, memset, memcmp */
7+
8+
/* Used in tests only */
9+
#define memcmp(l, r, n) __builtin_memcmp(l, r, n)
710

811
#else
912

13+
/* Local declaration of bits of libc */
14+
15+
void *memset(void *s, int c, size_t n);
16+
17+
void *memcpy(void *dst, const void *src, size_t n);
18+
19+
size_t strlen(const char *s);
20+
21+
#endif /* __STDC_HOSTED__ */
22+
1023
/*
11-
* Local declaration of bits of libc
12-
*
1324
* Use __builtin_???() wherever possible to allow the compiler to perform
1425
* optimisations (e.g. constant folding) where possible. Calls to ???() will
1526
* be emitted as needed.
1627
*/
1728

18-
void *memset(void *s, int c, size_t n);
1929
#define memset(d, c, n) __builtin_memset(d, c, n)
20-
21-
void *memcpy(void *dst, const void *src, size_t n);
2230
#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
23-
24-
size_t strlen(const char *s);
2531
#define strlen(s) __builtin_strlen(s)
2632

27-
#endif /* __STDC_HOSTED__ */
2833
#endif /* __STRINGS_H__ */

0 commit comments

Comments
 (0)