c++: retval dtor on rethrow [PR112301]
[official-gcc.git] / gcc / config / vxworks-driver.cc
blobd7732d7edb69a86e57beb6e921123f9f37062ef8
1 /* Copyright (C) 2022-2023 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
10 GCC is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GCC; see the file COPYING3. If not see
17 <http://www.gnu.org/licenses/>. */
19 #include "config.h"
20 #include "system.h"
21 #include "coretypes.h"
22 #include "tm.h"
23 #include "opts.h"
25 /* Perform early driver flags initializations that can't be achieved
26 with specs. In particular, we need to explicitly request a static
27 link for rtps by default before lang_specific_driver gets control. */
29 void vxworks_driver_init (unsigned int *in_decoded_options_count,
30 struct cl_decoded_option **in_decoded_options)
32 unsigned int i;
33 struct cl_decoded_option *decoded_options = *in_decoded_options;
35 /* Arrange to add -static if we are going to link a rtp and there is no
36 trace of any explicit request for a specific kind of link. */
37 bool wont_link = false;
38 bool mrtp = false;
39 bool link_kind_indication = false;
41 /* The new argument list will be contained in this. */
42 struct cl_decoded_option *new_decoded_options;
43 unsigned int num_options = *in_decoded_options_count;
45 for (i = 1; i < num_options; i++)
47 if (decoded_options[i].errors & CL_ERR_MISSING_ARG)
48 continue;
50 switch (decoded_options[i].opt_index)
52 case OPT_static:
53 case OPT_shared:
54 case OPT_Bdynamic:
55 case OPT_Bstatic:
56 case OPT_non_static:
57 link_kind_indication = true;
58 break;
60 case OPT_c:
61 case OPT_r:
62 case OPT_S:
63 case OPT_E:
64 case OPT_M:
65 case OPT_MM:
66 case OPT_fsyntax_only:
67 wont_link = true;
68 break;
70 case OPT_mrtp:
71 mrtp = true;
72 break;
74 default:
75 break;
79 if (!wont_link && mrtp && !link_kind_indication)
81 num_options++;
82 new_decoded_options = XNEWVEC(struct cl_decoded_option, num_options);
84 for (i = 0; i < num_options - 1; i++)
85 new_decoded_options[i] = decoded_options[i];
87 generate_option(OPT_static, NULL, 1, CL_DRIVER,
88 &new_decoded_options[num_options - 1]);
90 *in_decoded_options = new_decoded_options;
91 *in_decoded_options_count = num_options;