Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
/***********************************************************************************************************************************
Build Header
 
This header file must be included in all source files. It contains defines that are required in all modules. The build.auto.c header
generated by meson is also included here.
***********************************************************************************************************************************/
#ifndef BUILD_H
#define BUILD_H
 
/***********************************************************************************************************************************
Ban unsafe functions
 
Poison unsafe functions so any use is a compile error. System headers containing poisoned identifiers must be processed first
because build.h is the first include in every file and poisoned identifiers are not exempt inside system headers. #undef prevents a
"poisoning existing macro" warning where fortify has defined the function as a macro.
***********************************************************************************************************************************/
#include <stdio.h>
#include <string.h>
 
#undef sprintf
#undef strcat
#undef strcpy
#undef strncpy
 
#pragma GCC poison sprintf strcat strcpy strncpy
 
/***********************************************************************************************************************************
Include build.auto.h and other (hopefully small) header files that are commonly used.
***********************************************************************************************************************************/
#include <build.auto.h>
#include <stdnoreturn.h>
 
/***********************************************************************************************************************************
Function attributes
***********************************************************************************************************************************/
// Indicate that a function should always be inlined
#define FN_INLINE_ALWAYS                                            __attribute__((__always_inline__)) static inline
 
// Indicate that a function is formatted like printf (and provide format and args position)
#define FN_PRINTF(fmt, args)                                        __attribute__((format(printf, fmt, args)))
 
// Indicate that a function is formatted like strftime (and provide format position)
#define FN_STRFTIME(fmt)                                            __attribute__((format(strftime, fmt, 0)))
 
#endif