* [C++ PATCH] maybe_add_lang_type_raw simplification
@ 2017-06-29 14:47 Nathan Sidwell
0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2017-06-29 14:47 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 154 bytes --]
I found maybe_add_lang_type_raw benefitted from simply returning false
early, rather than use a bool flag.
applied to trunk.
nathan
--
Nathan Sidwell
[-- Attachment #2: lex.diff --]
[-- Type: text/x-patch, Size: 1204 bytes --]
2017-06-29 Nathan Sidwell <nathan@acm.org>
* lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
flag.
Index: lex.c
===================================================================
--- lex.c (revision 249779)
+++ lex.c (working copy)
@@ -741,21 +741,21 @@ copy_type (tree type MEM_STAT_DECL)
static bool
maybe_add_lang_type_raw (tree t)
{
- bool add = (RECORD_OR_UNION_CODE_P (TREE_CODE (t))
- || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM);
- if (add)
- {
- TYPE_LANG_SPECIFIC (t)
- = (struct lang_type *) (ggc_internal_cleared_alloc
- (sizeof (struct lang_type)));
+ if (!(RECORD_OR_UNION_CODE_P (TREE_CODE (t))
+ || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM))
+ return false;
+
+ TYPE_LANG_SPECIFIC (t)
+ = (struct lang_type *) (ggc_internal_cleared_alloc
+ (sizeof (struct lang_type)));
- if (GATHER_STATISTICS)
- {
- tree_node_counts[(int)lang_type] += 1;
- tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
- }
+ if (GATHER_STATISTICS)
+ {
+ tree_node_counts[(int)lang_type] += 1;
+ tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
}
- return add;
+
+ return true;
}
tree
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-06-29 14:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 14:47 [C++ PATCH] maybe_add_lang_type_raw simplification Nathan Sidwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).