unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* compilation warning
@ 2010-06-29  0:55 Dan Nicolaescu
  2010-06-29  1:38 ` Christoph
  2010-06-29  5:55 ` martin rudalics
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Nicolaescu @ 2010-06-29  0:55 UTC (permalink / raw)
  To: emacs-devel


Compiling with -Wempty-body gives this warning:

emacs/src/frame.c:1390: warning: suggest braces around empty body in an 'if' statement

The code in question is:

  if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
    ;

It looks a bit odd.  What's the right fix here?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: compilation warning
  2010-06-29  0:55 compilation warning Dan Nicolaescu
@ 2010-06-29  1:38 ` Christoph
  2010-06-29  5:55 ` martin rudalics
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph @ 2010-06-29  1:38 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

On 6/28/2010 6:55 PM, Dan Nicolaescu wrote:
>
> Compiling with -Wempty-body gives this warning:
>
> emacs/src/frame.c:1390: warning: suggest braces around empty body in an 'if' statement
>
> The code in question is:
>
>    if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
>      ;
>
> It looks a bit odd.  What's the right fix here?
>
>

Something like this:

if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern 
("tooltip"))))
   {
     ; /* empty body */
   }

Christoph



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: compilation warning
  2010-06-29  0:55 compilation warning Dan Nicolaescu
  2010-06-29  1:38 ` Christoph
@ 2010-06-29  5:55 ` martin rudalics
  2010-07-01  5:40   ` Dan Nicolaescu
  1 sibling, 1 reply; 5+ messages in thread
From: martin rudalics @ 2010-06-29  5:55 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

> emacs/src/frame.c:1390: warning: suggest braces around empty body in an 'if' statement
> 
> The code in question is:
> 
>   if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
>     ;
> 
> It looks a bit odd.  What's the right fix here?

I'm using

*** src/frame.c	2010-04-20 01:50:52 +0000
--- src/frame.c	2010-06-29 05:36:07 +0000
***************
*** 1330,1335 ****
--- 1330,1336 ----
     struct kboard *kb;

     int minibuffer_selected;
+   int tooltip_frame = !NILP (Fframe_parameter (frame, intern ("tooltip")));

     if (EQ (frame, Qnil))
       {
***************
*** 1385,1393 ****
        frame is a tooltip.  FORCE is set to `noelisp' when handling
        a disconnect from the terminal, so we don't dare call Lisp
        code.  */
!   if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
       ;
!   if (EQ (force, Qnoelisp))
       pending_funcalls
         = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame),
   	       pending_funcalls);
--- 1386,1394 ----
        frame is a tooltip.  FORCE is set to `noelisp' when handling
        a disconnect from the terminal, so we don't dare call Lisp
        code.  */
!   if (NILP (Vrun_hooks) || tooltip_frame)
       ;
!   else if (EQ (force, Qnoelisp))
       pending_funcalls
         = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame),
   	       pending_funcalls);
***************
*** 1633,1639 ****
       }

     /* Cause frame titles to update--necessary if we now have just one frame.  */
!   update_mode_lines = 1;

     return Qnil;
   }
--- 1634,1641 ----
       }

     /* Cause frame titles to update--necessary if we now have just one frame.  */
!   if (!tooltip_frame)
!     update_mode_lines = 1;

     return Qnil;
   }





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: compilation warning
  2010-06-29  5:55 ` martin rudalics
@ 2010-07-01  5:40   ` Dan Nicolaescu
  2010-07-02 16:35     ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Nicolaescu @ 2010-07-01  5:40 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

martin rudalics <rudalics@gmx.at> writes:

>> emacs/src/frame.c:1390: warning: suggest braces around empty body in an 'if' statement
>>
>> The code in question is:
>>
>>   if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
>>     ;
>>
>> It looks a bit odd.  What's the right fix here?
>
> I'm using

Any reason not to check this in?


> *** src/frame.c	2010-04-20 01:50:52 +0000
> --- src/frame.c	2010-06-29 05:36:07 +0000
> ***************
> *** 1330,1335 ****
> --- 1330,1336 ----
>     struct kboard *kb;
>
>     int minibuffer_selected;
> +   int tooltip_frame = !NILP (Fframe_parameter (frame, intern ("tooltip")));
>
>     if (EQ (frame, Qnil))
>       {
> ***************
> *** 1385,1393 ****
>        frame is a tooltip.  FORCE is set to `noelisp' when handling
>        a disconnect from the terminal, so we don't dare call Lisp
>        code.  */
> !   if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
>       ;
> !   if (EQ (force, Qnoelisp))
>       pending_funcalls
>         = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame),
>   	       pending_funcalls);
> --- 1386,1394 ----
>        frame is a tooltip.  FORCE is set to `noelisp' when handling
>        a disconnect from the terminal, so we don't dare call Lisp
>        code.  */
> !   if (NILP (Vrun_hooks) || tooltip_frame)
>       ;
> !   else if (EQ (force, Qnoelisp))
>       pending_funcalls
>         = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame),
>   	       pending_funcalls);
> ***************
> *** 1633,1639 ****
>       }
>
>     /* Cause frame titles to update--necessary if we now have just one frame.  */
> !   update_mode_lines = 1;
>
>     return Qnil;
>   }
> --- 1634,1641 ----
>       }
>
>     /* Cause frame titles to update--necessary if we now have just one frame.  */
> !   if (!tooltip_frame)
> !     update_mode_lines = 1;
>
>     return Qnil;
>   }



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: compilation warning
  2010-07-01  5:40   ` Dan Nicolaescu
@ 2010-07-02 16:35     ` Chong Yidong
  0 siblings, 0 replies; 5+ messages in thread
From: Chong Yidong @ 2010-07-02 16:35 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: martin rudalics, emacs-devel

Dan Nicolaescu <dann@gnu.org> writes:

>>>   if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
>>>     ;
>>>
>>> It looks a bit odd.  What's the right fix here?
>>
>> I'm using
>
> Any reason not to check this in?

I've checked a tweaked patch into the branch.  Thanks.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-02 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-29  0:55 compilation warning Dan Nicolaescu
2010-06-29  1:38 ` Christoph
2010-06-29  5:55 ` martin rudalics
2010-07-01  5:40   ` Dan Nicolaescu
2010-07-02 16:35     ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).