c-family/c-pretty-print.c - fix for 'restrict' quliafiers

Gary Funck gary@intrepid.com
Mon Aug 17 02:35:00 GMT 2015


While reviewing some code, I noticed that the logic for
pretty-printing 'restrict' qualifiers is likely missing a
statement that sets 'previous'.

OK to commit?

2015-08-l6  Gary Funck  <gary@intrepid.com>

        * c-pretty-print.c (pp_c_cv_qualifiers):
        Set 'previous' for restrict qualifiers.

Index: c-pretty-print.c
===================================================================
--- c-pretty-print.c    (revision 226928)
+++ c-pretty-print.c    (working copy)
@@ -207,16 +207,17 @@ pp_c_cv_qualifiers (c_pretty_printer *pp
     }
 
   if (qualifiers & TYPE_QUAL_RESTRICT)
     {
       if (previous)
         pp_c_whitespace (pp);
       pp_c_ws_string (pp, (flag_isoc99 && !c_dialect_cxx ()
                           ? "restrict" : "__restrict__"));
+      previous = true;
     }
 }
 
 /* Pretty-print T using the type-cast notation '( type-name )'.  */
 
 static void
 pp_c_type_cast (c_pretty_printer *pp, tree t)
 {




More information about the Gcc-patches mailing list