invoke.texi (Wmissing-format-attribute): Document as an alias of Wsuggest-attribute...
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Mon, 30 Apr 2012 07:42:42 +0000 (07:42 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Mon, 30 Apr 2012 07:42:42 +0000 (07:42 +0000)
2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>

gcc/
* doc/invoke.texi (Wmissing-format-attribute): Document as an
alias of Wsuggest-attribute=format.
c-family/
* c.opt (Wsuggest-attribute=format): New. Alias of
Wmissing-format-attribute.
* c-format.c (decode_format_type): Replace
Wmissing-format-attribute with Wsuggest-attribute=format.
(check_function_format): Likewise.
cp/
* typeck.c (convert_for_assignment):  Replace
Wmissing-format-attribute with Wsuggest-attribute=format.
* call.c (convert_for_arg_passing): Likewise.
gcc/
* c-typeck.c (convert_for_assignment): Replace
Wmissing-format-attribute with Wsuggest-attribute=format.
(digest_init): Likewise.

From-SVN: r186955

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-format.c
gcc/c-family/c.opt
gcc/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/typeck.c
gcc/doc/invoke.texi

index f90ccebcd3918b2c0694fd1f6c55f6d1cefe3c1a..5d5149e2786375cd2e16e1ddfce594b93d05f066 100644 (file)
@@ -1,3 +1,11 @@
+2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       * doc/invoke.texi (Wmissing-format-attribute): Document as an
+       alias of Wsuggest-attribute=format.
+       * c-typeck.c (convert_for_assignment): Replace
+       Wmissing-format-attribute with Wsuggest-attribute=format.
+       (digest_init): Likewise.
+
 2012-04-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
         * opts.c (finish_options): Do not handle -Wmissing-noreturn here.
index 2082ff6c4af0278fda308311e18fee84f23b2f01..0185841c795ea5820cf03a5ef86073184f22a919 100644 (file)
@@ -1,3 +1,11 @@
+2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       * c.opt (Wsuggest-attribute=format): New. Alias of
+       Wmissing-format-attribute.
+       * c-format.c (decode_format_type): Replace
+       Wmissing-format-attribute with Wsuggest-attribute=format.
+       (check_function_format): Likewise.
+
 2012-04-27   Ollie Wild  <aaw@google.com>
 
        * c-common.c: Add CPP_W_LITERAL_SUFFIX mapping.
index 158e8dc12e7fadc7c9b1fac4910bf19a463cfddb..2d1ed8176f4c9d4397b227138204970c2d92614f 100644 (file)
@@ -1005,7 +1005,7 @@ decode_format_type (const char *s)
 /* Check the argument list of a call to printf, scanf, etc.
    ATTRS are the attributes on the function type.  There are NARGS argument
    values in the array ARGARRAY.
-   Also, if -Wmissing-format-attribute,
+   Also, if -Wsuggest-attribute=format,
    warn for calls to vprintf or vscanf in functions with no such format
    attribute themselves.  */
 
@@ -1033,7 +1033,7 @@ check_function_format (tree attrs, int nargs, tree *argarray)
                params = tree_cons (NULL_TREE, argarray[i], params);
              check_format_info (&info, params);
            }
-         if (warn_missing_format_attribute && info.first_arg_num == 0
+         if (warn_suggest_attribute_format && info.first_arg_num == 0
              && (format_types[info.format_type].flags
                  & (int) FMT_FLAG_ARG_CONVERT))
            {
@@ -1063,7 +1063,7 @@ check_function_format (tree attrs, int nargs, tree *argarray)
                        break;
                    }
                  if (args != 0)
-                   warning (OPT_Wmissing_format_attribute, "function might "
+                   warning (OPT_Wsuggest_attribute_format, "function might "
                             "be possible candidate for %qs format attribute",
                             format_types[info.format_type].name);
                }
index db8ca812ca55a8e2df2d07b9ae5663b75c8471f1..ff8ce94f96cf4341b2fc6746068c7e262c5c7661 100644 (file)
@@ -477,10 +477,14 @@ Wmissing-field-initializers
 C ObjC C++ ObjC++ Var(warn_missing_field_initializers) Init(-1) Warning
 Warn about missing fields in struct initializers
 
-Wmissing-format-attribute
-C ObjC C++ ObjC++ Var(warn_missing_format_attribute) Warning
+Wsuggest-attribute=format
+C ObjC C++ ObjC++ Var(warn_suggest_attribute_format) Warning
 Warn about functions which might be candidates for format attributes
 
+Wmissing-format-attribute
+C ObjC C++ ObjC++ Alias(Wsuggest-attribute=format)
+;
+
 Wmissing-include-dirs
 C ObjC C++ ObjC++ Warning
 Warn about user-specified include directories that do not exist
index e87cb87c0725e920645d91e95257349827c17598..5e18a98d942115051c6499c0a16ae227bc9c1edf 100644 (file)
@@ -5594,29 +5594,29 @@ convert_for_assignment (location_t location, tree type, tree rhs,
 
       /* Check if the right-hand side has a format attribute but the
         left-hand side doesn't.  */
-      if (warn_missing_format_attribute
+      if (warn_suggest_attribute_format
          && check_missing_format_attribute (type, rhstype))
        {
          switch (errtype)
          {
          case ic_argpass:
-           warning_at (location, OPT_Wmissing_format_attribute,
+           warning_at (location, OPT_Wsuggest_attribute_format,
                        "argument %d of %qE might be "
                        "a candidate for a format attribute",
                        parmnum, rname);
            break;
          case ic_assign:
-           warning_at (location, OPT_Wmissing_format_attribute,
+           warning_at (location, OPT_Wsuggest_attribute_format,
                        "assignment left-hand side might be "
                        "a candidate for a format attribute");
            break;
          case ic_init:
-           warning_at (location, OPT_Wmissing_format_attribute,
+           warning_at (location, OPT_Wsuggest_attribute_format,
                        "initialization left-hand side might be "
                        "a candidate for a format attribute");
            break;
          case ic_return:
-           warning_at (location, OPT_Wmissing_format_attribute,
+           warning_at (location, OPT_Wsuggest_attribute_format,
                        "return type might be "
                        "a candidate for a format attribute");
            break;
@@ -6335,7 +6335,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
        pedwarn_init (init_loc, 0,
                      "initializer element is not a constant expression");
 
-      /* Added to enable additional -Wmissing-format-attribute warnings.  */
+      /* Added to enable additional -Wsuggest-attribute=format warnings.  */
       if (TREE_CODE (TREE_TYPE (inside_init)) == POINTER_TYPE)
        inside_init = convert_for_assignment (init_loc, type, inside_init,
                                              origtype,
index db8bf7270e134f379234c65205d7b41ae1952f3c..541e725ee8e193c1a7225de7eccb8c1fa5cd16e9 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       * typeck.c (convert_for_assignment):  Replace
+       Wmissing-format-attribute with Wsuggest-attribute=format.
+       * call.c (convert_for_arg_passing): Likewise.
+
 2012-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/53096
index f9a7f08b8d389a8514d2b9b49fb01dccaacc2e0d..2207f421c415109194898d4effc4cd9b36ed1f08 100644 (file)
@@ -6321,7 +6321,7 @@ convert_for_arg_passing (tree type, tree val, tsubst_flags_t complain)
                                   TYPE_SIZE (integer_type_node)))
     val = perform_integral_promotions (val);
   if ((complain & tf_warning)
-      && warn_missing_format_attribute)
+      && warn_suggest_attribute_format)
     {
       tree rhstype = TREE_TYPE (val);
       const enum tree_code coder = TREE_CODE (rhstype);
@@ -6329,7 +6329,7 @@ convert_for_arg_passing (tree type, tree val, tsubst_flags_t complain)
       if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE)
          && coder == codel
          && check_missing_format_attribute (type, rhstype))
-       warning (OPT_Wmissing_format_attribute,
+       warning (OPT_Wsuggest_attribute_format,
                 "argument of function call might be a candidate for a format attribute");
     }
   return val;
index fb2f1bc6bbbffb9787abc77282af9bced3dcd49b..142402a0308bca77b7dcda6392386ecfb6906cd2 100644 (file)
@@ -7624,7 +7624,7 @@ convert_for_assignment (tree type, tree rhs,
          return error_mark_node;
        }
     }
-  if (warn_missing_format_attribute)
+  if (warn_suggest_attribute_format)
     {
       const enum tree_code codel = TREE_CODE (type);
       if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE)
@@ -7636,31 +7636,31 @@ convert_for_assignment (tree type, tree rhs,
            case ICR_ARGPASS:
            case ICR_DEFAULT_ARGUMENT:
              if (fndecl)
-               warning (OPT_Wmissing_format_attribute,
+               warning (OPT_Wsuggest_attribute_format,
                         "parameter %qP of %qD might be a candidate "
                         "for a format attribute", parmnum, fndecl);
              else
-               warning (OPT_Wmissing_format_attribute,
+               warning (OPT_Wsuggest_attribute_format,
                         "parameter might be a candidate "
                         "for a format attribute");
              break;
            case ICR_CONVERTING:
-             warning (OPT_Wmissing_format_attribute,
+             warning (OPT_Wsuggest_attribute_format,
                       "target of conversion might be a candidate "
                       "for a format attribute");
              break;
            case ICR_INIT:
-             warning (OPT_Wmissing_format_attribute,
+             warning (OPT_Wsuggest_attribute_format,
                       "target of initialization might be a candidate "
                       "for a format attribute");
              break;
            case ICR_RETURN:
-             warning (OPT_Wmissing_format_attribute,
+             warning (OPT_Wsuggest_attribute_format,
                       "return type might be a candidate "
                       "for a format attribute");
              break;
            case ICR_ASSIGN:
-             warning (OPT_Wmissing_format_attribute,
+             warning (OPT_Wsuggest_attribute_format,
                       "left-hand side of assignment might be a candidate "
                       "for a format attribute");
              break;
index bd7ea3b9480d241de21f0227060f2954d9006627..c6ee28fb4c213a51cdafe9b343959f730e46aa54 100644 (file)
@@ -255,7 +255,7 @@ Objective-C and Objective-C++ Dialects}.
 -Winvalid-pch -Wlarger-than=@var{len}  -Wunsafe-loop-optimizations @gol
 -Wlogical-op -Wlong-long @gol
 -Wmain -Wmaybe-uninitialized -Wmissing-braces  -Wmissing-field-initializers @gol
--Wmissing-format-attribute  -Wmissing-include-dirs @gol
+-Wmissing-include-dirs @gol
 -Wno-mudflap @gol
 -Wno-multichar  -Wnonnull  -Wno-overflow @gol
 -Woverlength-strings  -Wpacked  -Wpacked-bitfield-compat  -Wpadded @gol
@@ -266,7 +266,8 @@ Objective-C and Objective-C++ Dialects}.
 -Wsign-compare  -Wsign-conversion  -Wstack-protector @gol
 -Wstack-usage=@var{len} -Wstrict-aliasing -Wstrict-aliasing=n @gol
 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
--Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]} @gol
+-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
+-Wmissing-format-attribute @gol
 -Wswitch  -Wswitch-default  -Wswitch-enum -Wsync-nand @gol
 -Wsystem-headers  -Wtrampolines  -Wtrigraphs  -Wtype-limits  -Wundef @gol
 -Wuninitialized  -Wunknown-pragmas  -Wno-pragmas @gol
@@ -3860,7 +3861,7 @@ comparisons, so this warning level gives a very large number of
 false positives.
 @end table
 
-@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]}
+@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
 @opindex Wsuggest-attribute=
 @opindex Wno-suggest-attribute=
 Warn for cases where adding an attribute may be beneficial. The
@@ -3885,6 +3886,33 @@ returns normally if it doesn't contain an infinite loop nor returns abnormally
 by throwing, calling @code{abort()} or trapping.  This analysis requires option
 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
 higher.  Higher optimization levels improve the accuracy of the analysis.
+
+@item -Wsuggest-attribute=format
+@itemx -Wmissing-format-attribute
+@opindex Wsuggest-attribute=format
+@opindex Wmissing-format-attribute
+@opindex Wno-suggest-attribute=format
+@opindex Wno-missing-format-attribute
+@opindex Wformat
+@opindex Wno-format
+
+Warn about function pointers that might be candidates for @code{format}
+attributes.  Note these are only possible candidates, not absolute ones.
+GCC guesses that function pointers with @code{format} attributes that
+are used in assignment, initialization, parameter passing or return
+statements should have a corresponding @code{format} attribute in the
+resulting type.  I.e.@: the left-hand side of the assignment or
+initialization, the type of the parameter variable, or the return type
+of the containing function respectively should also have a @code{format}
+attribute to avoid the warning.
+
+GCC also warns about function definitions that might be
+candidates for @code{format} attributes.  Again, these are only
+possible candidates.  GCC guesses that @code{format} attributes
+might be appropriate for any function that calls a function like
+@code{vprintf} or @code{vscanf}, but this might not always be the
+case, and some functions for which @code{format} attributes are
+appropriate may not be detected.
 @end table
 
 @item -Warray-bounds
@@ -4424,29 +4452,6 @@ struct s x = @{ .f = 3, .g = 4 @};
 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
 
-@item -Wmissing-format-attribute
-@opindex Wmissing-format-attribute
-@opindex Wno-missing-format-attribute
-@opindex Wformat
-@opindex Wno-format
-Warn about function pointers that might be candidates for @code{format}
-attributes.  Note these are only possible candidates, not absolute ones.
-GCC guesses that function pointers with @code{format} attributes that
-are used in assignment, initialization, parameter passing or return
-statements should have a corresponding @code{format} attribute in the
-resulting type.  I.e.@: the left-hand side of the assignment or
-initialization, the type of the parameter variable, or the return type
-of the containing function respectively should also have a @code{format}
-attribute to avoid the warning.
-
-GCC also warns about function definitions that might be
-candidates for @code{format} attributes.  Again, these are only
-possible candidates.  GCC guesses that @code{format} attributes
-might be appropriate for any function that calls a function like
-@code{vprintf} or @code{vscanf}, but this might not always be the
-case, and some functions for which @code{format} attributes are
-appropriate may not be detected.
-
 @item -Wno-multichar
 @opindex Wno-multichar
 @opindex Wmultichar