Debian Codegraph @

gcc/cobol/convert.cc

raw
1 /*
2 * Copyright (c) 2021-2025 Symas Corporation
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of the Symas Corporation nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include "cobol-system.h"
32
33 #include "coretypes.h"
34 #include "tree.h"
35 #include "fold-const.h"
36 #include "convert.h"
37
38 // This is required by some generic routines
39
40 tree
41 convert (tree /*type*/, tree /*expr*/)
42 {
43 // The routine is necessary, but in our testing of the GCOBOL compiler, it never
44 // is called. I am commenting this cloned code out. I am keeping it so I have
45 // something to refer to if and when the necessity to reconstitute it arises.
46 // RJ Dubner, 2025-02-17
47 #if 0
48 if (type == error_mark_node
49 || expr == error_mark_node
50 || TREE_TYPE (expr) == error_mark_node)
51 return error_mark_node;
52
53 if (type == TREE_TYPE (expr))
54 return expr;
55
56 if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
57 return fold_convert (type, expr);
58
59 switch (TREE_CODE (type))
60 {
61 case VOID_TYPE:
62 case BOOLEAN_TYPE:
63 return fold_convert (type, expr);
64 case INTEGER_TYPE:
65 return fold (convert_to_integer (type, expr));
66 case POINTER_TYPE:
67 return fold (convert_to_pointer (type, expr));
68 case REAL_TYPE:
69 return fold (convert_to_real (type, expr));
70 case COMPLEX_TYPE:
71 return fold (convert_to_complex (type, expr));
72 default:
73 break;
74 }
75 #endif
76
77 gcc_unreachable ();
78 }