diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-09-23 11:39:39 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-09-23 11:39:39 +0200 |
commit | d2af6a68d8806cb9c6d2b2e6170f341bea8658e3 (patch) | |
tree | 0774e6c9fcd6e02b542fd8dfa85b60147d10b8cc /gcc/c-common.c | |
parent | d752cfdb114944cf3c800fcc2e4d030ab392c52c (diff) | |
download | gcc-d2af6a68d8806cb9c6d2b2e6170f341bea8658e3.zip gcc-d2af6a68d8806cb9c6d2b2e6170f341bea8658e3.tar.gz gcc-d2af6a68d8806cb9c6d2b2e6170f341bea8658e3.tar.bz2 |
expr.c (expand_expr_real_1): Use get_callee_fndecl instead of checking CALL_EXPR_FN directly to test for...
* expr.c (expand_expr_real_1) <case CALL_EXPR>: Use get_callee_fndecl
instead of checking CALL_EXPR_FN directly to test for builtins.
If error or warning attributes are present, print
error resp. warning.
* c-common.c (handle_error_attribute): New function.
(c_common_attribute_table): Add error and warning
attributes.
* doc/extend.texi: Document error and warning attributes.
* gcc.dg/va-arg-pack-len-1.c: Use error and warning
attributes.
* gcc.dg/va-arg-pack-len-2.c: New test.
* g++.dg/ext/va-arg-pack-len-1.C: Use error and warning
attributes.
* g++.dg/ext/va-arg-pack-len-2.C: New test.
From-SVN: r128687
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 3b5f477..8ebc920 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -518,6 +518,7 @@ static tree handle_always_inline_attribute (tree *, tree, tree, int, static tree handle_gnu_inline_attribute (tree *, tree, tree, int, bool *); static tree handle_artificial_attribute (tree *, tree, tree, int, bool *); static tree handle_flatten_attribute (tree *, tree, tree, int, bool *); +static tree handle_error_attribute (tree *, tree, tree, int, bool *); static tree handle_used_attribute (tree *, tree, tree, int, bool *); static tree handle_unused_attribute (tree *, tree, tree, int, bool *); static tree handle_externally_visible_attribute (tree *, tree, tree, int, @@ -663,6 +664,10 @@ const struct attribute_spec c_common_attribute_table[] = handle_cold_attribute }, { "hot", 0, 0, true, false, false, handle_hot_attribute }, + { "warning", 1, 1, true, false, false, + handle_error_attribute }, + { "error", 1, 1, true, false, false, + handle_error_attribute }, { NULL, 0, 0, false, false, false, NULL } }; @@ -4923,6 +4928,26 @@ handle_flatten_attribute (tree *node, tree name, return NULL_TREE; } +/* Handle a "warning" or "error" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_error_attribute (tree *node, tree name, tree args, + int ARG_UNUSED (flags), bool *no_add_attrs) +{ + if (TREE_CODE (*node) == FUNCTION_DECL + || TREE_CODE (TREE_VALUE (args)) == STRING_CST) + /* Do nothing else, just set the attribute. We'll get at + it later with lookup_attribute. */ + ; + else + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + } + + return NULL_TREE; +} /* Handle a "used" attribute; arguments as in struct attribute_spec.handler. */ |