diff options
author | Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> | 2016-01-20 19:00:21 +0100 |
---|---|---|
committer | Linaro Code Review <review@review.linaro.org> | 2016-01-27 11:40:07 +0000 |
commit | cfc75e27f939b0bb49438e8ac27910980df27ba9 (patch) | |
tree | 86d11308d53e3891c16f47e96f17982e79dfb919 | |
parent | 84e4c94f2ac5ce21630779da264e2f362fe6400f (diff) |
gcc/
Backport from trunk r232440.
2016-01-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (aarch64_process_one_target_attr): Return
false when argument string is not found in the attributes table
at all.
gcc/testsuite/
Backport from trunk r232440.
2016-01-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/target_attr_17.c: New test.
Change-Id: I7b29bbe09b39f05e721e555999dc70b3df340ecf
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/target_attr_17.c | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 05b7ae16708..d3b75240d16 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -8329,6 +8329,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) arg++; } const struct aarch64_attribute_info *p_attr; + bool found = false; for (p_attr = aarch64_attributes; p_attr->name; p_attr++) { /* If the names don't match up, or the user has given an argument @@ -8337,6 +8338,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) if (strcmp (str_to_check, p_attr->name) != 0) continue; + found = true; bool attr_need_arg_p = p_attr->attr_type == aarch64_attr_custom || p_attr->attr_type == aarch64_attr_enum; @@ -8416,7 +8418,10 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) } } - return true; + /* If we reached here we either have found an attribute and validated + it or didn't match any. If we matched an attribute but its arguments + were malformed we will have returned false already. */ + return found; } /* Count how many times the character C appears in diff --git a/gcc/testsuite/gcc.target/aarch64/target_attr_17.c b/gcc/testsuite/gcc.target/aarch64/target_attr_17.c new file mode 100644 index 00000000000..483cc6d4a1d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/target_attr_17.c @@ -0,0 +1,8 @@ +__attribute__((target("invalid-attr-string"))) +int +foo (int a) +{ + return a + 5; +} + +/* { dg-error "target attribute.*is invalid" "" { target *-*-* } 0 } */
\ No newline at end of file |