-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcppcheck-types.c
54 lines (43 loc) · 1.16 KB
/
cppcheck-types.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* SPDX-License-Identifier: Apache-2.0
* Copyright (c) Bao Project and Contributors. All rights reserved
*/
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
/**
* This files can be used to generated the xml cpp.cfg to inform cppcheck about
* the used tooclhain type widths and macro values.
*/
#define TYPE(name,sign) \
__asm__ volatile ("-> <podtype name=\""#name"\" sign=\""#sign"\" size=\"%0\"/>" \
:: "i"(sizeof(name)));
#define DEF(name) \
__asm__ volatile ("-> <define name=\""#name"\" value=\"%0\"/>":: "i"(name));
__asm__ (
"-><?xml version=\"1.0\"?>\n\t"
"-><def format=\"2\">\n\t"
);
void types() {
TYPE(signed char,s);
TYPE(signed short,s);
TYPE(signed int,s);
TYPE(signed long int,s);
TYPE(signed long long int,s);
TYPE(unsigned char,u);
TYPE(unsigned short,u);
TYPE(unsigned int,u);
TYPE(unsigned long int,u);
TYPE(unsigned long long int,u);
TYPE(int8_t,s);
TYPE(int16_t,s);
TYPE(int32_t,s);
TYPE(int64_t,s);
TYPE(uint8_t,u);
TYPE(uint16_t,u);
TYPE(uint32_t,u);
TYPE(uint64_t,u);
TYPE(uintptr_t,u);
TYPE(size_t,u);
}
__asm__ ("-></def>");