r233981 - Unify warnings/errors from "maybe you meant" to "did you mean".

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Sat Apr 4 13:39:22 PDT 2015


Since we're bikeshedding, I'm personally strongly opposed to compiler
error messages that *ask questions of the user*, given that the
process is not actually an interactive one.  The wording "Maybe you
meant..." (a declarative sentence) seems to me infinitely preferable
to "Did you mean...?" (an interrogative one).

Also, the fact that "Did you mean...?" ends with a question mark means
that the end-of-sentence punctuation could easily get confused with
(or accidentally cut-and-pasted into) the actual program text.

    foo.c:3:'if' cannot be used here; did you mean 'x ? y : z'?

Software should be friendly, but it shouldn't ask questions of the
user unless it's prepared to accept different answers and act on them
accordingly.

–Arthur

On Sat, Apr 4, 2015 at 12:59 PM, Nico Weber <thakis at chromium.org> wrote:
> Since we're bikeshedding already, maybe s/did you mean to use/did you mean/
> too? The "to use" sounds somewhat redundant to me.
>
> On Thu, Apr 2, 2015 at 3:33 PM, Eric Christopher <echristo at gmail.com> wrote:
>>
>> Added thusly:
>>
>> dzur:~/sources/llvm/tools/clang/test> git svn dcommit
>> Committing to https://llvm.org/svn/llvm-project/cfe/trunk ...
>> M include/clang/Basic/DiagnosticSemaKinds.td
>> Committed r233982
>>
>> -eric
>>
>> On Thu, Apr 2, 2015 at 3:25 PM Eric Christopher <echristo at gmail.com>
>> wrote:
>>>
>>> On Thu, Apr 2, 2015 at 3:22 PM Richard Smith <richard at metafoo.co.uk>
>>> wrote:
>>>>
>>>> On Thu, Apr 2, 2015 at 3:10 PM, Eric Christopher <echristo at gmail.com>
>>>> wrote:
>>>>>
>>>>> Author: echristo
>>>>> Date: Thu Apr  2 17:10:06 2015
>>>>> New Revision: 233981
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=233981&view=rev
>>>>> Log:
>>>>> Unify warnings/errors from "maybe you meant" to "did you mean".
>>>>>
>>>>> Modified:
>>>>>     cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>>>>     cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp
>>>>>     cfe/trunk/test/FixIt/fixit-recursive-block.c
>>>>>     cfe/trunk/test/FixIt/fixit.cpp
>>>>>     cfe/trunk/test/Sema/member-reference.c
>>>>>     cfe/trunk/test/SemaCXX/member-expr.cpp
>>>>>     cfe/trunk/test/SemaCXX/pseudo-destructors.cpp
>>>>>
>>>>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=233981&r1=233980&r2=233981&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>>>>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Apr  2
>>>>> 17:10:06 2015
>>>>> @@ -1553,7 +1553,7 @@ def warn_uninit_byref_blockvar_captured_
>>>>>    "block pointer variable %0 is uninitialized when captured by
>>>>> block">,
>>>>>    InGroup<Uninitialized>, DefaultIgnore;
>>>>>  def note_block_var_fixit_add_initialization : Note<
>>>>> -  "maybe you meant to use __block %0">;
>>>>> +  "did you mean to use __block %0">;
>>>>
>>>>
>>>> Question mark missing here?
>>>
>>>
>>> Sure, I can add one. This was just a straight sed replacement :)
>>>
>>> -eric
>>>
>>>>
>>>>
>>>>>
>>>>>  def note_in_omitted_aggregate_initializer : Note<
>>>>>    "in implicit initialization of %select{array element %1|field %1}0 "
>>>>>    "with omitted initializer">;
>>>>> @@ -4800,7 +4800,7 @@ def error_arc_weak_ivar_access : Error<
>>>>>  def err_typecheck_member_reference_arrow : Error<
>>>>>    "member reference type %0 is not a pointer">;
>>>>>  def err_typecheck_member_reference_suggestion : Error<
>>>>> -  "member reference type %0 is %select{a|not a}1 pointer; maybe you
>>>>> meant to use '%select{->|.}1'?">;
>>>>> +  "member reference type %0 is %select{a|not a}1 pointer; did you mean
>>>>> to use '%select{->|.}1'?">;
>>>>>  def note_typecheck_member_reference_suggestion : Note<
>>>>>    "did you mean to use '.' instead?">;
>>>>>  def note_member_reference_arrow_from_operator_arrow : Note<
>>>>>
>>>>> Modified: cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp?rev=233981&r1=233980&r2=233981&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp (original)
>>>>> +++ cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp Thu Apr  2
>>>>> 17:10:06 2015
>>>>> @@ -27,9 +27,9 @@ void a(const A *x, int i, int *pi) {
>>>>>    y->~decltype(A())(); // expected-error{{use of undeclared identifier
>>>>> 'y'}}
>>>>>
>>>>>    typedef int *intp;
>>>>> -  i->~decltype(int())(); // expected-error{{member reference type
>>>>> 'int' is not a pointer; maybe you meant to use '.'?}}
>>>>> +  i->~decltype(int())(); // expected-error{{member reference type
>>>>> 'int' is not a pointer; did you mean to use '.'?}}
>>>>>    i.~decltype(int())();
>>>>> -  i->~decltype(intp())(); // expected-error{{member reference type
>>>>> 'int' is not a pointer; maybe you meant to use '.'?}} \
>>>>> +  i->~decltype(intp())(); // expected-error{{member reference type
>>>>> 'int' is not a pointer; did you mean to use '.'?}} \
>>>>>                               expected-error{{the type of object
>>>>> expression ('int') does not match the type being destroyed
>>>>> ('decltype(intp())' (aka 'int *')) in pseudo-destructor expression}}
>>>>>    i.~decltype(intp())(); // expected-error{{the type of object
>>>>> expression ('int') does not match the type being destroyed
>>>>> ('decltype(intp())' (aka 'int *')) in pseudo-destructor expression}}
>>>>>    pi->~decltype(int())();
>>>>>
>>>>> Modified: cfe/trunk/test/FixIt/fixit-recursive-block.c
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-recursive-block.c?rev=233981&r1=233980&r2=233981&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/FixIt/fixit-recursive-block.c (original)
>>>>> +++ cfe/trunk/test/FixIt/fixit-recursive-block.c Thu Apr  2 17:10:06
>>>>> 2015
>>>>> @@ -5,7 +5,7 @@
>>>>>
>>>>>  int main() {
>>>>>      void (^arc_fail)() = ^() {  // expected-warning {{block pointer
>>>>> variable 'arc_fail' is uninitialized when captured by block}} \
>>>>> -                                // expected-note {{maybe you meant to
>>>>> use __block 'arc_fail'}}
>>>>> +                                // expected-note {{did you mean to use
>>>>> __block 'arc_fail'}}
>>>>>         arc_fail(); // BOOM
>>>>>      };
>>>>>  }
>>>>>
>>>>> Modified: cfe/trunk/test/FixIt/fixit.cpp
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit.cpp?rev=233981&r1=233980&r2=233981&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/FixIt/fixit.cpp (original)
>>>>> +++ cfe/trunk/test/FixIt/fixit.cpp Thu Apr  2 17:10:06 2015
>>>>> @@ -344,7 +344,7 @@ namespace PR15045 {
>>>>>
>>>>>    int f() {
>>>>>      Cl0 c;
>>>>> -    return c->a;  // expected-error {{member reference type
>>>>> 'PR15045::Cl0' is not a pointer; maybe you meant to use '.'?}}
>>>>> +    return c->a;  // expected-error {{member reference type
>>>>> 'PR15045::Cl0' is not a pointer; did you mean to use '.'?}}
>>>>>    }
>>>>>  }
>>>>>
>>>>>
>>>>> Modified: cfe/trunk/test/Sema/member-reference.c
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/member-reference.c?rev=233981&r1=233980&r2=233981&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/Sema/member-reference.c (original)
>>>>> +++ cfe/trunk/test/Sema/member-reference.c Thu Apr  2 17:10:06 2015
>>>>> @@ -20,5 +20,5 @@ void g(void) {
>>>>>  }
>>>>>
>>>>>  int PR17762(struct simple c) {
>>>>> -  return c->i; // expected-error {{member reference type 'struct
>>>>> simple' is not a pointer; maybe you meant to use '.'?}}
>>>>> +  return c->i; // expected-error {{member reference type 'struct
>>>>> simple' is not a pointer; did you mean to use '.'?}}
>>>>>  }
>>>>>
>>>>> Modified: cfe/trunk/test/SemaCXX/member-expr.cpp
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-expr.cpp?rev=233981&r1=233980&r2=233981&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/SemaCXX/member-expr.cpp (original)
>>>>> +++ cfe/trunk/test/SemaCXX/member-expr.cpp Thu Apr  2 17:10:06 2015
>>>>> @@ -87,7 +87,7 @@ namespace test5 {
>>>>>    }
>>>>>
>>>>>    void test2(A &x) {
>>>>> -    x->A::foo<int>(); // expected-error {{'test5::A' is not a pointer;
>>>>> maybe you meant to use '.'?}}
>>>>> +    x->A::foo<int>(); // expected-error {{'test5::A' is not a pointer;
>>>>> did you mean to use '.'?}}
>>>>>    }
>>>>>  }
>>>>>
>>>>> @@ -181,7 +181,7 @@ namespace PR15045 {
>>>>>
>>>>>    int f() {
>>>>>      Cl0 c;
>>>>> -    return c->a;  // expected-error {{member reference type
>>>>> 'PR15045::Cl0' is not a pointer; maybe you meant to use '.'?}}
>>>>> +    return c->a;  // expected-error {{member reference type
>>>>> 'PR15045::Cl0' is not a pointer; did you mean to use '.'?}}
>>>>>    }
>>>>>
>>>>>    struct bar {
>>>>> @@ -202,7 +202,7 @@ namespace PR15045 {
>>>>>      foo f;
>>>>>
>>>>>      // Show that recovery has happened by also triggering typo
>>>>> correction
>>>>> -    e->Func();  // expected-error {{member reference type
>>>>> 'PR15045::bar' is not a pointer; maybe you meant to use '.'?}} \
>>>>> +    e->Func();  // expected-error {{member reference type
>>>>> 'PR15045::bar' is not a pointer; did you mean to use '.'?}} \
>>>>>                  // expected-error {{no member named 'Func' in
>>>>> 'PR15045::bar'; did you mean 'func'?}}
>>>>>
>>>>>      // Make sure a fixit isn't given in the case that the '->' isn't
>>>>> actually
>>>>> @@ -221,6 +221,6 @@ namespace pr16676 {
>>>>>    int f(S* s) {
>>>>>      T t;
>>>>>      return t.get_s  // expected-error {{reference to non-static member
>>>>> function must be called; did you mean to call it with no arguments?}}
>>>>> -        .i;  // expected-error {{member reference type 'pr16676::S *'
>>>>> is a pointer; maybe you meant to use '->'}}
>>>>> +        .i;  // expected-error {{member reference type 'pr16676::S *'
>>>>> is a pointer; did you mean to use '->'}}
>>>>>    }
>>>>>  }
>>>>>
>>>>> Modified: cfe/trunk/test/SemaCXX/pseudo-destructors.cpp
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/pseudo-destructors.cpp?rev=233981&r1=233980&r2=233981&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/SemaCXX/pseudo-destructors.cpp (original)
>>>>> +++ cfe/trunk/test/SemaCXX/pseudo-destructors.cpp Thu Apr  2 17:10:06
>>>>> 2015
>>>>> @@ -46,7 +46,7 @@ void f(A* a, Foo *f, int *i, double *d,
>>>>>    i->N::~Integer(); // expected-error{{'Integer' does not refer to a
>>>>> type name in pseudo-destructor expression; expected the name of type 'int'}}
>>>>>    i->Integer::~Double(); // expected-error{{the type of object
>>>>> expression ('int') does not match the type being destroyed ('Double' (aka
>>>>> 'double')) in pseudo-destructor expression}}
>>>>>
>>>>> -  ii->~Integer(); // expected-error{{member reference type 'int' is
>>>>> not a pointer; maybe you meant to use '.'?}}
>>>>> +  ii->~Integer(); // expected-error{{member reference type 'int' is
>>>>> not a pointer; did you mean to use '.'?}}
>>>>>    ii.~Integer();
>>>>>
>>>>>    cv_test(a);
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> cfe-commits mailing list
>>>>> cfe-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list