diff mbox

print quotes around )

Message ID CAJXstsD-M2HdjWZFGxWR=bt+UDgEVa7jrsb9aMrpzUm9=Yw35Q@mail.gmail.com
State New
Headers show

Commit Message

Prathamesh Kulkarni Feb. 9, 2014, 3:01 p.m. UTC
A trivial fix to print quotes around ) in libcpp/macro.c
OK for trunk ?

* macro.c (parse_params): print quote around ) in call to cpp_error() in
case CPP_EOF

Comments

Prathamesh Kulkarni Feb. 9, 2014, 4:20 p.m. UTC | #1
On Sun, Feb 9, 2014 at 8:31 PM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> A trivial fix to print quotes around ) in libcpp/macro.c
> OK for trunk ?
Will not work for if pfile->cb.error callback does not recognize %< and %>
(maybe clients other than c, c++ front-ends ?).
So we cannot include %< and %> in the error message ?
>
> * macro.c (parse_params): print quote around ) in call to cpp_error() in
> case CPP_EOF
>
> Index: libcpp/macro.c
> ===================================================================
> --- libcpp/macro.c    (revision 207627)
> +++ libcpp/macro.c    (working copy)
> @@ -2815,7 +2815,7 @@ parse_params (cpp_reader *pfile, cpp_mac
>        /* Fall through.  */
>
>      case CPP_EOF:
> -      cpp_error (pfile, CPP_DL_ERROR, "missing ')' in macro parameter list");
> +      cpp_error (pfile, CPP_DL_ERROR, "missing %<)%> in macro parameter list");
>        return false;
>      }
>      }
Joseph Myers Feb. 11, 2014, 12:05 a.m. UTC | #2
On Sun, 9 Feb 2014, Prathamesh Kulkarni wrote:

> On Sun, Feb 9, 2014 at 8:31 PM, Prathamesh Kulkarni
> <bilbotheelffriend@gmail.com> wrote:
> > A trivial fix to print quotes around ) in libcpp/macro.c
> > OK for trunk ?
> Will not work for if pfile->cb.error callback does not recognize %< and %>
> (maybe clients other than c, c++ front-ends ?).
> So we cannot include %< and %> in the error message ?

Certainly not while the callback is declared ATTRIBUTE_FPTR_PRINTF, I'd 
have expected the bootstrap to fail with -Werror warnings....  (Declaring 
the callback to allow GCC-internal formats might have corresponding 
requirements for particular types to be declared first, where the 
format-checking machinery knows how GCC-internal formats use GCC-internal 
typedefs; you'd need to check.)
diff mbox

Patch

Index: libcpp/macro.c
===================================================================
--- libcpp/macro.c    (revision 207627)
+++ libcpp/macro.c    (working copy)
@@ -2815,7 +2815,7 @@  parse_params (cpp_reader *pfile, cpp_mac
       /* Fall through.  */

     case CPP_EOF:
-      cpp_error (pfile, CPP_DL_ERROR, "missing ')' in macro parameter list");
+      cpp_error (pfile, CPP_DL_ERROR, "missing %<)%> in macro parameter list");
       return false;
     }
     }