[PATCH] Remove unreachable code in prompt.c

View: New views
4 Messages — Rating Filter:   Alert me  

[PATCH] Remove unreachable code in prompt.c

by Edmund Wong-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

While compiling on a Windows box, I'd get the following warnings:

c:\svn\subversion\libsvn_subr\prompt.c(64): warning C4702: unreachable code
c:\svn\subversion\libsvn_subr\prompt.c(71): warning C4702: unreachable code
c:\svn\subversion\libsvn_subr\prompt.c(72): warning C4702: unreachable code
c:\svn\subversion\libsvn_subr\prompt.c(74): warning C4702: unreachable code

This patch removes the warnings.

Log as follows

[[[
 Changed the ifdef WIN32 #endif block to an #ifndef WIN32 ... #else .. #endif
block to avoid the 'unreachable code' warnings in Windows.

 * subversion\libsvn_subr\prompt.c
   wait_for_input: Changed #ifdef block to #ifndef block.


]]]

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414122

prompt_c.diff (1K) Download Attachment

Re: [PATCH] Remove unreachable code in prompt.c

by Julian Foad :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-11-03 at 22:28 +0800, Edmund Wong wrote:

> Hi,
>
> While compiling on a Windows box, I'd get the following warnings:
>
> c:\svn\subversion\libsvn_subr\prompt.c(64): warning C4702: unreachable code
> c:\svn\subversion\libsvn_subr\prompt.c(71): warning C4702: unreachable code
> c:\svn\subversion\libsvn_subr\prompt.c(72): warning C4702: unreachable code
> c:\svn\subversion\libsvn_subr\prompt.c(74): warning C4702: unreachable code
>
> This patch removes the warnings.
>
> Log as follows
>
> [[[
>  Changed the ifdef WIN32 #endif block to an #ifndef WIN32 ... #else .. #endif
> block to avoid the 'unreachable code' warnings in Windows.
>
>  * subversion\libsvn_subr\prompt.c
>    wait_for_input: Changed #ifdef block to #ifndef block.
>
>
> ]]]

Thanks for the patch. I committed it in r40371, tweaking it to also move
the comment that goes with the "return" statement.

I wrote the log message as:
[[[
Put some code that is unused on Windows into a '#ifndef WIN32' block, to
avoid 'unreachable code' warnings.

* subversion/libsvn_subr/prompt.c
  (wait_for_input): As above.

Patch by: Edmund Wong <ed{_AT_}kdtc.net>
(tweaked by me)
]]]

- Julian

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414373

Re: [PATCH] Remove unreachable code in prompt.c

by Edmund Wong-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Julian Foad wrote:

> On Tue, 2009-11-03 at 22:28 +0800, Edmund Wong wrote:
>> Hi,
>>
>> While compiling on a Windows box, I'd get the following warnings:
>>
>> c:\svn\subversion\libsvn_subr\prompt.c(64): warning C4702: unreachable code
>> c:\svn\subversion\libsvn_subr\prompt.c(71): warning C4702: unreachable code
>> c:\svn\subversion\libsvn_subr\prompt.c(72): warning C4702: unreachable code
>> c:\svn\subversion\libsvn_subr\prompt.c(74): warning C4702: unreachable code
>>
>> This patch removes the warnings.
>>
>> Log as follows
>>
>> [[[
>>  Changed the ifdef WIN32 #endif block to an #ifndef WIN32 ... #else .. #endif
>> block to avoid the 'unreachable code' warnings in Windows.
>>
>>  * subversion\libsvn_subr\prompt.c
>>    wait_for_input: Changed #ifdef block to #ifndef block.
>>
>>
>> ]]]
>
> Thanks for the patch. I committed it in r40371, tweaking it to also move
> the comment that goes with the "return" statement.
>
> I wrote the log message as:
> [[[
> Put some code that is unused on Windows into a '#ifndef WIN32' block, to
> avoid 'unreachable code' warnings.
>
> * subversion/libsvn_subr/prompt.c
>   (wait_for_input): As above.
>
> Patch by: Edmund Wong <ed{_AT_}kdtc.net>
> (tweaked by me)
> ]]]
>
Thanks Julian for the help in the log.  I still haven't gotten the hang
of writing proper log messages.  It's like there's so many different
ways of expressing the changes, it's a bit hard.

Edmund

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414596

Log messages [was: [PATCH] Remove unreachable code in prompt.c]

by Julian Foad :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Edmund Wong wrote:

> Julian Foad wrote:
> > On Tue, 2009-11-03 at 22:28 +0800, Edmund Wong wrote:
> >> [[[
> >>  Changed the ifdef WIN32 #endif block to an #ifndef WIN32 ... #else .. #endif
> >> block to avoid the 'unreachable code' warnings in Windows.
> >>
> >>  * subversion\libsvn_subr\prompt.c
> >>    wait_for_input: Changed #ifdef block to #ifndef block.
> >> ]]]
> >
> > Thanks for the patch. I committed it in r40371, tweaking it to also move
> > the comment that goes with the "return" statement.
> >
> > I wrote the log message as:
> > [[[
> > Put some code that is unused on Windows into a '#ifndef WIN32' block, to
> > avoid 'unreachable code' warnings.
> >
> > * subversion/libsvn_subr/prompt.c
> >   (wait_for_input): As above.
> > ]]]
> >
> Thanks Julian for the help in the log.  I still haven't gotten the hang
> of writing proper log messages.  It's like there's so many different
> ways of expressing the changes, it's a bit hard.

It's an art, and there is no "correct" way. However, the guideline I
apply to myself is first to answer these questions:

  * Why make a change at all? (Bug fix? Enhancement?)
  * What result is intended? (Behaviour change? Benefit?)

This should give the reader (reviewer) enough high-level information to
judge whether the patch does what it is supposed to do. Then the next
section goes on to explain how the patch does what it does, if it is
complex enough to need further explanation.

In this patch, the important thing about the intent is that we are
hiding the code from the compiler, not exactly which preprocessor
directives we are using.

- Julian

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414694