Debian Codegraph @

gcc/config/mingw/winnt-d.cc

raw
1 /* Windows support needed only by D front-end.
2 Copyright (C) 2021-2025 Free Software Foundation, Inc.
3
4 GCC is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 3, or (at your option) any later
7 version.
8
9 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with GCC; see the file COPYING3. If not see
16 <http://www.gnu.org/licenses/>. */
17
18 #define IN_TARGET_CODE 1
19
20 #include "config.h"
21 #include "system.h"
22 #include "coretypes.h"
23 #include "target.h"
24 #include "tm_d.h"
25 #include "d/d-target.h"
26 #include "d/d-target-def.h"
27
28 /* Implement TARGET_D_OS_VERSIONS for Windows targets. */
29
30 static void
31 winnt_d_os_builtins (void)
32 {
33 d_add_builtin_version ("Windows");
34 d_add_builtin_version ("MinGW");
35
36 if (TARGET_64BIT && ix86_abi == MS_ABI)
37 d_add_builtin_version ("Win64");
38 else if (!TARGET_64BIT)
39 d_add_builtin_version ("Win32");
40
41 d_add_builtin_version ("CRuntime_Microsoft");
42 }
43
44 /* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
45
46 static tree
47 winnt_d_handle_target_object_format (void)
48 {
49 const char *objfmt = "coff";
50
51 return build_string_literal (strlen (objfmt) + 1, objfmt);
52 }
53
54 /* Implement TARGET_D_REGISTER_OS_TARGET_INFO for Windows targets. */
55
56 static void
57 winnt_d_register_target_info (void)
58 {
59 const struct d_target_info_spec handlers[] = {
60 { "objectFormat", winnt_d_handle_target_object_format },
61 { NULL, NULL },
62 };
63
64 d_add_target_info_handlers (handlers);
65 }
66 #undef TARGET_D_OS_VERSIONS
67 #define TARGET_D_OS_VERSIONS winnt_d_os_builtins
68
69 #undef TARGET_D_REGISTER_OS_TARGET_INFO
70 #define TARGET_D_REGISTER_OS_TARGET_INFO winnt_d_register_target_info
71
72 /* Define TARGET_D_TEMPLATES_ALWAYS_COMDAT for Windows targets. */
73
74 #undef TARGET_D_TEMPLATES_ALWAYS_COMDAT
75 #define TARGET_D_TEMPLATES_ALWAYS_COMDAT true
76
77 struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;