GDB (xrefs)
common-defs.h
Go to the documentation of this file.
1 /* Common definitions.
2 
3  Copyright (C) 1986-2018 Free Software Foundation, Inc.
4 
5  This file is part of GDB.
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 
20 #ifndef COMMON_DEFS_H
21 #define COMMON_DEFS_H
22 
23 #include "config.h"
24 #ifdef GDBSERVER
25 #include "build-gnulib-gdbserver/config.h"
26 #else
27 #include "build-gnulib/config.h"
28 #endif
29 
30 /* From:
31  https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html
32 
33  "On some hosts that predate C++11, when using C++ one must define
34  __STDC_CONSTANT_MACROS to make visible the definitions of constant
35  macros such as INTMAX_C, and one must define __STDC_LIMIT_MACROS to
36  make visible the definitions of limit macros such as INTMAX_MAX.".
37 
38  And:
39  https://www.gnu.org/software/gnulib/manual/html_node/inttypes_002eh.html
40 
41  "On some hosts that predate C++11, when using C++ one must define
42  __STDC_FORMAT_MACROS to make visible the declarations of format
43  macros such as PRIdMAX."
44 
45  Must do this before including any system header, since other system
46  headers may include stdint.h/inttypes.h. */
47 #define __STDC_CONSTANT_MACROS 1
48 #define __STDC_LIMIT_MACROS 1
49 #define __STDC_FORMAT_MACROS 1
50 
51 #include <stdarg.h>
52 #include <stdio.h>
53 #include <stdlib.h>
54 #include <stddef.h>
55 #include <stdint.h>
56 #include <string.h>
57 #ifdef HAVE_STRINGS_H
58 #include <strings.h> /* for strcasecmp and strncasecmp */
59 #endif
60 #include <errno.h>
61 #include <alloca.h>
62 
63 #include "ansidecl.h"
64 /* This is defined by ansidecl.h, but we prefer gnulib's version. On
65  MinGW, gnulib might enable __USE_MINGW_ANSI_STDIO, which may or not
66  require use of attribute gnu_printf instead of printf. gnulib
67  checks that at configure time. Since _GL_ATTRIBUTE_FORMAT_PRINTF
68  is compatible with ATTRIBUTE_PRINTF, simply use it. */
69 #undef ATTRIBUTE_PRINTF
70 #define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF
71 
72 #include "libiberty.h"
73 #include "pathmax.h"
74 #include "gdb/signals.h"
75 #include "gdb_locale.h"
76 #include "ptid.h"
77 #include "common-types.h"
78 #include "common-utils.h"
79 #include "gdb_assert.h"
80 #include "errors.h"
81 #include "print-utils.h"
82 #include "common-debug.h"
83 #include "cleanups.h"
84 #include "common-exceptions.h"
85 #include "common/poison.h"
86 
87 #define EXTERN_C extern "C"
88 #define EXTERN_C_PUSH extern "C" {
89 #define EXTERN_C_POP }
90 
91 /* Pull in gdb::unique_xmalloc_ptr. */
92 #include "common/gdb_unique_ptr.h"
93 
94 #endif /* COMMON_DEFS_H */