diff options
author | Nikolai Merinov <n.merinov@inango-systems.com> | 2018-11-07 21:02:27 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2018-11-07 14:02:27 -0700 |
commit | e217792beda1ca48daea497c00694a3924f992c5 (patch) | |
tree | a9b3a57a076c540e02affb6a305a3f52f651f185 | |
parent | 285556b5599bc180ad7a7ba1bb5f226b558ab32d (diff) | |
download | gcc-e217792beda1ca48daea497c00694a3924f992c5.zip gcc-e217792beda1ca48daea497c00694a3924f992c5.tar.gz gcc-e217792beda1ca48daea497c00694a3924f992c5.tar.bz2 |
common.opt: Add -Wattribute-warning.
* common.opt: Add -Wattribute-warning.
* doc/invoke.texi: Add documentation for -Wno-attribute-warning.
* expr.c (expand_expr_real_1): Add new attribute to warning_at
call to allow user configure behavior of "warning" attribute.
* gcc.dg/Wno-attribute-warning.c: New test.
From-SVN: r265891
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/common.opt | 4 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 10 | ||||
-rw-r--r-- | gcc/expr.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wno-attribute-warning.c | 8 |
6 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5d30e60..966f0cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-11-17 Nikolai Merinov <n.merinov@inango-systems.com> + + * common.opt: Add -Wattribute-warning. + * doc/invoke.texi: Add documentation for -Wno-attribute-warning. + * expr.c (expand_expr_real_1): Add new attribute to warning_at + call to allow user configure behavior of "warning" attribute. + 2018-11-07 Segher Boessenkool <segher@kernel.crashing.org> * target.def: Put @: after every vs., e.g., and i.e. where it is diff --git a/gcc/common.opt b/gcc/common.opt index 2971dc2..5a5d332 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -571,6 +571,10 @@ Wcpp Common Var(warn_cpp) Init(1) Warning Warn when a #warning directive is encountered. +Wattribute-warning +Common Var(warn_attribute_warning) Init(1) Warning +Warn about uses of __attribute__((warning)) declarations. + Wdeprecated-declarations Common Var(warn_deprecated_decl) Init(1) Warning Warn about uses of __attribute__((deprecated)) declarations. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 5f67982..cead538 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -292,6 +292,7 @@ Objective-C and Objective-C++ Dialects}. -Wclobbered -Wcomment -Wconditionally-supported @gol -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol -Wdelete-incomplete @gol +-Wno-attribute-warning @gol -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol -Wdisabled-optimization @gol -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol @@ -6978,6 +6979,15 @@ confused with the digit 0, and so is not the default, but may be useful as a local coding convention if the programming environment cannot be fixed to display these characters distinctly. +@item -Wno-attribute-warning +@opindex Wno-attribute-warning +@opindex Wattribute-warning +Do not warn about usage of functions (@pxref{Function Attributes}) +declared with @code{warning} attribute. By default, this warning is +enabled. @option{-Wno-attribute-warning} can be used to disable the +warning or @option{-Wno-error=attribute-warning} can be used to +disable the error when compiled with @option{-Werror} flag. + @item -Wno-deprecated @opindex Wno-deprecated @opindex Wdeprecated @@ -10930,7 +10930,8 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, DECL_ATTRIBUTES (fndecl))) != NULL) { const char *ident = lang_hooks.decl_printable_name (fndecl, 1); - warning_at (tree_nonartificial_location (exp), 0, + warning_at (tree_nonartificial_location (exp), + OPT_Wattribute_warning, "%Kcall to %qs declared with attribute warning: %s", exp, identifier_to_locale (ident), TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr)))); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9bb807e..689d7a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-11-17 Nikolai Merinov <n.merinov@inango-systems.com> + + * gcc.dg/Wno-attribute-warning.c: New test. + 2018-11-07 Nathan Sidwell <nathan@acm.org> PR c++/87904 diff --git a/gcc/testsuite/gcc.dg/Wno-attribute-warning.c b/gcc/testsuite/gcc.dg/Wno-attribute-warning.c new file mode 100644 index 0000000..2475304 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wno-attribute-warning.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Werror -Wno-error=attribute-warning" } */ + +int f1(void) __attribute__ ((warning("Please avoid f1"))); +int func1(void) +{ + return f1(); /* { dg-warning "'f1' declared with attribute warning: Please avoid f1" } */ +} |