The sixteenth batch
[git.git] / banned.h
blob6ccf46bc197e8cce014421f803e07e1f8f9d4963
1 #ifndef BANNED_H
2 #define BANNED_H
4 /*
5 * This header lists functions that have been banned from our code base,
6 * because they're too easy to misuse (and even if used correctly,
7 * complicate audits). Including this header turns them into compile-time
8 * errors.
9 */
11 #define BANNED(func) sorry_##func##_is_a_banned_function
13 #undef strcpy
14 #define strcpy(x,y) BANNED(strcpy)
15 #undef strcat
16 #define strcat(x,y) BANNED(strcat)
17 #undef strncpy
18 #define strncpy(x,y,n) BANNED(strncpy)
19 #undef strncat
20 #define strncat(x,y,n) BANNED(strncat)
22 #undef sprintf
23 #undef vsprintf
24 #define sprintf(...) BANNED(sprintf)
25 #define vsprintf(...) BANNED(vsprintf)
27 #undef gmtime
28 #define gmtime(t) BANNED(gmtime)
29 #undef localtime
30 #define localtime(t) BANNED(localtime)
31 #undef ctime
32 #define ctime(t) BANNED(ctime)
33 #undef ctime_r
34 #define ctime_r(t, buf) BANNED(ctime_r)
35 #undef asctime
36 #define asctime(t) BANNED(asctime)
37 #undef asctime_r
38 #define asctime_r(t, buf) BANNED(asctime_r)
40 #endif /* BANNED_H */