Commit ab93e9b7 by Steve Ellcey Committed by Steve Ellcey

re PR target/79868 (aarch64: diagnostic "malformed target %s value" not translateable)

	PR target/79868
	* config/aarch64/aarch64-c.c (aarch64_pragma_target_parse):
	Remove second argument from aarch64_process_target_attr call.
	* config/aarch64/aarch64-protos.h (aarch64_process_target_attr):
	Ditto.
	* config/aarch64/aarch64.c (aarch64_attribute_info): Change
	field type.
	(aarch64_handle_attr_arch): Remove second argument.
	(aarch64_handle_attr_cpu): Ditto.
	(aarch64_handle_attr_tune): Ditto.
	(aarch64_handle_attr_isa_flags): Ditto.
	(aarch64_process_one_target_attr): Ditto.
	(aarch64_process_target_attr): Ditto.
	(aarch64_option_valid_attribute_p): Remove second argument.
	on aarch64_process_target_attr call.

From-SVN: r254359
parent ace72598
2017-11-02 Steve Ellcey <sellcey@cavium.com>
PR target/79868
* config/aarch64/aarch64-c.c (aarch64_pragma_target_parse):
Remove second argument from aarch64_process_target_attr call.
* config/aarch64/aarch64-protos.h (aarch64_process_target_attr):
Ditto.
* config/aarch64/aarch64.c (aarch64_attribute_info): Change
field type.
(aarch64_handle_attr_arch): Remove second argument.
(aarch64_handle_attr_cpu): Ditto.
(aarch64_handle_attr_tune): Ditto.
(aarch64_handle_attr_isa_flags): Ditto.
(aarch64_process_one_target_attr): Ditto.
(aarch64_process_target_attr): Ditto.
(aarch64_option_valid_attribute_p): Remove second argument.
on aarch64_process_target_attr call.
2017-11-02 David Malcolm <dmalcolm@redhat.com> 2017-11-02 David Malcolm <dmalcolm@redhat.com>
* diagnostic.c: Include "selftest-diagnostic.h". * diagnostic.c: Include "selftest-diagnostic.h".
...@@ -166,7 +166,7 @@ aarch64_pragma_target_parse (tree args, tree pop_target) ...@@ -166,7 +166,7 @@ aarch64_pragma_target_parse (tree args, tree pop_target)
information that it specifies. */ information that it specifies. */
if (args) if (args)
{ {
if (!aarch64_process_target_attr (args, "pragma")) if (!aarch64_process_target_attr (args))
return false; return false;
aarch64_override_options_internal (&global_options); aarch64_override_options_internal (&global_options);
......
...@@ -457,7 +457,7 @@ bool aarch64_gen_adjusted_ldpstp (rtx *, bool, scalar_mode, RTX_CODE); ...@@ -457,7 +457,7 @@ bool aarch64_gen_adjusted_ldpstp (rtx *, bool, scalar_mode, RTX_CODE);
void aarch64_init_builtins (void); void aarch64_init_builtins (void);
bool aarch64_process_target_attr (tree, const char*); bool aarch64_process_target_attr (tree);
void aarch64_override_options_internal (struct gcc_options *); void aarch64_override_options_internal (struct gcc_options *);
rtx aarch64_expand_builtin (tree exp, rtx aarch64_expand_builtin (tree exp,
......
...@@ -9551,9 +9551,8 @@ enum aarch64_attr_opt_type ...@@ -9551,9 +9551,8 @@ enum aarch64_attr_opt_type
ATTR_TYPE specifies the type of behavior of the attribute as described ATTR_TYPE specifies the type of behavior of the attribute as described
in the definition of enum aarch64_attr_opt_type. in the definition of enum aarch64_attr_opt_type.
ALLOW_NEG is true if the attribute supports a "no-" form. ALLOW_NEG is true if the attribute supports a "no-" form.
HANDLER is the function that takes the attribute string and whether HANDLER is the function that takes the attribute string as an argument
it is a pragma or attribute and handles the option. It is needed only It is needed only when the ATTR_TYPE is aarch64_attr_custom.
when the ATTR_TYPE is aarch64_attr_custom.
OPT_NUM is the enum specifying the option that the attribute modifies. OPT_NUM is the enum specifying the option that the attribute modifies.
This is needed for attributes that mirror the behavior of a command-line This is needed for attributes that mirror the behavior of a command-line
option, that is it has ATTR_TYPE aarch64_attr_mask, aarch64_attr_bool or option, that is it has ATTR_TYPE aarch64_attr_mask, aarch64_attr_bool or
...@@ -9564,15 +9563,14 @@ struct aarch64_attribute_info ...@@ -9564,15 +9563,14 @@ struct aarch64_attribute_info
const char *name; const char *name;
enum aarch64_attr_opt_type attr_type; enum aarch64_attr_opt_type attr_type;
bool allow_neg; bool allow_neg;
bool (*handler) (const char *, const char *); bool (*handler) (const char *);
enum opt_code opt_num; enum opt_code opt_num;
}; };
/* Handle the ARCH_STR argument to the arch= target attribute. /* Handle the ARCH_STR argument to the arch= target attribute. */
PRAGMA_OR_ATTR is used in potential error messages. */
static bool static bool
aarch64_handle_attr_arch (const char *str, const char *pragma_or_attr) aarch64_handle_attr_arch (const char *str)
{ {
const struct processor *tmp_arch = NULL; const struct processor *tmp_arch = NULL;
enum aarch64_parse_opt_result parse_res enum aarch64_parse_opt_result parse_res
...@@ -9589,15 +9587,14 @@ aarch64_handle_attr_arch (const char *str, const char *pragma_or_attr) ...@@ -9589,15 +9587,14 @@ aarch64_handle_attr_arch (const char *str, const char *pragma_or_attr)
switch (parse_res) switch (parse_res)
{ {
case AARCH64_PARSE_MISSING_ARG: case AARCH64_PARSE_MISSING_ARG:
error ("missing architecture name in 'arch' target %s", pragma_or_attr); error ("missing name in %<target(\"arch=\")%> pragma or attribute");
break; break;
case AARCH64_PARSE_INVALID_ARG: case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for 'arch' target %s", str, pragma_or_attr); error ("invalid name (\"%s\") in %<target(\"arch=\")%> pragma or attribute", str);
aarch64_print_hint_for_arch (str); aarch64_print_hint_for_arch (str);
break; break;
case AARCH64_PARSE_INVALID_FEATURE: case AARCH64_PARSE_INVALID_FEATURE:
error ("invalid feature modifier %qs for 'arch' target %s", error ("invalid value (\"%s\") in %<target()%> pragma or attribute", str);
str, pragma_or_attr);
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
...@@ -9606,11 +9603,10 @@ aarch64_handle_attr_arch (const char *str, const char *pragma_or_attr) ...@@ -9606,11 +9603,10 @@ aarch64_handle_attr_arch (const char *str, const char *pragma_or_attr)
return false; return false;
} }
/* Handle the argument CPU_STR to the cpu= target attribute. /* Handle the argument CPU_STR to the cpu= target attribute. */
PRAGMA_OR_ATTR is used in potential error messages. */
static bool static bool
aarch64_handle_attr_cpu (const char *str, const char *pragma_or_attr) aarch64_handle_attr_cpu (const char *str)
{ {
const struct processor *tmp_cpu = NULL; const struct processor *tmp_cpu = NULL;
enum aarch64_parse_opt_result parse_res enum aarch64_parse_opt_result parse_res
...@@ -9630,15 +9626,14 @@ aarch64_handle_attr_cpu (const char *str, const char *pragma_or_attr) ...@@ -9630,15 +9626,14 @@ aarch64_handle_attr_cpu (const char *str, const char *pragma_or_attr)
switch (parse_res) switch (parse_res)
{ {
case AARCH64_PARSE_MISSING_ARG: case AARCH64_PARSE_MISSING_ARG:
error ("missing cpu name in 'cpu' target %s", pragma_or_attr); error ("missing name in %<target(\"cpu=\")%> pragma or attribute");
break; break;
case AARCH64_PARSE_INVALID_ARG: case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for 'cpu' target %s", str, pragma_or_attr); error ("invalid name (\"%s\") in %<target(\"cpu=\")%> pragma or attribute", str);
aarch64_print_hint_for_core (str); aarch64_print_hint_for_core (str);
break; break;
case AARCH64_PARSE_INVALID_FEATURE: case AARCH64_PARSE_INVALID_FEATURE:
error ("invalid feature modifier %qs for 'cpu' target %s", error ("invalid value (\"%s\") in %<target()%> pragma or attribute", str);
str, pragma_or_attr);
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
...@@ -9647,11 +9642,10 @@ aarch64_handle_attr_cpu (const char *str, const char *pragma_or_attr) ...@@ -9647,11 +9642,10 @@ aarch64_handle_attr_cpu (const char *str, const char *pragma_or_attr)
return false; return false;
} }
/* Handle the argument STR to the tune= target attribute. /* Handle the argument STR to the tune= target attribute. */
PRAGMA_OR_ATTR is used in potential error messages. */
static bool static bool
aarch64_handle_attr_tune (const char *str, const char *pragma_or_attr) aarch64_handle_attr_tune (const char *str)
{ {
const struct processor *tmp_tune = NULL; const struct processor *tmp_tune = NULL;
enum aarch64_parse_opt_result parse_res enum aarch64_parse_opt_result parse_res
...@@ -9668,7 +9662,7 @@ aarch64_handle_attr_tune (const char *str, const char *pragma_or_attr) ...@@ -9668,7 +9662,7 @@ aarch64_handle_attr_tune (const char *str, const char *pragma_or_attr)
switch (parse_res) switch (parse_res)
{ {
case AARCH64_PARSE_INVALID_ARG: case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for 'tune' target %s", str, pragma_or_attr); error ("invalid name (\"%s\") in %<target(\"tune=\")%> pragma or attribute", str);
aarch64_print_hint_for_core (str); aarch64_print_hint_for_core (str);
break; break;
default: default:
...@@ -9681,11 +9675,10 @@ aarch64_handle_attr_tune (const char *str, const char *pragma_or_attr) ...@@ -9681,11 +9675,10 @@ aarch64_handle_attr_tune (const char *str, const char *pragma_or_attr)
/* Parse an architecture extensions target attribute string specified in STR. /* Parse an architecture extensions target attribute string specified in STR.
For example "+fp+nosimd". Show any errors if needed. Return TRUE For example "+fp+nosimd". Show any errors if needed. Return TRUE
if successful. Update aarch64_isa_flags to reflect the ISA features if successful. Update aarch64_isa_flags to reflect the ISA features
modified. modified. */
PRAGMA_OR_ATTR is used in potential error messages. */
static bool static bool
aarch64_handle_attr_isa_flags (char *str, const char *pragma_or_attr) aarch64_handle_attr_isa_flags (char *str)
{ {
enum aarch64_parse_opt_result parse_res; enum aarch64_parse_opt_result parse_res;
unsigned long isa_flags = aarch64_isa_flags; unsigned long isa_flags = aarch64_isa_flags;
...@@ -9709,13 +9702,11 @@ aarch64_handle_attr_isa_flags (char *str, const char *pragma_or_attr) ...@@ -9709,13 +9702,11 @@ aarch64_handle_attr_isa_flags (char *str, const char *pragma_or_attr)
switch (parse_res) switch (parse_res)
{ {
case AARCH64_PARSE_MISSING_ARG: case AARCH64_PARSE_MISSING_ARG:
error ("missing feature modifier in target %s %qs", error ("missing value in %<target()%> pragma or attribute");
pragma_or_attr, str);
break; break;
case AARCH64_PARSE_INVALID_FEATURE: case AARCH64_PARSE_INVALID_FEATURE:
error ("invalid feature modifier in target %s %qs", error ("invalid value (\"%s\") in %<target()%> pragma or attribute", str);
pragma_or_attr, str);
break; break;
default: default:
...@@ -9753,12 +9744,10 @@ static const struct aarch64_attribute_info aarch64_attributes[] = ...@@ -9753,12 +9744,10 @@ static const struct aarch64_attribute_info aarch64_attributes[] =
}; };
/* Parse ARG_STR which contains the definition of one target attribute. /* Parse ARG_STR which contains the definition of one target attribute.
Show appropriate errors if any or return true if the attribute is valid. Show appropriate errors if any or return true if the attribute is valid. */
PRAGMA_OR_ATTR holds the string to use in error messages about whether
we're processing a target attribute or pragma. */
static bool static bool
aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) aarch64_process_one_target_attr (char *arg_str)
{ {
bool invert = false; bool invert = false;
...@@ -9766,7 +9755,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) ...@@ -9766,7 +9755,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr)
if (len == 0) if (len == 0)
{ {
error ("malformed target %s", pragma_or_attr); error ("malformed %<target()%> pragma or attribute");
return false; return false;
} }
...@@ -9782,7 +9771,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) ...@@ -9782,7 +9771,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr)
through the machinery for the rest of the target attributes in this through the machinery for the rest of the target attributes in this
function. */ function. */
if (*str_to_check == '+') if (*str_to_check == '+')
return aarch64_handle_attr_isa_flags (str_to_check, pragma_or_attr); return aarch64_handle_attr_isa_flags (str_to_check);
if (len > 3 && strncmp (str_to_check, "no-", 3) == 0) if (len > 3 && strncmp (str_to_check, "no-", 3) == 0)
{ {
...@@ -9814,8 +9803,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) ...@@ -9814,8 +9803,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr)
if (attr_need_arg_p ^ (arg != NULL)) if (attr_need_arg_p ^ (arg != NULL))
{ {
error ("target %s %qs does not accept an argument", error ("pragma or attribute %<target(\"%s\")%> does not accept an argument", str_to_check);
pragma_or_attr, str_to_check);
return false; return false;
} }
...@@ -9823,8 +9811,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) ...@@ -9823,8 +9811,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr)
then we can't match. */ then we can't match. */
if (invert && !p_attr->allow_neg) if (invert && !p_attr->allow_neg)
{ {
error ("target %s %qs does not allow a negated form", error ("pragma or attribute %<target(\"%s\")%> does not allow a negated form", str_to_check);
pragma_or_attr, str_to_check);
return false; return false;
} }
...@@ -9834,7 +9821,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) ...@@ -9834,7 +9821,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr)
For example, cpu=, arch=, tune=. */ For example, cpu=, arch=, tune=. */
case aarch64_attr_custom: case aarch64_attr_custom:
gcc_assert (p_attr->handler); gcc_assert (p_attr->handler);
if (!p_attr->handler (arg, pragma_or_attr)) if (!p_attr->handler (arg))
return false; return false;
break; break;
...@@ -9878,8 +9865,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) ...@@ -9878,8 +9865,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr)
} }
else else
{ {
error ("target %s %s=%s is not valid", error ("pragma or attribute %<target(\"%s=%s\")%> is not valid", str_to_check, arg);
pragma_or_attr, str_to_check, arg);
} }
break; break;
} }
...@@ -9913,12 +9899,10 @@ num_occurences_in_str (char c, char *str) ...@@ -9913,12 +9899,10 @@ num_occurences_in_str (char c, char *str)
} }
/* Parse the tree in ARGS that contains the target attribute information /* Parse the tree in ARGS that contains the target attribute information
and update the global target options space. PRAGMA_OR_ATTR is a string and update the global target options space. */
to be used in error messages, specifying whether this is processing
a target attribute or a target pragma. */
bool bool
aarch64_process_target_attr (tree args, const char* pragma_or_attr) aarch64_process_target_attr (tree args)
{ {
if (TREE_CODE (args) == TREE_LIST) if (TREE_CODE (args) == TREE_LIST)
{ {
...@@ -9927,7 +9911,7 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr) ...@@ -9927,7 +9911,7 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr)
tree head = TREE_VALUE (args); tree head = TREE_VALUE (args);
if (head) if (head)
{ {
if (!aarch64_process_target_attr (head, pragma_or_attr)) if (!aarch64_process_target_attr (head))
return false; return false;
} }
args = TREE_CHAIN (args); args = TREE_CHAIN (args);
...@@ -9948,7 +9932,7 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr) ...@@ -9948,7 +9932,7 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr)
if (len == 0) if (len == 0)
{ {
error ("malformed target %s value", pragma_or_attr); error ("malformed %<target()%> pragma or attribute");
return false; return false;
} }
...@@ -9963,9 +9947,9 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr) ...@@ -9963,9 +9947,9 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr)
while (token) while (token)
{ {
num_attrs++; num_attrs++;
if (!aarch64_process_one_target_attr (token, pragma_or_attr)) if (!aarch64_process_one_target_attr (token))
{ {
error ("target %s %qs is invalid", pragma_or_attr, token); error ("pragma or attribute %<target(\"%s\")%> is not valid", token);
return false; return false;
} }
...@@ -9974,8 +9958,7 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr) ...@@ -9974,8 +9958,7 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr)
if (num_attrs != num_commas + 1) if (num_attrs != num_commas + 1)
{ {
error ("malformed target %s list %qs", error ("malformed %<target(\"%s\")%> pragma or attribute", TREE_STRING_POINTER (args));
pragma_or_attr, TREE_STRING_POINTER (args));
return false; return false;
} }
...@@ -10034,8 +10017,7 @@ aarch64_option_valid_attribute_p (tree fndecl, tree, tree args, int) ...@@ -10034,8 +10017,7 @@ aarch64_option_valid_attribute_p (tree fndecl, tree, tree args, int)
cl_target_option_restore (&global_options, cl_target_option_restore (&global_options,
TREE_TARGET_OPTION (target_option_current_node)); TREE_TARGET_OPTION (target_option_current_node));
ret = aarch64_process_target_attr (args);
ret = aarch64_process_target_attr (args, "attribute");
/* Set up any additional state. */ /* Set up any additional state. */
if (ret) if (ret)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment