vim7: PC-lint suggested changes (long)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

vim7: PC-lint suggested changes (long)

Walter Briscoe
Most of what follows was suggested by PC-lint.
I make some comments which try to give rationale for the suggestions.
I have an inter-module problem in PC-lint when mixing C and C++ sources;
I am in contact with Gimpel's software support.

P.S. I introduced my dyslexic daughter to vim yesterday. With a "word",
background, she was surprised that sentence initial letters were not
capitalised. Does "there is no grammar check" mean that in spell.txt?
A person with some knowledge of Vim syntax-checking might sort that.

--
Walter Briscoe


t.t.bz2 (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: vim7: PC-lint suggested changes (long)

Mikołaj Machowski
Dnia wtorek 21 czerwiec 2005 14:42, Walter Briscoe napisa?:
> P.S. I introduced my dyslexic daughter to vim yesterday. With a "word",
> background, she was surprised that sentence initial letters were not
> capitalised. Does "there is no grammar check" mean that in spell.txt?
> A person with some knowledge of Vim syntax-checking might sort that.

This doesn't have to be done on binary level.

Check polski file from latex-suite package. It requires
mapping of space though. Ahh, SuperSpace mapping/autocommand
where art thou?

m.
--
LaTeX + Vim = http://vim-latex.sourceforge.net/
Vim-list(s) Users Map: (last change 15 May)
 http://skawina.eu.org/mikolaj/vimlist
CLEWN - http://clewn.sf.net

Reply | Threaded
Open this post in threaded view
|

Re: vim7: PC-lint suggested changes (long)

Bram Moolenaar
In reply to this post by Walter Briscoe

Walter Briscoe wrote:

> Most of what follows was suggested by PC-lint.
> I make some comments which try to give rationale for the suggestions.
> I have an inter-module problem in PC-lint when mixing C and C++ sources;
> I am in contact with Gimpel's software support.

Thanks.  I'll include most suggestions.  A couple of remarks:

I have VC5 and I can compile src/glbl_ime.cpp without problems.

> Is "extern "C" { void foo(void); } legal C++?

No, that's C++ only.

> P.S. I introduced my dyslexic daughter to vim yesterday. With a "word",
> background, she was surprised that sentence initial letters were not
> capitalised. Does "there is no grammar check" mean that in spell.txt?
> A person with some knowledge of Vim syntax-checking might sort that.

I don't plan to add this, since it's very complicated.  Especially at
the start of a paragraph (what is a paragraph anyway?).  And it tends to
give a lot of false warnings (I always disable the auto-correction
function of MS-Word for that reason).

--
hundred-and-one symptoms of being an internet addict:
111. You and your friends get together regularly on IRC, even though
     all of you live in the same city.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Reply | Threaded
Open this post in threaded view
|

Re: vim7: PC-lint suggested changes (long)

Nikolai Weibull
In reply to this post by Walter Briscoe
Walter Briscoe wrote:

> P.S. I introduced my dyslexic daughter to vim yesterday. With a "word",
> background, she was surprised that sentence initial letters were not
> capitalised.

Vim isn't a word processor (but you could add this specific
functionality quite easily),
        nikolai

--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
Reply | Threaded
Open this post in threaded view
|

Re: vim7: PC-lint suggested changes (long)

Walter Briscoe
In reply to this post by Bram Moolenaar
In message <[hidden email]> of Tue, 21 Jun
2005 23:36:32 in , Bram Moolenaar <[hidden email]> writes

>
>Walter Briscoe wrote:
>
>> Most of what follows was suggested by PC-lint.
>> I make some comments which try to give rationale for the suggestions.
>> I have an inter-module problem in PC-lint when mixing C and C++ sources;
>> I am in contact with Gimpel's software support.
>
>Thanks.  I'll include most suggestions.  A couple of remarks:
>
>I have VC5 and I can compile src/glbl_ime.cpp without problems.

1) I am sorry I missed that remark when I first read it.
I used VC5 because I know you use it.
What is to be done? First, I think I should detail how I break things:

Do you see this?

D:\wfb\vim\bld\vim70aa\vim7\src ) nmake -nologo -f Make_mvc.mak GUI=yes GIME=yes NETBEANS=yes NBDEBUG=yes

        cl -c /W3 /nologo -DWIN32  -D_WIN32 -I. -Iproto -DHAVE_PATHDEF -DWIN32   -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG  -DNBDEBUG    -DWINVER=0
x0400 -D_WIN32_WINNT=0x0400 /Ox -DNDEBUG  -DGLOBAL_IME -DFEAT_MBYTE -DFEAT_GUI_W32 -DDYNAMIC_GETTEXT -DFEAT_BIG /Zi /Fo.\ObjG/ /Fd.\ObjG/ gl
bl_ime.cpp
glbl_ime.cpp
nbdebug.h(50) : error C2065: 'u_int' : undeclared identifier
nbdebug.h(50) : error C2146: syntax error : missing ')' before identifier 'wait_flags'
nbdebug.h(50) : error C2182: 'nbdebug_wait' : illegal use of type 'void'
nbdebug.h(50) : error C2059: syntax error : ')'
nbdebug.h(54) : error C2239: unexpected token 'identifier' following declaration of 'u_int'
nbdebug.h(54) : error C2061: syntax error : identifier 'nb_dlevel'
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

D:\wfb\vim\bld\vim70aa\vim7\src )

If you do not see what I see, can you please create a glbl_ime.i.bz2
file I can download? I can then compare your glbl_ime.i and mine.

2) I thought #define STRICT should be used for each #include <windows.h>
unless contra-indicated. (It is used for 3/11.) Did you have a specific
reason for rejecting my thought or was it that its absence is not known
to cause harm?
--
Walter Briscoe
Reply | Threaded
Open this post in threaded view
|

Re: vim7: PC-lint suggested changes (long)

Bram Moolenaar

Walter Briscoe wrote:

> 1) I am sorry I missed that remark when I first read it.
> I used VC5 because I know you use it.
> What is to be done? First, I think I should detail how I break things:
>
> Do you see this?
>
> D:\wfb\vim\bld\vim70aa\vim7\src ) nmake -nologo -f Make_mvc.mak GUI=yes GIME=yes NETBEANS=yes NBDEBUG=yes
>
>         cl -c /W3 /nologo -DWIN32  -D_WIN32 -I. -Iproto -DHAVE_PATHDEF -DWIN32   -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG  -DNBDEBUG    -DWINVER=0
> x0400 -D_WIN32_WINNT=0x0400 /Ox -DNDEBUG  -DGLOBAL_IME -DFEAT_MBYTE -DFEAT_GUI_W32 -DDYNAMIC_GETTEXT -DFEAT_BIG /Zi /Fo.\ObjG/ /Fd.\ObjG/ gl
> bl_ime.cpp
> glbl_ime.cpp
> nbdebug.h(50) : error C2065: 'u_int' : undeclared identifier
> nbdebug.h(50) : error C2146: syntax error : missing ')' before identifier 'wait_flags'
> nbdebug.h(50) : error C2182: 'nbdebug_wait' : illegal use of type 'void'
> nbdebug.h(50) : error C2059: syntax error : ')'
> nbdebug.h(54) : error C2239: unexpected token 'identifier' following declaration of 'u_int'
> nbdebug.h(54) : error C2061: syntax error : identifier 'nb_dlevel'
> NMAKE : fatal error U1077: 'cl' : return code '0x2'
> Stop.
>
> D:\wfb\vim\bld\vim70aa\vim7\src )
>
> If you do not see what I see, can you please create a glbl_ime.i.bz2
> file I can download? I can then compare your glbl_ime.i and mine.

I never compile with NBDEBUG defined and don't see a reason to use it.
Just leave it out.

> 2) I thought #define STRICT should be used for each #include <windows.h>
> unless contra-indicated. (It is used for 3/11.) Did you have a specific
> reason for rejecting my thought or was it that its absence is not known
> to cause harm?

I don't know what the effect is of defining STRICT.  I don't like
changing things that I do not understand.

--
"The sun oozed over the horizon, shoved aside darkness, crept along the
greensward, and, with sickly fingers, pushed through the castle window,
revealing the pillaged princess, hand at throat, crown asunder, gaping
in frenzied horror at the sated, sodden amphibian lying beside her,
disbelieving the magnitude of the frog's deception, screaming madly,
"You lied!"
    - Winner of the Bulwer-Lytton contest (San Jose State University),
      wherein one writes only the first line of a bad novel

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Reply | Threaded
Open this post in threaded view
|

Re: vim7: PC-lint suggested changes (long)

Walter Briscoe
In message <[hidden email]> of Fri, 24 Jun
2005 12:07:58 in , Bram Moolenaar <[hidden email]> writes
[snip]

>I never compile with NBDEBUG defined and don't see a reason to use it.
>Just leave it out.
I do not hide that I am looking for unimportant bugs. I am disturbed
that you propose to leave an obscure build error in place once found.
NBDEBUG is an interface in Make_bc5.mak, Make_cyg.mak, Make_ming.mak,
and Make_mvc.mak. A commented removal of WIN32_LEAN_AND_MEAN seems
reasonable to me.

>
>> 2) I thought #define STRICT should be used for each #include <windows.h>
>> unless contra-indicated. (It is used for 3/11.) Did you have a specific
>> reason for rejecting my thought or was it that its absence is not known
>> to cause harm?
>
>I don't know what the effect is of defining STRICT.  I don't like
>changing things that I do not understand.
I am relaxed about STRICT. I just don't like to see it used
inconsistently for no known reason. MSDN article Q83456 has "... STRICT,
which enforces the strictest possible type checking by the compiler".
I appreciate there may be implementation bugs in this - particularly in
implementations I do not exercise.

A typical "HOW?" of STRICT in VC5 changes "typedef HANDLE HWND;" to
"struct HWND__ { int unused; }; typedef struct HWND__ *HWND;".

However, this gets no diagnostics - even at the maximum warning level:
(I need the pragmas as Microsoft header files are not W4-clean.)
#define STRICT
#pragma warning(disable: 4100 4115 4201 4214 4514)
#include <windows.h>
#pragma warning(default: 4100 4115 4201 4214)

    void
foo(HANDLE handle, HWND hwnd)
{
    handle = hwnd;
    hwnd = handle;
}

In PC-lint, -strong(A) produces "Assignment to strong type '<name>' in
context: assignment" diagnostics regardless of the setting of STRICT.
Casts - signifying the type change is intentional - silence them.

I conclude STRICT is of no use.
Can somebody please give a small example proving me wrong?
You can select the implementation. Please test before posting.
I made an example from stuff in MSDN but could not get STRICT to bite.

Thanks to Bram for removing an unfounded, comfortable feeling. ;)
--
Walter Briscoe