* tree.h (id_equal): New.
* dwarf2out.c, hsa-gen.c, ipa-devirt.c, omp-expand.c,
omp-simd-clone.c, read-rtl-function.c, tree-chkp.c, tree.c: Use it
instead of strcmp of IDENTIFIER_POINTER.
c-family/
* c-ada-spec.c, c-pragma.c: Use it.
cp/
* cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use it.
From-SVN: r249103
+2017-06-11 Jason Merrill <jason@redhat.com>
+
+ * tree.h (id_equal): New.
+ * dwarf2out.c, hsa-gen.c, ipa-devirt.c, omp-expand.c,
+ omp-simd-clone.c, read-rtl-function.c, tree-chkp.c, tree.c: Use it
+ instead of strcmp of IDENTIFIER_POINTER.
+
2017-06-10 Jan Hubicka <hubicka@ucw.cz>
* ipa-inline-transform.c: Include function.h, cfg.h and basic-block.h
+2017-06-11 Jason Merrill <jason@redhat.com>
+
+ * c-ada-spec.c, c-pragma.c: Use id_equal.
+
2017-06-04 Marek Polacek <polacek@redhat.com>
PR c/80919
tmp = TREE_TYPE (tmp);
return num_dim == 1 && TREE_CODE (tmp) == INTEGER_TYPE
- && !strcmp (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (tmp))), "char");
+ && id_equal (DECL_NAME (TYPE_NAME (tmp)), "char");
}
/* Dump in BUFFER an array type T in Ada syntax. Assume that the "type"
const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
name = targetm.strip_name_encoding (name);
- if (strcmp (name, IDENTIFIER_POINTER (newname)))
+ if (!id_equal (newname, name))
warning (OPT_Wpragmas, "#pragma redefine_extname ignored due to "
"conflict with previous rename");
}
if (DECL_NAME (decl) == p->oldname)
{
/* Only warn if there is a conflict. */
- if (strcmp (IDENTIFIER_POINTER (p->newname), oldname))
+ if (!id_equal (p->newname, oldname))
warning (OPT_Wpragmas, "#pragma redefine_extname ignored due to "
"conflict with previous rename");
+2017-06-11 Jason Merrill <jason@redhat.com>
+
+ * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
+ id_equal.
+
2017-06-09 Jason Merrill <jason@redhat.com>
Missing bits from N4268, constant evaluation for all non-type args.
template function. */
#define DECL_PRETTY_FUNCTION_P(NODE) \
(DECL_NAME (NODE) \
- && !strcmp (IDENTIFIER_POINTER (DECL_NAME (NODE)), "__PRETTY_FUNCTION__"))
+ && id_equal (DECL_NAME (NODE), "__PRETTY_FUNCTION__"))
/* Nonzero if the variable was declared to be thread-local.
We need a special C++ version of this test because the middle-end
}
if (IDENTIFIER_POINTER (name)[0] == '_'
- && ! strcmp (IDENTIFIER_POINTER (name), "_vptr"))
+ && id_equal (name, "_vptr"))
error ("member %qD conflicts with virtual function table field name",
value);
}
write_template_arg_literal (expr);
else if (code == PARM_DECL && DECL_ARTIFICIAL (expr))
{
- gcc_assert (!strcmp ("this", IDENTIFIER_POINTER (DECL_NAME (expr))));
+ gcc_assert (id_equal (DECL_NAME (expr), "this"));
write_string ("fpT");
}
else if (code == PARM_DECL)
"-std=c++11 or -std=gnu++11");
else if (cxx_dialect < cxx11
&& TREE_CODE (id) == IDENTIFIER_NODE
- && !strcmp (IDENTIFIER_POINTER (id), "thread_local"))
+ && id_equal (id, "thread_local"))
inform (location, "C++11 %<thread_local%> only available with "
"-std=c++11 or -std=gnu++11");
else if (!flag_concepts && id == ridpointers[(int)RID_CONCEPT])
/* ISO C++ defines alignof only with types, not with
expressions. So pedwarn if alignof is used with a non-
type expression. However, __alignof__ is ok. */
- if (!strcmp (IDENTIFIER_POINTER (token->u.value), "alignof"))
+ if (id_equal (token->u.value, "alignof"))
pedwarn (token->location, OPT_Wpedantic,
"ISO C++ does not allow %<alignof%> "
"with a non-type");
/* See if it's a virt-specifier-qualifier. */
if (token->type != CPP_NAME)
break;
- if (!strcmp (IDENTIFIER_POINTER(token->u.value), "override"))
+ if (id_equal (token->u.value, "override"))
{
maybe_warn_cpp0x (CPP0X_OVERRIDE_CONTROLS);
virt_specifier = VIRT_SPEC_OVERRIDE;
}
- else if (!strcmp (IDENTIFIER_POINTER(token->u.value), "final"))
+ else if (id_equal (token->u.value, "final"))
{
maybe_warn_cpp0x (CPP0X_OVERRIDE_CONTROLS);
virt_specifier = VIRT_SPEC_FINAL;
}
- else if (!strcmp (IDENTIFIER_POINTER(token->u.value), "__final"))
+ else if (id_equal (token->u.value, "__final"))
{
virt_specifier = VIRT_SPEC_FINAL;
}
token_is__thread (cp_token *token)
{
gcc_assert (token->keyword == RID_THREAD);
- return !strcmp (IDENTIFIER_POINTER (token->u.value), "__thread");
+ return id_equal (token->u.value, "__thread");
}
/* Set the location for a declarator specifier and check if it is
}
/* Worker num: argument and vector length: arguments. */
else if (cp_lexer_next_token_is (lexer, CPP_NAME)
- && strcmp (id, IDENTIFIER_POINTER (next->u.value)) == 0
+ && id_equal (next->u.value, id)
&& cp_lexer_nth_token_is (lexer, 2, CPP_COLON))
{
cp_lexer_consume_token (lexer); /* id */
else if (ARITHMETIC_TYPE_P (type)
&& (orig_reduc_id == NULL_TREE
|| (TREE_CODE (type) != COMPLEX_TYPE
- && (strcmp (IDENTIFIER_POINTER (orig_reduc_id),
- "min") == 0
- || strcmp (IDENTIFIER_POINTER (orig_reduc_id),
- "max") == 0))))
+ && (id_equal (orig_reduc_id, "min")
+ || id_equal (orig_reduc_id, "max")))))
error_at (loc, "predeclared arithmetic type %qT in "
"%<#pragma omp declare reduction%>", type);
else if (TREE_CODE (type) == FUNCTION_TYPE
clause_type = PRAGMA_CILK_CLAUSE_PRIVATE;
else if (!token->u.value || token->type != CPP_NAME)
return PRAGMA_CILK_CLAUSE_NONE;
- else if (!strcmp (IDENTIFIER_POINTER (token->u.value), "vectorlength"))
+ else if (id_equal (token->u.value, "vectorlength"))
clause_type = PRAGMA_CILK_CLAUSE_VECTORLENGTH;
- else if (!strcmp (IDENTIFIER_POINTER (token->u.value), "linear"))
+ else if (id_equal (token->u.value, "linear"))
clause_type = PRAGMA_CILK_CLAUSE_LINEAR;
- else if (!strcmp (IDENTIFIER_POINTER (token->u.value), "firstprivate"))
+ else if (id_equal (token->u.value, "firstprivate"))
clause_type = PRAGMA_CILK_CLAUSE_FIRSTPRIVATE;
- else if (!strcmp (IDENTIFIER_POINTER (token->u.value), "lastprivate"))
+ else if (id_equal (token->u.value, "lastprivate"))
clause_type = PRAGMA_CILK_CLAUSE_LASTPRIVATE;
- else if (!strcmp (IDENTIFIER_POINTER (token->u.value), "reduction"))
+ else if (id_equal (token->u.value, "reduction"))
clause_type = PRAGMA_CILK_CLAUSE_REDUCTION;
else
return PRAGMA_CILK_CLAUSE_NONE;
|| !DECL_IS_BUILTIN (fn))
return false;
- if (strcmp (IDENTIFIER_POINTER (DECL_NAME (fn)), "__integer_pack") == 0)
+ if (id_equal (DECL_NAME (fn), "__integer_pack"))
return true;
return false;
tree fn = CALL_EXPR_FN (call);
- if (strcmp (IDENTIFIER_POINTER (DECL_NAME (fn)), "__integer_pack") == 0)
+ if (id_equal (DECL_NAME (fn), "__integer_pack"))
return expand_integer_pack (call, args, complain, in_decl);
return NULL_TREE;
if (ns && TREE_CODE (ns) == NAMESPACE_DECL
&& DECL_CONTEXT (ns) == std_node
&& DECL_NAME (ns)
- && !strcmp (IDENTIFIER_POINTER (DECL_NAME (ns)), "decimal"))
+ && id_equal (DECL_NAME (ns), "decimal"))
{
const char *n = TYPE_NAME_STRING (t);
if ((strcmp (n, "decimal32") == 0)
targetm.dwarf_calling_convention (TREE_TYPE (decl)));
if (is_fortran ()
- && !strcmp (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), "MAIN__"))
+ && id_equal (DECL_ASSEMBLER_NAME (decl), "MAIN__"))
{
/* DWARF 2 doesn't provide a way to identify a program's source-level
entry point. DW_AT_calling_convention attributes are only meant
for (tree chain = TYPE_FIELDS (*hsa_kernel_dispatch_type);
chain != NULL_TREE; chain = TREE_CHAIN (chain))
- if (strcmp (field_name, IDENTIFIER_POINTER (DECL_NAME (chain))) == 0)
+ if (id_equal (DECL_NAME (chain), field_name))
return int_byte_position (chain);
gcc_unreachable ();
{
return target && TREE_CODE (TREE_TYPE (target)) != METHOD_TYPE
&& DECL_NAME (target)
- && !strcmp (IDENTIFIER_POINTER (DECL_NAME (target)),
+ && id_equal (DECL_NAME (target),
"__cxa_pure_virtual");
}
tree t, low_val = NULL_TREE, high_val = NULL_TREE;
for (t = DECL_ARGUMENTS (child_fndecl); t; t = TREE_CHAIN (t))
{
- if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__high"))
+ if (id_equal (DECL_NAME (t), "__high"))
high_val = t;
- else if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__low"))
+ else if (id_equal (DECL_NAME (t), "__low"))
low_val = t;
}
gcc_assert (low_val && high_val);
if the simdlen is assumed to be 8 for the first one, etc. */
for (struct cgraph_node *clone = node->simd_clones; clone;
clone = clone->simdclone->next_clone)
- if (strcmp (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (clone->decl)),
- str) == 0)
+ if (id_equal (DECL_ASSEMBLER_NAME (clone->decl), str))
return NULL_TREE;
return get_identifier (str);
find_param_by_name (tree fndecl, const char *name)
{
for (tree arg = DECL_ARGUMENTS (fndecl); arg; arg = TREE_CHAIN (arg))
- if (strcmp (name, IDENTIFIER_POINTER (DECL_NAME (arg))) == 0)
+ if (id_equal (DECL_NAME (arg), name))
return arg;
return NULL_TREE;
}
int i;
tree t;
FOR_EACH_VEC_ELT (m_fake_scope, i, t)
- if (strcmp (desc, IDENTIFIER_POINTER (DECL_NAME (t))) == 0)
+ if (id_equal (DECL_NAME (t), desc))
return t;
/* Not found? Create it.
to use zero bounds for input arguments of main
function. */
else if (flag_chkp_zero_input_bounds_for_main
- && strcmp (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (orig_decl)),
- "main") == 0)
+ && id_equal (DECL_ASSEMBLER_NAME (orig_decl), "main"))
bounds = chkp_get_zero_bounds ();
else if (BOUNDED_P (parm))
{
if (ident_len == attr_len)
{
- if (strcmp (attr_name, IDENTIFIER_POINTER (ident)) == 0)
+ if (id_equal (ident, attr_name))
return true;
}
else if (ident_len == attr_len + 4)
#endif
+/* True iff an identifier matches a C string. */
+
+inline bool
+id_equal (const_tree id, const char *str)
+{
+ return !strcmp (IDENTIFIER_POINTER (id), str);
+}
+
+inline bool
+id_equal (const char *str, const_tree id)
+{
+ return !strcmp (str, IDENTIFIER_POINTER (id));
+}
+
#define error_mark_node global_trees[TI_ERROR_MARK]
#define intQI_type_node global_trees[TI_INTQI_TYPE]