[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fkill_emacs NO_RETURN
From: |
Dan Nicolaescu |
Subject: |
Re: Fkill_emacs NO_RETURN |
Date: |
Sun, 09 Apr 2006 12:13:36 -0700 |
Eli Zaretskii <address@hidden> writes:
> This change:
>
> 2006-04-09 Dan Nicolaescu <address@hidden>
>
> * puresize.h (pure_write_error): Mark as NO_RETURN.
>
> * lisp.h (args_out_of_range, args_out_of_range_3)
> (Fkill_emacs): Likewise.
>
> marks Fkill_emacs as __attribute__((no_return)) for those versions of
> GCC which support that. I think this change is for the worse: now GCC
> whines that a function that is marked no-return returns a value. This
> is because Fkill_emacs has this at its end:
>
> exit (INTEGERP (arg) ? XINT (arg) : EXIT_SUCCESS);
> /* NOTREACHED */
> return Qnil;
>
> The ``NOTREACHED return'' is there because DEFUN declares a function
> that returns a Lisp_Object, and some compilers will complain if
> there's no return statement in such a function.
>
> So either we find a clean way to condition `return Qnil' on NO_RETURN
> being defined to nothing, or we should revert this change.
How about just deleting the return statement?
gcc has supported the noreturn attribute since at least gcc-2.95.
Other compilers might just warn if they don't realize that "exit" does
not return. I think quite a few modern compilers know that.
> (Why was it made, anyway?)
One of the Coverity reports was due to the fact that the tool did not
realize that Fkill_emacs cannot return.
IMO marking the function as not returning will prevent having to
analyze similar errors in the future with other checking tools.
Re: Fkill_emacs NO_RETURN, Stefan Monnier, 2006/04/09