Mercurial > louis > kiibohd-controller
annotate Lib/clang.c @ 428:b5746c43904e
Fixing clang compilation and supporting clang-tidy
- clang.c includes necessary functions to make clang compiler work (tested on teensy 3.1)
- Added support code to generate a compile_commands.json for clang-tidy
* Updates the symlink whenever cmake or make is called (Unix OSs only)
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Fri, 04 Mar 2016 00:23:48 -0800 |
parents | |
children |
rev | line source |
---|---|
428
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
1 /* Copyright (C) 2016 by Jacob Alexander |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
2 * |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
3 * Permission is hereby granted, free of charge, to any person obtaining a copy |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
4 * of this software and associated documentation files (the "Software"), to deal |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
5 * in the Software without restriction, including without limitation the rights |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
7 * copies of the Software, and to permit persons to whom the Software is |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
8 * furnished to do so, subject to the following conditions: |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
9 * |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
10 * The above copyright notice and this permission notice shall be included in |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
11 * all copies or substantial portions of the Software. |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
12 * |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
19 * THE SOFTWARE. |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
20 */ |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
21 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
22 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
23 // This file adds various functions that clang doesn't link properly |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
24 // AFAIK, clang doesn't have an elegant solution for this, so this is what we gotta do... |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
25 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
26 // ----- Includes ----- |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
27 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
28 // Compiler Includes |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
29 #include <string.h> |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
30 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
31 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
32 void __aeabi_memcpy( void *dest, const void *src, size_t n ) |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
33 { |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
34 (void)memcpy(dest, src, n); |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
35 } |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
36 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
37 void __aeabi_memcpy4( void *dest, const void *src, size_t n ) |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
38 { |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
39 memcpy(dest, src, n); |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
40 } |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
41 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
42 void __aeabi_memclr( void *dest, size_t n ) |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
43 { |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
44 memset(dest, 0, n); |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
45 } |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
46 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
47 void __aeabi_memclr4( void *dest, size_t n ) |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
48 { |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
49 memset(dest, 0, n); |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
50 } |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
51 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
52 void __aeabi_memmove( void *dest, const void *src, size_t n ) |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
53 { |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
54 (void)memmove(dest, src, n); |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
55 } |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
56 |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
57 void __aeabi_memset( void *s, size_t n, int c ) |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
58 { |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
59 (void)memset(s, c, n); |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
60 } |
b5746c43904e
Fixing clang compilation and supporting clang-tidy
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
61 |