Mercurial > hg > CbC > CbC_gcc
comparison gcc/c-family/c-semantics.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* This file contains subroutine used by the C front-end to construct GENERIC. | 1 /* This file contains subroutine used by the C front-end to construct GENERIC. |
2 Copyright (C) 2000-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2000-2018 Free Software Foundation, Inc. |
3 Written by Benjamin Chelf (chelf@codesourcery.com). | 3 Written by Benjamin Chelf (chelf@codesourcery.com). |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify it under | 7 GCC is free software; you can redistribute it and/or modify it under |
31 { | 31 { |
32 tree t; | 32 tree t; |
33 t = alloc_stmt_list (); | 33 t = alloc_stmt_list (); |
34 vec_safe_push (stmt_list_stack, t); | 34 vec_safe_push (stmt_list_stack, t); |
35 return t; | 35 return t; |
36 } | |
37 | |
38 /* Return TRUE if, after I, there are any nondebug stmts. */ | |
39 | |
40 static inline bool | |
41 only_debug_stmts_after_p (tree_stmt_iterator i) | |
42 { | |
43 for (tsi_next (&i); !tsi_end_p (i); tsi_next (&i)) | |
44 if (TREE_CODE (tsi_stmt (i)) != DEBUG_BEGIN_STMT) | |
45 return false; | |
46 return true; | |
36 } | 47 } |
37 | 48 |
38 /* Finish the statement tree rooted at T. */ | 49 /* Finish the statement tree rooted at T. */ |
39 | 50 |
40 tree | 51 tree |
74 u = tsi_stmt (i); | 85 u = tsi_stmt (i); |
75 tsi_delink (&i); | 86 tsi_delink (&i); |
76 free_stmt_list (t); | 87 free_stmt_list (t); |
77 t = u; | 88 t = u; |
78 } | 89 } |
90 /* If the statement list contained a debug begin stmt and a | |
91 statement list, move the debug begin stmt into the statement | |
92 list and return it. */ | |
93 else if (!tsi_end_p (i) | |
94 && TREE_CODE (tsi_stmt (i)) == DEBUG_BEGIN_STMT) | |
95 { | |
96 u = tsi_stmt (i); | |
97 tsi_next (&i); | |
98 if (tsi_one_before_end_p (i) | |
99 && TREE_CODE (tsi_stmt (i)) == STATEMENT_LIST) | |
100 { | |
101 tree l = tsi_stmt (i); | |
102 tsi_prev (&i); | |
103 tsi_delink (&i); | |
104 tsi_delink (&i); | |
105 i = tsi_start (l); | |
106 free_stmt_list (t); | |
107 t = l; | |
108 tsi_link_before (&i, u, TSI_SAME_STMT); | |
109 } | |
110 while (!tsi_end_p (i) | |
111 && TREE_CODE (tsi_stmt (i)) == DEBUG_BEGIN_STMT) | |
112 tsi_next (&i); | |
113 /* If there are only debug stmts in the list, without them | |
114 we'd have an empty stmt without side effects. If there's | |
115 only one nondebug stmt, we'd have extracted the stmt and | |
116 dropped the list, and we'd take TREE_SIDE_EFFECTS from | |
117 that statement. In either case, keep the list's | |
118 TREE_SIDE_EFFECTS in sync. */ | |
119 if (tsi_end_p (i)) | |
120 TREE_SIDE_EFFECTS (t) = 0; | |
121 else if (only_debug_stmts_after_p (i)) | |
122 TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (tsi_stmt (i)); | |
123 } | |
79 } | 124 } |
80 | 125 |
81 return t; | 126 return t; |
82 } | 127 } |
83 | 128 |