c++: more dummy non_constant_p arg avoidance
[official-gcc.git] / gcc / config / linux-d.cc
blob208b3236d9d19c1150714547f9e788b7db4fb99d
1 /* Linux support needed only by D front-end.
2 Copyright (C) 2017-2023 Free Software Foundation, Inc.
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.
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.
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/>. */
18 #include "config.h"
19 #include "system.h"
20 #include "coretypes.h"
21 #include "tm.h"
22 #include "tm_d.h"
23 #include "d/d-target.h"
24 #include "d/d-target-def.h"
26 /* Implement TARGET_D_OS_VERSIONS for Linux targets. */
28 static void
29 linux_d_os_builtins (void)
31 d_add_builtin_version ("Posix");
33 d_add_builtin_version ("linux");
34 #ifdef TARGET_ANDROID
35 if (TARGET_ANDROID)
36 d_add_builtin_version ("Android");
37 #endif
39 if (OPTION_GLIBC)
40 d_add_builtin_version ("CRuntime_Glibc");
41 else if (OPTION_UCLIBC)
42 d_add_builtin_version ("CRuntime_UClibc");
43 else if (OPTION_BIONIC)
44 d_add_builtin_version ("CRuntime_Bionic");
45 else if (OPTION_MUSL)
46 d_add_builtin_version ("CRuntime_Musl");
49 /* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
51 static tree
52 linux_d_handle_target_object_format (void)
54 const char *objfmt = "elf";
56 return build_string_literal (strlen (objfmt) + 1, objfmt);
59 /* Implement TARGET_D_REGISTER_OS_TARGET_INFO for Linux targets. */
61 static void
62 linux_d_register_target_info (void)
64 const struct d_target_info_spec handlers[] = {
65 { "objectFormat", linux_d_handle_target_object_format },
66 { NULL, NULL },
69 d_add_target_info_handlers (handlers);
72 #undef TARGET_D_OS_VERSIONS
73 #define TARGET_D_OS_VERSIONS linux_d_os_builtins
75 #undef TARGET_D_REGISTER_OS_TARGET_INFO
76 #define TARGET_D_REGISTER_OS_TARGET_INFO linux_d_register_target_info
78 struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;